From 47bd107686802c2ee0c3faa083c39d07b7db59dd Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Sun, 11 Jul 2021 18:41:05 +0200 Subject: [PATCH] [instagram] use get_content --- src/you_get/extractors/instagram.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/you_get/extractors/instagram.py b/src/you_get/extractors/instagram.py index 0a9da345..e7c79717 100755 --- a/src/you_get/extractors/instagram.py +++ b/src/you_get/extractors/instagram.py @@ -6,14 +6,14 @@ from ..common import * def instagram_download(url, output_dir='.', merge=True, info_only=False, **kwargs): url = r1(r'([^?]*)', url) - html = get_html(url, faker=True) + cont = get_content(url, headers=fake_headers) vid = r1(r'instagram.com/\w+/([^/]+)', url) - description = r1(r'\s([^<]*)', html) # with logged-in cookies + description = r1(r'\s([^<]*)', cont) # with logged-in cookies title = "{} [{}]".format(description.replace("\n", " "), vid) - stream = r1(r'', html) + data = re.search(r'window\._sharedData\s*=\s*(.*);', cont) try: info = json.loads(data.group(1)) post = info['entry_data']['PostPage'][0] assert post except: # with logged-in cookies - data = re.search(r'window\.__additionalDataLoaded\(\'[^\']+\',(.*)\);', html) + data = re.search(r'window\.__additionalDataLoaded\(\'[^\']+\',(.*)\);', cont) if data is not None: log.e('[Warning] Cookies needed.') post = json.loads(data.group(1))