1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 16:45:17 +00:00

[extractors] Use new framework for existing embeds (#4307)

`Brightcove` is difficult to migrate because it's subclasses may depend
on the signature of the current functions. So it is left as-is for now

Note: Tests have not been migrated
This commit is contained in:
pukkandan
2022-08-01 06:53:25 +05:30
parent 1e8fe57e5c
commit bfd973ece3
138 changed files with 499 additions and 1909 deletions

View File

@ -1,5 +1,3 @@
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
@ -47,6 +45,12 @@ class VideomoreIE(InfoExtractor):
(?P<id>\d+)
(?:[/?#&]|\.(?:xml|json)|$)
'''
_EMBED_REGEX = [r'''(?x)
(?:
<iframe[^>]+src=([\'"])|
<object[^>]+data=(["\'])https?://videomore\.ru/player\.swf\?.*config=
)(?P<url>https?://videomore\.ru/[^?#"']+/\d+(?:\.xml)?)
''']
_TESTS = [{
'url': 'http://videomore.ru/kino_v_detalayah/5_sezon/367617',
'md5': '44455a346edc0d509ac5b5a5b531dc35',
@ -126,19 +130,6 @@ class VideomoreIE(InfoExtractor):
}]
_GEO_BYPASS = False
@staticmethod
def _extract_url(webpage):
mobj = re.search(
r'<object[^>]+data=(["\'])https?://videomore\.ru/player\.swf\?.*config=(?P<url>https?://videomore\.ru/(?:[^/]+/)+\d+\.xml).*\1',
webpage)
if not mobj:
mobj = re.search(
r'<iframe[^>]+src=([\'"])(?P<url>https?://videomore\.ru/embed/\d+)',
webpage)
if mobj:
return mobj.group('url')
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('sid') or mobj.group('id')