A feature-rich command-line audio/video downloader
[ie/instagram] Fix logged-in extraction (#17278)
bashonly1f1101d0dc8a
diff --git a/yt_dlp/extractor/instagram.py b/yt_dlp/extractor/instagram.pyindex b44e5e0824..359d6186d2 100644--- a/yt_dlp/extractor/instagram.py+++ b/yt_dlp/extractor/instagram.py@@ -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'+@propertydef _api_headers(self):return {@@ -87,7 +92,8 @@ class InstagramBaseIE(InfoExtractor):@staticmethoddef _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(