Compare commits

...

4 Commits

Author SHA1 Message Date
pukkandan
f0500bd1e4
[test] Fix FakeYDL signatures
Authored by: coletdjnz
2022-06-21 13:03:29 +05:30
pukkandan
95032f302c
[f4m] Bugfix 2022-06-21 13:03:29 +05:30
pukkandan
8102a5991b
[extractor/mediaset] Improve _VALID_URL 2022-06-21 13:03:28 +05:30
HobbyistDev
c27eaf8920
[extractor/kicker.de] Add extractor (#4073)
Closes #3670
Authored by: HobbyistDev
2022-06-21 00:30:43 -07:00
9 changed files with 85 additions and 17 deletions

View File

@ -44,7 +44,7 @@ def try_rm(filename):
raise
def report_warning(message):
def report_warning(message, *args, **kwargs):
'''
Print the message to stderr, it will be prefixed with 'WARNING:'
If stderr is a tty file the 'WARNING:' will be colored
@ -67,10 +67,10 @@ class FakeYDL(YoutubeDL):
super().__init__(params, auto_init=False)
self.result = []
def to_screen(self, s, skip_eol=None):
def to_screen(self, s, *args, **kwargs):
print(s)
def trouble(self, s, tb=None):
def trouble(self, s, *args, **kwargs):
raise Exception(s)
def download(self, x):
@ -80,10 +80,10 @@ class FakeYDL(YoutubeDL):
# Silence an expected warning matching a regex
old_report_warning = self.report_warning
def report_warning(self, message):
def report_warning(self, message, *args, **kwargs):
if re.match(regex, message):
return
old_report_warning(message)
old_report_warning(message, *args, **kwargs)
self.report_warning = types.MethodType(report_warning, self)
@ -301,9 +301,9 @@ def assertEqual(self, got, expected, msg=None):
def expect_warnings(ydl, warnings_re):
real_warning = ydl.report_warning
def _report_warning(w):
def _report_warning(w, *args, **kwargs):
if not any(re.search(w_re, w) for w_re in warnings_re):
real_warning(w)
real_warning(w, *args, **kwargs)
ydl.report_warning = _report_warning

View File

@ -40,7 +40,7 @@ class YDL(FakeYDL):
def process_info(self, info_dict):
self.downloaded_info_dicts.append(info_dict.copy())
def to_screen(self, msg):
def to_screen(self, msg, *args, **kwargs):
self.msgs.append(msg)
def dl(self, *args, **kwargs):

View File

@ -14,16 +14,16 @@ from yt_dlp.cookies import (
class Logger:
def debug(self, message):
def debug(self, message, *args, **kwargs):
print(f'[verbose] {message}')
def info(self, message):
def info(self, message, *args, **kwargs):
print(message)
def warning(self, message, only_once=False):
def warning(self, message, *args, **kwargs):
self.error(message)
def error(self, message):
def error(self, message, *args, **kwargs):
raise Exception(message)

View File

@ -43,7 +43,7 @@ class YoutubeDL(yt_dlp.YoutubeDL):
self.processed_info_dicts = []
super().__init__(*args, **kwargs)
def report_warning(self, message):
def report_warning(self, message, *args, **kwargs):
# Don't accept warnings during tests
raise ExtractorError(message)

View File

@ -391,9 +391,10 @@ class F4mFD(FragmentFD):
query.append(info_dict['extra_param_to_segment_url'])
url_parsed = base_url_parsed._replace(path=base_url_parsed.path + name, query='&'.join(query))
try:
success, down_data = self._download_fragment(ctx, url_parsed.geturl(), info_dict)
success = self._download_fragment(ctx, url_parsed.geturl(), info_dict)
if not success:
return False
down_data = self._read_fragment(ctx)
reader = FlvReader(down_data)
while True:
try:

View File

@ -747,6 +747,7 @@ from .khanacademy import (
KhanAcademyIE,
KhanAcademyUnitIE,
)
from .kicker import KickerIE
from .kickstarter import KickStarterIE
from .kinja import KinjaEmbedIE
from .kinopoisk import KinoPoiskIE

View File

@ -24,7 +24,7 @@ class BellMediaIE(InfoExtractor):
)/.*?(?:\b(?:vid(?:eoid)?|clipId)=|-vid|~|%7E|/(?:episode)?)(?P<id>[0-9]{6,})'''
_TESTS = [{
'url': 'https://www.bnnbloomberg.ca/video/david-cockfield-s-top-picks~1403070',
'md5': '36d3ef559cfe8af8efe15922cd3ce950',
'md5': '3e5b8e38370741d5089da79161646635',
'info_dict': {
'id': '1403070',
'ext': 'flv',
@ -32,6 +32,14 @@ class BellMediaIE(InfoExtractor):
'description': 'md5:810f7f8c6a83ad5b48677c3f8e5bb2c3',
'upload_date': '20180525',
'timestamp': 1527288600,
'season_id': 73997,
'season': '2018',
'thumbnail': 'http://images2.9c9media.com/image_asset/2018_5_25_baf30cbd-b28d-4a18-9903-4bb8713b00f5_PNG_956x536.jpg',
'tags': [],
'categories': ['ETFs'],
'season_number': 8,
'duration': 272.038,
'series': 'Market Call Tonight',
},
}, {
'url': 'http://www.thecomedynetwork.ca/video/player?vid=923582',

View File

@ -0,0 +1,55 @@
from .common import InfoExtractor
from .dailymotion import DailymotionIE
class KickerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)kicker\.(?:de)/(?P<id>[\w-]+)/video'
_TESTS = [{
'url': 'https://www.kicker.de/pogba-dembel-co-die-top-11-der-abloesefreien-spieler-905049/video',
'info_dict': {
'id': 'km04mrK0DrRAVxy2GcA',
'title': 'md5:b91d145bac5745ac58d5479d8347a875',
'ext': 'mp4',
'duration': 350,
'description': 'md5:a5a3dd77dbb6550dbfb997be100b9998',
'uploader_id': 'x2dfupo',
'timestamp': 1654677626,
'like_count': int,
'uploader': 'kicker.de',
'view_count': int,
'age_limit': 0,
'thumbnail': r're:https://s\d+\.dmcdn\.net/v/T-x741YeYAx8aSZ0Z/x1080',
'tags': ['published', 'category.InternationalSoccer'],
'upload_date': '20220608'
}
}, {
'url': 'https://www.kicker.de/ex-unioner-in-der-bezirksliga-felix-kroos-vereinschallenge-in-pankow-902825/video',
'info_dict': {
'id': 'k2omNsJKdZ3TxwxYSFJ',
'title': 'md5:72ec24d7f84b8436fe1e89d198152adf',
'ext': 'mp4',
'uploader_id': 'x2dfupo',
'duration': 331,
'timestamp': 1652966015,
'thumbnail': r're:https?://s\d+\.dmcdn\.net/v/TxU4Z1YYCmtisTbMq/x1080',
'tags': ['FELIX KROOS', 'EINFACH MAL LUPPEN', 'KROOS', 'FSV FORTUNA PANKOW', 'published', 'category.Amateurs', 'marketingpreset.Spreekick'],
'age_limit': 0,
'view_count': int,
'upload_date': '20220519',
'uploader': 'kicker.de',
'description': 'md5:0c2060c899a91c8bf40f578f78c5846f',
'like_count': int,
}
}]
def _real_extract(self, url):
video_slug = self._match_id(url)
webpage = self._download_webpage(url, video_slug)
dailymotion_video_id = self._search_regex(
r'data-dmprivateid\s*=\s*[\'"](?P<video_id>\w+)', webpage,
'video id', group='video_id')
return self.url_result(
f'https://www.dailymotion.com/video/{dailymotion_video_id}',
ie=DailymotionIE, video_title=self._html_extract_title(webpage))

View File

@ -20,7 +20,7 @@ class MediasetIE(ThePlatformBaseIE):
(?:
mediaset:|
https?://
(?:(?:www|static3)\.)?mediasetplay\.mediaset\.it/
(?:\w+\.)+mediaset\.it/
(?:
(?:video|on-demand|movie)/(?:[^/]+/)+[^/]+_|
player/index\.html\?.*?\bprogramGuid=
@ -159,6 +159,9 @@ class MediasetIE(ThePlatformBaseIE):
}, {
'url': 'https://www.mediasetplay.mediaset.it/movie/herculeslaleggendahainizio/hercules-la-leggenda-ha-inizio_F305927501000102',
'only_matching': True,
}, {
'url': 'https://mediasetinfinity.mediaset.it/video/braveandbeautiful/episodio-113_F310948005000402',
'only_matching': True,
}]
@staticmethod
@ -286,7 +289,7 @@ class MediasetShowIE(MediasetIE):
_VALID_URL = r'''(?x)
(?:
https?://
(?:(?:www|static3)\.)?mediasetplay\.mediaset\.it/
(\w+\.)+mediaset\.it/
(?:
(?:fiction|programmi-tv|serie-tv|kids)/(?:.+?/)?
(?:[a-z-]+)_SE(?P<id>\d{12})