Skip to content

Instantly share code, notes, and snippets.

@desulaid
Created February 18, 2019 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save desulaid/b20a332bce0c57b359c6fba8b8477e28 to your computer and use it in GitHub Desktop.
Save desulaid/b20a332bce0c57b359c6fba8b8477e28 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from requests import get
from json import dumps
from json import loads
from cgi import FieldStorage
class InstagramHashtag:
def __init__(self, hashtag):
url = 'https://www.instagram.com/explore/tags/{0}/?'.format(hashtag)
self.data = {}
content = get(url, params={
'__a': '1',
'more_available': True
}).content
content = loads(content)['graphql']['hashtag']['edge_hashtag_to_media']['edges']
true = True
false = False
j = 0
buff = eval(dumps(content))
for i in buff:
if i['node']['is_video'] == True:
continue
self.data[j] = i['node']['thumbnail_src']
j += 1
url = FieldStorage()
hashtag = url.getfirst("get", "pornovide")
insta = InstagramHashtag(hashtag)
print("Content-Type: application/json\n\n")
print(insta.data)
from http.server import HTTPServer, CGIHTTPRequestHandler
server_address = ("", 8000)
httpd = HTTPServer(server_address, CGIHTTPRequestHandler)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment