Skip to content

Commit

Permalink
Revert "[youtube] improve title and description extraction(closes #21…
Browse files Browse the repository at this point in the history
…934)"

This reverts commit 5eabe9c.
  • Loading branch information
Lamieur committed Apr 20, 2020
1 parent 1e07ee7 commit 3847404
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions youtube_dl/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1820,11 +1820,16 @@ def extract_unavailable_message():
video_details = try_get(
player_response, lambda x: x['videoDetails'], dict) or {}

video_title = video_info.get('title', [None])[0] or video_details.get('title')
if not video_title:
# title
if 'title' in video_info:
video_title = video_info['title'][0]
elif 'title' in player_response:
video_title = video_details['title']
else:
self._downloader.report_warning('Unable to extract video title')
video_title = '_'

# description
description_original = video_description = get_element_by_id("eow-description", video_webpage)
if video_description:

Expand All @@ -1849,7 +1854,11 @@ def replace_url(m):
''', replace_url, video_description)
video_description = clean_html(video_description)
else:
video_description = self._html_search_meta('description', video_webpage) or video_details.get('shortDescription')
fd_mobj = re.search(r'<meta name="description" content="([^"]+)"', video_webpage)
if fd_mobj:
video_description = unescapeHTML(fd_mobj.group(1))
else:
video_description = ''

if not smuggled_data.get('force_singlefeed', False):
if not self._downloader.params.get('noplaylist'):
Expand Down

0 comments on commit 3847404

Please sign in to comment.