summary refs log tree commit diff
diff options
context:
space:
mode:
authorDéstin Reed <trox1972@users.noreply.github.com>2016-07-23 17:02:50 +0200
committerSergey M․ <dstftw@gmail.com>2016-07-24 05:37:13 +0700
commit111de00289d8c019764e79247568248f8a4b11f6 (patch)
tree30c28c4f578eab21a10377c681eec05c33152d58
parentb4a131e1a5c345b17df37a9b0c76e612855e5402 (diff)
downloadyoutube-dl-111de00289d8c019764e79247568248f8a4b11f6.tar.gz
youtube-dl-111de00289d8c019764e79247568248f8a4b11f6.tar.xz
youtube-dl-111de00289d8c019764e79247568248f8a4b11f6.zip
[DailyMail] Improve title and description extraction
-rw-r--r--youtube_dl/extractor/dailymail.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dl/extractor/dailymail.py b/youtube_dl/extractor/dailymail.py
index b60a1d813..98c835bf1 100644
--- a/youtube_dl/extractor/dailymail.py
+++ b/youtube_dl/extractor/dailymail.py
@@ -5,19 +5,20 @@ from .common import InfoExtractor
 from ..utils import (
     int_or_none,
     determine_protocol,
+    unescapeHTML,
 )
 
 
 class DailyMailIE(InfoExtractor):
     _VALID_URL = r'https?://(?:www\.)?dailymail\.co\.uk/video/[^/]+/video-(?P<id>[0-9]+)'
     _TEST = {
-        'url': 'http://www.dailymail.co.uk/video/sciencetech/video-1288527/Turn-video-impressionist-masterpiece.html',
-        'md5': '2f639d446394f53f3a33658b518b6615',
+        'url': 'http://www.dailymail.co.uk/video/tvshowbiz/video-1295863/The-Mountain-appears-sparkling-water-ad-Heavy-Bubbles.html',
+        'md5': 'f6129624562251f628296c3a9ffde124',
         'info_dict': {
-            'id': '1288527',
+            'id': '1295863',
             'ext': 'mp4',
-            'title': 'Turn any video into an impressionist masterpiece',
-            'description': 'md5:88ddbcb504367987b2708bb38677c9d2',
+            'title': 'The Mountain appears in sparkling water ad for \'Heavy Bubbles\'',
+            'description': 'md5:a93d74b6da172dd5dc4d973e0b766a84',
         }
     }
 
@@ -26,7 +27,7 @@ class DailyMailIE(InfoExtractor):
         webpage = self._download_webpage(url, video_id)
         video_data = self._parse_json(self._search_regex(
             r"data-opts='({.+?})'", webpage, 'video data'), video_id)
-        title = video_data['title']
+        title = unescapeHTML(video_data['title'])
         video_sources = self._download_json(video_data.get(
             'sources', {}).get('url') or 'http://www.dailymail.co.uk/api/player/%s/video-sources.json' % video_id, video_id)
 
@@ -55,7 +56,7 @@ class DailyMailIE(InfoExtractor):
         return {
             'id': video_id,
             'title': title,
-            'description': video_data.get('descr'),
+            'description': unescapeHTML(video_data.get('descr')),
             'thumbnail': video_data.get('poster') or video_data.get('thumbnail'),
             'formats': formats,
         }