1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[instagram] update query hashes and headers

This commit is contained in:
Mike Fährmann 2019-08-09 15:44:49 +02:00
parent 2ccf6a9e35
commit a732e9c430
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 14 additions and 13 deletions

View File

@ -21,7 +21,7 @@ class HitomiGalleryExtractor(GalleryExtractor):
test = (
("https://hitomi.la/galleries/867789.html", {
"url": "cb759868d090fe0e2655c3e29ebf146054322b6d",
"keyword": "067b5d9b9c0f98530cd5dd2444e0f5a5b4b00d38",
"keyword": "d097a8db8e810045131b4510c41714004f9eff3a",
}),
("https://hitomi.la/galleries/1036181.html", {
# "aa" subdomain for gallery-id ending in 1 (#142)

View File

@ -8,11 +8,10 @@
"""Extract images from https://www.instagram.com/"""
import hashlib
import json
from .common import Extractor, Message
from .. import text, exception
from ..cache import cache
import json
class InstagramExtractor(Extractor):
@ -209,7 +208,7 @@ class InstagramExtractor(Extractor):
'node_id': 'id',
'edge_to_medias': 'edge_owner_to_timeline_media',
'variables_id': 'id',
'query_hash': '66eb9403e44cc12e5b5ecda48b667d41',
'query_hash': 'f2405b236d85e8296cf30347c9f08c2a',
},
'ProfileChannelPage': {
'page': 'ProfilePage',
@ -225,13 +224,14 @@ class InstagramExtractor(Extractor):
'node_id': 'name',
'edge_to_medias': 'edge_hashtag_to_media',
'variables_id': 'tag_name',
'query_hash': 'f92f56d47dc7a55b606908374b43a314',
'query_hash': 'f12c9ec5e46a3173b2969c712ad84744',
},
}
page = self.request(url).text
shared_data = self._extract_shared_data(page)
psdf = shared_data_fields[page_type]
csrf = shared_data["config"]["csrf_token"]
while True:
# Deal with different structure of pages: the first page
@ -263,7 +263,8 @@ class InstagramExtractor(Extractor):
)
headers = {
"X-Requested-With": "XMLHttpRequest",
"X-Instagram-GIS": hashlib.md5(variables.encode()).hexdigest(),
"X-CSRFToken": csrf,
"X-IG-App-ID": "936619743392459",
}
url = '{}/graphql/query/?query_hash={}&variables={}'.format(
self.root,
@ -379,8 +380,8 @@ class InstagramUserExtractor(InstagramExtractor):
r"/(?!p/|explore/|directory/|accounts/|stories/|tv/)"
r"([^/?&#]+)/?$")
test = ("https://www.instagram.com/instagram/", {
"range": "1-12",
"count": ">= 12",
"range": "1-16",
"count": ">= 16",
})
def __init__(self, match):
@ -399,8 +400,8 @@ class InstagramChannelExtractor(InstagramExtractor):
r"/(?!p/|explore/|directory/|accounts/|stories/|tv/)"
r"([^/?&#]+)/channel")
test = ("https://www.instagram.com/instagram/channel/", {
"range": "1-12",
"count": ">= 12",
"range": "1-16",
"count": ">= 16",
})
def __init__(self, match):
@ -419,8 +420,8 @@ class InstagramTagExtractor(InstagramExtractor):
pattern = (r"(?:https?://)?(?:www\.)?instagram\.com"
r"/explore/tags/([^/?&#]+)")
test = ("https://www.instagram.com/explore/tags/instagram/", {
"range": "1-12",
"count": ">= 12",
"range": "1-16",
"count": ">= 16",
})
def __init__(self, match):

View File

@ -93,7 +93,7 @@ class NewgroundsUserExtractor(NewgroundsExtractor):
test = (
("https://blitzwuff.newgrounds.com/art", {
"url": "24b19c4a135a09889fac7b46a74e427e4308d02b",
"keyword": "98566e0c8096a8099b8d71962fea7e31c8b098d4",
"keyword": "62981f7bdd66e1f1c72ab1d9b932423c156bc9a1",
}),
("https://blitzwuff.newgrounds.com/"),
)