Compare commits

...

10 Commits

Author SHA1 Message Date
nixxo
5627e494f0
Merge 87c8703f90 into 4b5eec0aaa 2024-11-25 20:54:15 +05:30
Jakob Kruse
4b5eec0aaa
[ie/chaturbate] Fix support for non-public streams (#11624)
Fix bug in 720b3dc453

Closes #11623
Authored by: jkruse
2024-11-24 22:20:30 +00:00
nixxo
87c8703f90
Merge branch 'master' into valid-urls-proposal 2023-06-25 10:47:04 +02:00
nixxo
1c3a9489ca
Merge branch 'master' into valid-urls-proposal 2023-01-12 21:50:40 +01:00
nixxo
a73ef8c776
Improved documentation for _VALID_URL
Co-authored-by: dirkf <fieldhouse@gmx.net>
2023-01-12 21:40:41 +01:00
nixxo
518d585eb7
_VALID_URLS > _VALID_URL 2022-12-30 23:56:09 +01:00
nixxo
42d0fba2bf
Implemented solution suggested by @dirkf using variadic 2022-12-30 23:55:32 +01:00
nixxo
7b93fb5ddc
[extractor/rai] using new _VALID_URLS property
- implemented _VALID_URLS property
- deleted a couple of subclasses
- added '_old_archive_ids' to manage back-compatibility with removed subclasses (by @pukkandan)
2022-12-16 11:27:14 +01:00
nixxo
74b5d34794
[extractor/la7] testing implementation of new _VALID_URLS property 2022-12-16 11:26:39 +01:00
nixxo
db96683cf1
[core] _VALID_URLS implementation
- implemented _VALID_URLS extractor property
- improvement suggested by @Grub4k
2022-12-16 11:26:33 +01:00
4 changed files with 63 additions and 60 deletions

View File

@ -1659,10 +1659,8 @@ from .rai import (
RaiIE,
RaiNewsIE,
RaiPlayIE,
RaiPlayLiveIE,
RaiPlayPlaylistIE,
RaiPlaySoundIE,
RaiPlaySoundLiveIE,
RaiPlaySoundPlaylistIE,
RaiSudtirolIE,
)

View File

@ -59,16 +59,15 @@ class ChaturbateIE(InfoExtractor):
'Accept': 'application/json',
}, fatal=False, impersonate=True) or {}
status = response.get('room_status')
if status != 'public':
if error := self._ERROR_MAP.get(status):
raise ExtractorError(error, expected=True)
self.report_warning('Falling back to webpage extraction')
return None
m3u8_url = response.get('url')
if not m3u8_url:
self.raise_geo_restricted()
status = response.get('room_status')
if error := self._ERROR_MAP.get(status):
raise ExtractorError(error, expected=True)
if status == 'public':
self.raise_geo_restricted()
self.report_warning(f'Got status "{status}" from API; falling back to webpage extraction')
return None
return {
'id': video_id,

View File

@ -7,10 +7,11 @@ from ..utils import float_or_none, int_or_none, parse_duration, unified_strdate
class LA7IE(InfoExtractor):
IE_NAME = 'la7.it'
_VALID_URL = r'''(?x)https?://(?:
(?:www\.)?la7\.it/([^/]+)/(?:rivedila7|video|news)/|
tg\.la7\.it/repliche-tgla7\?id=
)(?P<id>.+)'''
_VALID_URL = [
r'https?://(?:www\.)?la7\.it/[^/]+/(?:rivedila7|video|news)/.+-(?P<id>\d{5,})',
r'https?://tg\.la7\.it/repliche-tgla7\?id=(?P<id>\d{5,})',
r'https?://tg\.la7\.it(?:/[^/]+)+-(?P<id>\d{5,})'
]
_TESTS = [{
# single quality video
@ -39,7 +40,7 @@ class LA7IE(InfoExtractor):
'formats': 'count:8',
},
}, {
'url': 'http://www.la7.it/omnibus/rivedila7/omnibus-news-02-07-2016-189077',
'url': 'https://tg.la7.it/repliche-tgla7?id=464601',
'only_matching': True,
}]
_HOST = 'https://awsvodpkg.iltrovatore.it'

View File

@ -10,6 +10,7 @@ from ..utils import (
filter_dict,
int_or_none,
join_nonempty,
make_archive_id,
parse_duration,
remove_start,
strip_or_none,
@ -250,7 +251,10 @@ class RaiBaseIE(InfoExtractor):
class RaiPlayIE(RaiBaseIE):
_VALID_URL = rf'(?P<base>https?://(?:www\.)?raiplay\.it/.+?-(?P<id>{RaiBaseIE._UUID_RE}))\.(?:html|json)'
_VALID_URL = [
rf'(?P<base>https?://(?:www\.)?raiplay\.it/.+?-(?P<id>{RaiBaseIE._UUID_RE}))\.(?:html|json)',
r'(?P<base>https?://(?:www\.)?raiplay\.it/dirette/(?P<id>[^/?#&]+))',
]
_TESTS = [{
'url': 'https://www.raiplay.it/video/2014/04/Report-del-07042014-cb27157f-9dd0-4aee-b788-b1f67643a391.html',
'md5': '8970abf8caf8aef4696e7b1f2adfc696',
@ -321,6 +325,25 @@ class RaiPlayIE(RaiBaseIE):
'timestamp': 1348495020,
'upload_date': '20120924',
},
}, {
# live stream
'url': 'https://www.raiplay.it/dirette/rainews24',
'info_dict': {
'id': 'd784ad40-e0ae-4a69-aa76-37519d238a9c',
'display_id': 'rainews24',
'ext': 'mp4',
'title': r're:^Diretta di Rai News 24 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
'description': 'md5:4d00bcf6dc98b27c6ec480de329d1497',
'uploader': 'Rai News 24',
'creator': 'Rai News 24',
'is_live': True,
'live_status': 'is_live',
'upload_date': '20090502',
'timestamp': 1241276220,
},
'params': {
'skip_download': True,
},
}, {
'url': 'http://www.raiplay.it/video/2016/11/gazebotraindesi-efebe701-969c-4593-92f3-285f0d1ce750.html?',
'only_matching': True,
@ -354,6 +377,7 @@ class RaiPlayIE(RaiBaseIE):
return {
'id': remove_start(media.get('id'), 'ContentItem-') or video_id,
'display_id': video_id,
'_old_archive_ids': [make_archive_id('RaiPlayLive', video_id)] if not re.match(RaiBaseIE._UUID_RE, video_id) else None,
'title': media.get('name'),
'alt_title': strip_or_none(alt_title or None),
'description': media.get('description'),
@ -377,28 +401,6 @@ class RaiPlayIE(RaiBaseIE):
}
class RaiPlayLiveIE(RaiPlayIE): # XXX: Do not subclass from concrete IE
_VALID_URL = r'(?P<base>https?://(?:www\.)?raiplay\.it/dirette/(?P<id>[^/?#&]+))'
_TESTS = [{
'url': 'http://www.raiplay.it/dirette/rainews24',
'info_dict': {
'id': 'd784ad40-e0ae-4a69-aa76-37519d238a9c',
'display_id': 'rainews24',
'ext': 'mp4',
'title': 're:^Diretta di Rai News 24 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
'description': 'md5:4d00bcf6dc98b27c6ec480de329d1497',
'uploader': 'Rai News 24',
'creator': 'Rai News 24',
'is_live': True,
'live_status': 'is_live',
'upload_date': '20090502',
'timestamp': 1241276220,
'formats': 'count:3',
},
'params': {'skip_download': True},
}]
class RaiPlayPlaylistIE(InfoExtractor):
_VALID_URL = r'(?P<base>https?://(?:www\.)?raiplay\.it/programmi/(?P<id>[^/?#&]+))(?:/(?P<extra_id>[^?#&]+))?'
_TESTS = [{
@ -463,7 +465,10 @@ class RaiPlayPlaylistIE(InfoExtractor):
class RaiPlaySoundIE(RaiBaseIE):
_VALID_URL = rf'(?P<base>https?://(?:www\.)?raiplaysound\.it/.+?-(?P<id>{RaiBaseIE._UUID_RE}))\.(?:html|json)'
_VALID_URL = [
rf'(?P<base>https?://(?:www\.)?raiplaysound\.it/.+?-(?P<id>{RaiBaseIE._UUID_RE}))\.(?:html|json)',
r'(?P<base>https?://(?:www\.)?raiplaysound\.it/(?P<id>[^/?#&]+)$)',
]
_TESTS = [{
'url': 'https://www.raiplaysound.it/audio/2021/12/IL-RUGGITO-DEL-CONIGLIO-1ebae2a7-7cdb-42bb-842e-fe0d193e9707.html',
'md5': '8970abf8caf8aef4696e7b1f2adfc696',
@ -482,7 +487,26 @@ class RaiPlaySoundIE(RaiBaseIE):
'timestamp': 1638346620,
'upload_date': '20211201',
},
'params': {'skip_download': True},
'params': {
'skip_download': True,
},
}, {
'url': 'https://www.raiplaysound.it/radio2',
'info_dict': {
'id': 'b00a50e6-f404-4af6-8f8c-ff3b9af73a44',
'display_id': 'radio2',
'ext': 'mp4',
'title': r're:Rai Radio 2 \d+-\d+-\d+ \d+:\d+',
'thumbnail': r're:https://www\.raiplaysound\.it/dl/img/.+png',
'uploader': 'rai radio 2',
'series': 'Rai Radio 2',
'creator': 'raiplaysound',
'is_live': True,
'live_status': 'is_live',
},
'params': {
'skip_download': 'live',
},
}]
def _real_extract(self, url):
@ -506,6 +530,7 @@ class RaiPlaySoundIE(RaiBaseIE):
**info,
'id': uid or audio_id,
'display_id': audio_id,
'_old_archive_ids': [make_archive_id('RaiPlaySoundLive', audio_id)] if not re.match(RaiBaseIE._UUID_RE, audio_id) else None,
'title': traverse_obj(media, 'title', 'episode_title'),
'alt_title': traverse_obj(media, ('track_info', 'media_name'), expected_type=strip_or_none),
'description': media.get('description'),
@ -521,26 +546,6 @@ class RaiPlaySoundIE(RaiBaseIE):
}
class RaiPlaySoundLiveIE(RaiPlaySoundIE): # XXX: Do not subclass from concrete IE
_VALID_URL = r'(?P<base>https?://(?:www\.)?raiplaysound\.it/(?P<id>[^/?#&]+)$)'
_TESTS = [{
'url': 'https://www.raiplaysound.it/radio2',
'info_dict': {
'id': 'b00a50e6-f404-4af6-8f8c-ff3b9af73a44',
'display_id': 'radio2',
'ext': 'mp4',
'title': r're:Rai Radio 2 \d+-\d+-\d+ \d+:\d+',
'thumbnail': r're:^https://www\.raiplaysound\.it/dl/img/.+\.png',
'uploader': 'rai radio 2',
'series': 'Rai Radio 2',
'creator': 'raiplaysound',
'is_live': True,
'live_status': 'is_live',
},
'params': {'skip_download': True},
}]
class RaiPlaySoundPlaylistIE(InfoExtractor):
_VALID_URL = r'(?P<base>https?://(?:www\.)?raiplaysound\.it/(?:programmi|playlist|audiolibri)/(?P<id>[^/?#&]+))(?:/(?P<extra_id>[^?#&]+))?'
_TESTS = [{