mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 05:25:02 +03:00
[instagram] fix extraction
This commit is contained in:
parent
4ab02216cd
commit
7acebdab9d
@ -145,7 +145,7 @@ fake_headers = {
|
||||
'Accept-Charset': 'UTF-8,*;q=0.5',
|
||||
'Accept-Encoding': 'gzip,deflate,sdch',
|
||||
'Accept-Language': 'en-US,en;q=0.8',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.2592.68' # Latest Edge
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/126.0.2592.113' # Latest Edge
|
||||
}
|
||||
|
||||
if sys.stdout.isatty():
|
||||
|
@ -5,8 +5,13 @@ __all__ = ['instagram_download']
|
||||
from ..common import *
|
||||
|
||||
def instagram_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.2592.87',
|
||||
'sec-fetch-mode': 'navigate' # important
|
||||
}
|
||||
|
||||
url = r1(r'([^?]*)', url)
|
||||
cont = get_content(url, headers=fake_headers)
|
||||
cont = get_content(url, headers=headers)
|
||||
|
||||
vid = r1(r'instagram.com/\w+/([^/]+)', url)
|
||||
description = r1(r'<meta property="og:title" content="([^"]*)"', cont) or \
|
||||
@ -15,6 +20,8 @@ def instagram_download(url, output_dir='.', merge=True, info_only=False, **kwarg
|
||||
|
||||
appId = r1(r'"appId":"(\d+)"', cont)
|
||||
media_id = r1(r'"media_id":"(\d+)"', cont)
|
||||
logging.debug('appId: %s' % appId)
|
||||
logging.debug('media_id: %s' % media_id)
|
||||
|
||||
api_url = 'https://i.instagram.com/api/v1/media/%s/info/' % media_id
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user