diff options
| author | Tobias Bell <tobias.bell@gmail.com> | 2014-05-17 17:07:40 +0200 | 
|---|---|---|
| committer | Tobias Bell <tobias.bell@gmail.com> | 2014-05-17 17:07:40 +0200 | 
| commit | 9e30092361c3b94d66bf2aaf99087d0df201718c (patch) | |
| tree | 6c4c61479e27f3c342f9f8fab35893927d6009ef | |
| parent | 10d5c7aa5fcc4a05b039cc147b3e36732a56b0d2 (diff) | |
[gameone] Added extraction of description and fixed failing tests
| -rw-r--r-- | youtube_dl/extractor/gameone.py | 14 | 
1 files changed, 13 insertions, 1 deletions
| diff --git a/youtube_dl/extractor/gameone.py b/youtube_dl/extractor/gameone.py index d5fb19cec..855df74fb 100644 --- a/youtube_dl/extractor/gameone.py +++ b/youtube_dl/extractor/gameone.py @@ -2,6 +2,7 @@  from __future__ import unicode_literals  import re +import xml.etree.ElementTree as ET  from .common import InfoExtractor  from ..utils import xpath_with_ns @@ -16,7 +17,7 @@ RAW_MP4_URL = 'http://cdn.riptide-mtvn.com/'  class GameOneIE(InfoExtractor):      _VALID_URL = r'https?://(?:www\.)?gameone\.de/tv/(?P<id>\d+)' -    _TESTS = { +    _TEST = {          'url': 'http://www.gameone.de/tv/288',          'md5': '136656b7fb4c9cb4a8e2d500651c499b',          'info_dict': { @@ -25,6 +26,11 @@ class GameOneIE(InfoExtractor):              'title': 'Game One - Folge 288',              'duration': 1238,              'thumbnail': 'http://s3.gameone.de/gameone/assets/video_metas/teaser_images/000/643/636/big/640x360.jpg', +            'description': 'Puh, das ist ja wieder eine volle Packung! Erst begleiten wir Nils zum ' +                'FIFA-Pressepokal 2014, den er nach 2010 nun zum zweiten Mal gewinnen will.\n' +                'Danach gibt’s eine Vorschau auf die drei kommenden Hits “Star Citizen”, “Kingdom Come: Deliverance” und “Project Cars”.\n' +                'Und dann geht’s auch schon weiter mit der nächsten Folge vom Nerdquiz! Der schöne Trant foltert seine Kandidaten wieder ' +                'mit fiesen Fragen. Hier gibt’s die erste Hälfte, in Folge 289 geht’s weiter.'          }      } @@ -39,6 +45,7 @@ class GameOneIE(InfoExtractor):          mrss = self._download_xml(mrss_url, video_id, 'Downloading mrss')          title = mrss.find('.//item/title').text          thumbnail = mrss.find('.//item/image').get('url') +        description = self._extract_description(mrss)          content = mrss.find(xpath_with_ns('.//media:content', NAMESPACE_MAP))          content_url = content.get('url') @@ -61,4 +68,9 @@ class GameOneIE(InfoExtractor):              'thumbnail': thumbnail,              'duration': duration,              'formats': formats, +            'description': description,          } + +    def _extract_description(self, mrss): +        description = mrss.find('.//item/description') +        return u''.join(t for t in description.itertext()) | 
