Created
February 18, 2019 14:58
-
-
Save desulaid/b20a332bce0c57b359c6fba8b8477e28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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