mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-08 09:10:09 +01:00
[gameone] Added extraction of description and fixed failing tests
This commit is contained in:
parent
10d5c7aa5f
commit
9e30092361
@ -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 @@
|
|||||||
|
|
||||||
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 @@ def _real_extract(self, url):
|
|||||||
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 @@ def _real_extract(self, url):
|
|||||||
'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…
Reference in New Issue
Block a user