Browse Source

[gameone] Added extraction of description and fixed failing tests

totalwebcasting
Tobias Bell 11 years ago
parent
commit
9e30092361
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      youtube_dl/extractor/gameone.py

+ 13
- 1
youtube_dl/extractor/gameone.py View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
import xml.etree.ElementTree as ET
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import xpath_with_ns from ..utils import xpath_with_ns
@ -16,7 +17,7 @@ RAW_MP4_URL = 'http://cdn.riptide-mtvn.com/'
class GameOneIE(InfoExtractor): class GameOneIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gameone\.de/tv/(?P<id>\d+)' _VALID_URL = r'https?://(?:www\.)?gameone\.de/tv/(?P<id>\d+)'
_TESTS = {
_TEST = {
'url': 'http://www.gameone.de/tv/288', 'url': 'http://www.gameone.de/tv/288',
'md5': '136656b7fb4c9cb4a8e2d500651c499b', 'md5': '136656b7fb4c9cb4a8e2d500651c499b',
'info_dict': { 'info_dict': {
@ -25,6 +26,11 @@ class GameOneIE(InfoExtractor):
'title': 'Game One - Folge 288', 'title': 'Game One - Folge 288',
'duration': 1238, 'duration': 1238,
'thumbnail': 'http://s3.gameone.de/gameone/assets/video_metas/teaser_images/000/643/636/big/640x360.jpg', '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') mrss = self._download_xml(mrss_url, video_id, 'Downloading mrss')
title = mrss.find('.//item/title').text title = mrss.find('.//item/title').text
thumbnail = mrss.find('.//item/image').get('url') thumbnail = mrss.find('.//item/image').get('url')
description = self._extract_description(mrss)
content = mrss.find(xpath_with_ns('.//media:content', NAMESPACE_MAP)) content = mrss.find(xpath_with_ns('.//media:content', NAMESPACE_MAP))
content_url = content.get('url') content_url = content.get('url')
@ -61,4 +68,9 @@ class GameOneIE(InfoExtractor):
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'duration': duration, 'duration': duration,
'formats': formats, 'formats': formats,
'description': description,
} }
def _extract_description(self, mrss):
description = mrss.find('.//item/description')
return u''.join(t for t in description.itertext())

Loading…
Cancel
Save