mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 18:51:03 +01:00
[dfb] Extract display_id and modernize
This commit is contained in:
parent
eae89f92e6
commit
ddcdc684e2
@ -3,17 +3,19 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import unified_strdate
|
||||||
|
|
||||||
|
|
||||||
class DFBIE(InfoExtractor):
|
class DFBIE(InfoExtractor):
|
||||||
IE_NAME = 'tv.dfb.de'
|
IE_NAME = 'tv.dfb.de'
|
||||||
_VALID_URL = r'https?://tv\.dfb\.de/video/[^/]+/(?P<id>\d+)'
|
_VALID_URL = r'https?://tv\.dfb\.de/video/(?P<display_id>[^/]+)/(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://tv.dfb.de/video/u-19-em-stimmen-zum-spiel-gegen-russland/11633/',
|
'url': 'http://tv.dfb.de/video/u-19-em-stimmen-zum-spiel-gegen-russland/11633/',
|
||||||
# The md5 is different each time
|
# The md5 is different each time
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '11633',
|
'id': '11633',
|
||||||
|
'display_id': 'u-19-em-stimmen-zum-spiel-gegen-russland',
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'title': 'U 19-EM: Stimmen zum Spiel gegen Russland',
|
'title': 'U 19-EM: Stimmen zum Spiel gegen Russland',
|
||||||
'upload_date': '20150714',
|
'upload_date': '20150714',
|
||||||
@ -23,22 +25,25 @@ class DFBIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
display_id = mobj.group('display_id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
player_info = self._download_xml(
|
player_info = self._download_xml(
|
||||||
'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id,
|
'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id,
|
||||||
video_id)
|
display_id)
|
||||||
video_info = player_info.find('video')
|
video_info = player_info.find('video')
|
||||||
|
|
||||||
f4m_info = self._download_xml(self._proto_relative_url(video_info.find('url').text.strip()), video_id)
|
f4m_info = self._download_xml(
|
||||||
|
self._proto_relative_url(video_info.find('url').text.strip()), display_id)
|
||||||
token_el = f4m_info.find('token')
|
token_el = f4m_info.find('token')
|
||||||
manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth'] + '&hdcore=3.2.0'
|
manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth'] + '&hdcore=3.2.0'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
'title': video_info.find('title').text,
|
'title': video_info.find('title').text,
|
||||||
'url': manifest_url,
|
'url': manifest_url,
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'upload_date': ''.join(video_info.find('time_date').text.split('.')[::-1]),
|
'upload_date': unified_strdate(video_info.find('time_date').text),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user