1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-12-02 18:42:54 +01:00

[gaskrank] Improve (closes #12493)

This commit is contained in:
Sergey M․ 2017-05-28 06:46:52 +07:00
parent 5a6d1da442
commit 7e688d2f6a
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -11,10 +11,8 @@ from ..utils import (
class GaskrankIE(InfoExtractor): class GaskrankIE(InfoExtractor):
"""InfoExtractor for gaskrank.tv""" _VALID_URL = r'https?://(?:www\.)?gaskrank\.tv/tv/(?P<categories>[^/]+)/(?P<id>[^/]+)\.htm'
_VALID_URL = r'https?://(?:www\.)?gaskrank\.tv/tv/(?P<categories>[^/]+)/(?P<id>[^/]+)\.html?' _TESTS = [{
_TESTS = [
{
'url': 'http://www.gaskrank.tv/tv/motorrad-fun/strike-einparken-durch-anfaenger-crash-mit-groesserem-flurschaden.htm', 'url': 'http://www.gaskrank.tv/tv/motorrad-fun/strike-einparken-durch-anfaenger-crash-mit-groesserem-flurschaden.htm',
'md5': '1ae88dbac97887d85ebd1157a95fc4f9', 'md5': '1ae88dbac97887d85ebd1157a95fc4f9',
'info_dict': { 'info_dict': {
@ -28,8 +26,7 @@ class GaskrankIE(InfoExtractor):
'upload_date': '20170110', 'upload_date': '20170110',
'uploader_url': None, 'uploader_url': None,
} }
}, }, {
{
'url': 'http://www.gaskrank.tv/tv/racing/isle-of-man-tt-2011-michael-du-15920.htm', 'url': 'http://www.gaskrank.tv/tv/racing/isle-of-man-tt-2011-michael-du-15920.htm',
'md5': 'c33ee32c711bc6c8224bfcbe62b23095', 'md5': 'c33ee32c711bc6c8224bfcbe62b23095',
'info_dict': { 'info_dict': {
@ -40,21 +37,22 @@ class GaskrankIE(InfoExtractor):
'categories': ['racing'], 'categories': ['racing'],
'display_id': 'isle-of-man-tt-2011-michael-du-15920', 'display_id': 'isle-of-man-tt-2011-michael-du-15920',
'uploader_id': 'IOM', 'uploader_id': 'IOM',
'upload_date': '20160506', 'upload_date': '20170523',
'uploader_url': 'www.iomtt.com', 'uploader_url': 'www.iomtt.com',
} }
} }]
]
def _real_extract(self, url): def _real_extract(self, url):
"""extract information from gaskrank.tv"""
display_id = self._match_id(url) display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, display_id)
categories = [re.match(self._VALID_URL, url).group('categories')]
title = self._og_search_title(webpage, default=None) or self._html_search_meta( title = self._og_search_title(
webpage, default=None) or self._html_search_meta(
'title', webpage, fatal=True) 'title', webpage, fatal=True)
categories = [re.match(self._VALID_URL, url).group('categories')]
mobj = re.search( mobj = re.search(
r'Video von:\s*(?P<uploader_id>[^|]*?)\s*\|\s*vom:\s*(?P<upload_date>[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][0-9][0-9])', r'Video von:\s*(?P<uploader_id>[^|]*?)\s*\|\s*vom:\s*(?P<upload_date>[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][0-9][0-9])',
webpage) webpage)
@ -83,7 +81,7 @@ class GaskrankIE(InfoExtractor):
video_id = self._search_regex( video_id = self._search_regex(
r'https?://movies\.gaskrank\.tv/([^-]*?)(-[^\.]*)?\.mp4', r'https?://movies\.gaskrank\.tv/([^-]*?)(-[^\.]*)?\.mp4',
webpage, 'video id') webpage, 'video id', default=display_id)
entry = self._parse_html5_media_entries(url, webpage, video_id)[0] entry = self._parse_html5_media_entries(url, webpage, video_id)[0]
entry.update({ entry.update({