[instagram] Show appropriate error when login is needed

Closes #1264
This commit is contained in:
pukkandan 2021-10-14 14:35:10 +05:30
parent d5a39f0bad
commit a0c716bb61
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698
2 changed files with 5 additions and 3 deletions

View file

@ -441,8 +441,8 @@ class InfoExtractor(object):
_LOGIN_HINTS = {
'any': 'Use --cookies, --username and --password or --netrc to provide account credentials',
'cookies': (
'Use --cookies for the authentication. '
'See https://github.com/ytdl-org/youtube-dl#how-do-i-pass-cookies-to-youtube-dl for how to pass cookies'),
'Use --cookies-from-browser or --cookies for the authentication. '
'See https://github.com/ytdl-org/youtube-dl#how-do-i-pass-cookies-to-youtube-dl for how to manually pass cookies'),
'password': 'Use --username and --password or --netrc to provide account credentials',
}

View file

@ -145,7 +145,9 @@ class InstagramIE(InfoExtractor):
video_id = mobj.group('id')
url = mobj.group('url')
webpage = self._download_webpage(url, video_id)
webpage, urlh = self._download_webpage_handle(url, video_id)
if 'www.instagram.com/accounts/login' in urlh.geturl().rstrip('/'):
self.raise_login_required('You need to log in to access this content', method='cookies')
(media, video_url, description, thumbnail, timestamp, uploader,
uploader_id, like_count, comment_count, comments, height,