Skip to content

Instantly share code, notes, and snippets.

@xecgr
Created May 13, 2016 06:29
Show Gist options
  • Save xecgr/88db07f8a4c3ec0ecf51478ed2fb56e0 to your computer and use it in GitHub Desktop.
Save xecgr/88db07f8a4c3ec0ecf51478ed2fb56e0 to your computer and use it in GitHub Desktop.
import requests,urllib3
urllib3.disable_warnings()
choice = ''
while not choice:
choice = raw_input("Hola mestre, quin hashtag vols hackejar?: ")
headers = {
'host': 'i.instagram.com',
'Connection': 'keep-alive',
'X-IG-Connection-Type': 'WIFI',
'X-IG-Capabilities': '3Q==',
'Accept-Language': 'es-ES, en-US',
#aquesta cookie varia en el temps, pero si la treiem funciona igual!
#'Cookie': 'DADESPERSONALS',
'User-Agent': 'Instagram 7.18.2 Android (21/5.0; 240dpi; 480x800; MODELDEMOBIL; es_ES)',
'Accept-Encoding': 'gzip, deflate, sdch',
}
#mitm url
#url = 'https://i.instagram.com/api/v1/tags/{choice}/related/?visited=%5B%7B%22id%22%3A%22seville%22%2C%22type%22%3A%22hashtag%22%7D%2C%7B%22id%22%3A%22seville%22%2C%22type%22%3A%22hashtag%22%7D%2C%7B%22id%22%3A%22{choice}%22%2C%22type%22%3A%22hashtag%22%7D%5D&related_types=%5B%22hashtag%22%5D'.format(
#url minima sense visited (menys verbose)
url = 'https://i.instagram.com/api/v1/tags/{choice}/related/?related_types=%5B%22hashtag%22%5D'.format(
choice = choice,
)
r = requests.get(url, headers = headers)
for t in r.json().get('related',[]):
print t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment