I am a complete newbie in python. Trying to scrape the comment from a particular thread in Instagram. I found that everytime I click "load more comments" a requests will be sent and return a json object. Yet the X-Instagram-GIS variable change every-time if I try to sent another new requests for the next query.
I have search online and found that X-Instagram-GIS is a md5 hash variable, created from rhx_gis and the query variable. I have found these two variables but still cannot get the correct value for the next request.
import hashlib
def head_gen(self):
rhx_gis='4ed1f588adb21e4184a8f6d075782635'
query_variable='/query/?query_hash=f0986789a5c5d17c2400faebf16efd0d&variables={"shortcode":"Bl3j0I2gF12","first":32,"after":"AQD5RkNkpYakucKwntj2zTK7yvlACbeLfYXraABuucJhckBjlz0ytuaiJMmqnlwo_sjqAbtMa-gdwrZO4-VjEhnTuQbMVnqgnx-Hy8S_5BdA3w"}'
values = "%s:%s" % (
rhx_gis,
query_variable)
m=hashlib.md5(values.encode())
print(m.hexdigest())