1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-12-25 17:15:52 +01:00

[xtube] Improve title extraction

This commit is contained in:
Vobe 2017-02-11 21:11:55 +01:00 committed by Sergey M․
parent 6e5956e6ba
commit f6d6ca1db3
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -53,7 +53,7 @@ class XTubeIE(InfoExtractor):
if not display_id: if not display_id:
display_id = video_id display_id = video_id
url = 'http://www.xtube.com/video-watch/-%s' % video_id url = 'http://www.xtube.com/watch.php?v=%s' % video_id
req = sanitized_Request(url) req = sanitized_Request(url)
req.add_header('Cookie', 'age_verified=1; cookiesAccepted=1') req.add_header('Cookie', 'age_verified=1; cookiesAccepted=1')
@ -73,7 +73,7 @@ class XTubeIE(InfoExtractor):
self._sort_formats(formats) self._sort_formats(formats)
title = self._search_regex( title = self._search_regex(
(r'<h1>(?P<title>[^<]+)</h1>', r'videoTitle\s*:\s*(["\'])(?P<title>.+?)\1'), (r'<h1>\s*(?P<title>[^<]+?)\s*</h1>', r'videoTitle\s*:\s*(["\'])(?P<title>.+?)\1'),
webpage, 'title', group='title') webpage, 'title', group='title')
description = self._search_regex( description = self._search_regex(
r'</h1>\s*<p>([^<]+)', webpage, 'description', fatal=False) r'</h1>\s*<p>([^<]+)', webpage, 'description', fatal=False)