mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-07-22 09:27:11 +00:00
[ie/instagram] Fix logged-in extraction (#17278)
Closes #17275 Authored by: bashonly
This commit is contained in:
@@ -42,7 +42,6 @@ def _id_to_pk(shortcode):
|
||||
|
||||
|
||||
class InstagramBaseIE(InfoExtractor):
|
||||
_API_BASE_URL = 'https://i.instagram.com/api/v1'
|
||||
_BASE_URL = 'https://www.instagram.com/'
|
||||
_APP_IDS = {
|
||||
'ios': '124024574287414',
|
||||
@@ -75,6 +74,12 @@ class InstagramBaseIE(InfoExtractor):
|
||||
def _is_web_app(self):
|
||||
return self._app_id == self._APP_IDS['web']
|
||||
|
||||
@property
|
||||
def _API_BASE_URL(self):
|
||||
if not self._is_web_app:
|
||||
return 'https://i.instagram.com/api/v1'
|
||||
return 'https://www.instagram.com/api/v1'
|
||||
|
||||
@property
|
||||
def _api_headers(self):
|
||||
return {
|
||||
@@ -87,7 +92,8 @@ class InstagramBaseIE(InfoExtractor):
|
||||
|
||||
@staticmethod
|
||||
def _is_login_redirect(url):
|
||||
return urllib.parse.urlparse(url).path.startswith('/accounts/login')
|
||||
path = urllib.parse.urlparse(url).path
|
||||
return path.startswith('/accounts/login') or path == '/'
|
||||
|
||||
def _get_count(self, media, kind, *keys):
|
||||
return traverse_obj(
|
||||
|
||||
Reference in New Issue
Block a user