[xtube] Improve title extraction
authorVobe <vobe@mailinator.com>
Sat, 11 Feb 2017 20:11:55 +0000 (21:11 +0100)
committerSergey M․ <dstftw@gmail.com>
Mon, 13 Feb 2017 16:34:14 +0000 (23:34 +0700)
youtube_dl/extractor/xtube.py

index 11717fe980db5c9da97dd8a0c4710c479b0a8715..ed3a376494140d642fd978468262cbfb69344279 100644 (file)
@@ -53,7 +53,7 @@ class XTubeIE(InfoExtractor):
 
         if not display_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.add_header('Cookie', 'age_verified=1; cookiesAccepted=1')
@@ -73,7 +73,7 @@ class XTubeIE(InfoExtractor):
         self._sort_formats(formats)
 
         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')
         description = self._search_regex(
             r'</h1>\s*<p>([^<]+)', webpage, 'description', fatal=False)