Skip to content

Commit

Permalink
Report error message from youtube as error (Closes #33)
Browse files Browse the repository at this point in the history
:ci skip dl
  • Loading branch information
pukkandan committed Jan 25, 2021
1 parent 5b328c9 commit 6b8eb0c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion youtube_dlc/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -3371,8 +3371,16 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, item_id)
identity_token = self._extract_identity_token(webpage, item_id)
data = self._extract_yt_initial_data(item_id, webpage)
err_msg = None
for alert_type, alert_message in self._extract_alerts(data):
self._downloader.report_warning('YouTube said: %s - %s' % (alert_type, alert_message))
if alert_type.lower() == 'error':
if err_msg:
self._downloader.report_warning('YouTube said: %s - %s' % ('ERROR', err_msg))
err_msg = alert_message
else:
self._downloader.report_warning('YouTube said: %s - %s' % (alert_type, alert_message))
if err_msg:
raise ExtractorError('YouTube said: %s' % err_msg, expected=True)
tabs = try_get(
data, lambda x: x['contents']['twoColumnBrowseResultsRenderer']['tabs'], list)
if tabs:
Expand Down

0 comments on commit 6b8eb0c

Please sign in to comment.