Compare commits

...

2 Commits

Author SHA1 Message Date
sepro
6d92f87ddc
[ie/cda] Support mobile URLs (#15398)
Closes #15397
Authored by: seproDev
2025-12-25 02:25:03 +01:00
sepro
9bf040dc6f
[utils] random_user_agent: Bump versions (#15396)
Authored by: seproDev
2025-12-24 21:47:50 +01:00
2 changed files with 32 additions and 29 deletions

View File

@ -27,7 +27,7 @@ from ..utils.traversal import traverse_obj
class CDAIE(InfoExtractor): class CDAIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www\.)?cda\.pl/video|ebd\.cda\.pl/[0-9]+x[0-9]+)/(?P<id>[0-9a-z]+)' _VALID_URL = r'https?://(?:(?:(?:www|m)\.)?cda\.pl/video|ebd\.cda\.pl/[0-9]+x[0-9]+)/(?P<id>[0-9a-z]+)'
_NETRC_MACHINE = 'cdapl' _NETRC_MACHINE = 'cdapl'
_BASE_URL = 'https://www.cda.pl' _BASE_URL = 'https://www.cda.pl'
@ -110,6 +110,9 @@ class CDAIE(InfoExtractor):
}, { }, {
'url': 'http://ebd.cda.pl/0x0/5749950c', 'url': 'http://ebd.cda.pl/0x0/5749950c',
'only_matching': True, 'only_matching': True,
}, {
'url': 'https://m.cda.pl/video/617297677',
'only_matching': True,
}] }]
def _download_age_confirm_page(self, url, video_id, *args, **kwargs): def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
@ -367,35 +370,35 @@ class CDAIE(InfoExtractor):
class CDAFolderIE(InfoExtractor): class CDAFolderIE(InfoExtractor):
_MAX_PAGE_SIZE = 36 _MAX_PAGE_SIZE = 36
_VALID_URL = r'https?://(?:www\.)?cda\.pl/(?P<channel>[\w-]+)/folder/(?P<id>\d+)' _VALID_URL = r'https?://(?:(?:www|m)\.)?cda\.pl/(?P<channel>[\w-]+)/folder/(?P<id>\d+)'
_TESTS = [ _TESTS = [{
{ 'url': 'https://www.cda.pl/domino264/folder/31188385',
'url': 'https://www.cda.pl/domino264/folder/31188385', 'info_dict': {
'info_dict': { 'id': '31188385',
'id': '31188385', 'title': 'SERIA DRUGA',
'title': 'SERIA DRUGA',
},
'playlist_mincount': 13,
}, },
{ 'playlist_mincount': 13,
'url': 'https://www.cda.pl/smiechawaTV/folder/2664592/vfilm', }, {
'info_dict': { 'url': 'https://www.cda.pl/smiechawaTV/folder/2664592/vfilm',
'id': '2664592', 'info_dict': {
'title': 'VideoDowcipy - wszystkie odcinki', 'id': '2664592',
}, 'title': 'VideoDowcipy - wszystkie odcinki',
'playlist_mincount': 71,
}, },
{ 'playlist_mincount': 71,
'url': 'https://www.cda.pl/DeliciousBeauty/folder/19129979/vfilm', }, {
'info_dict': { 'url': 'https://www.cda.pl/DeliciousBeauty/folder/19129979/vfilm',
'id': '19129979', 'info_dict': {
'title': 'TESTY KOSMETYKÓW', 'id': '19129979',
}, 'title': 'TESTY KOSMETYKÓW',
'playlist_mincount': 139, },
}, { 'playlist_mincount': 139,
'url': 'https://www.cda.pl/FILMY-SERIALE-ANIME-KRESKOWKI-BAJKI/folder/18493422', }, {
'only_matching': True, 'url': 'https://www.cda.pl/FILMY-SERIALE-ANIME-KRESKOWKI-BAJKI/folder/18493422',
}] 'only_matching': True,
}, {
'url': 'https://m.cda.pl/smiechawaTV/folder/2664592/vfilm',
'only_matching': True,
}]
def _real_extract(self, url): def _real_extract(self, url):
folder_id, channel = self._match_valid_url(url).group('id', 'channel') folder_id, channel = self._match_valid_url(url).group('id', 'channel')

View File

@ -17,7 +17,7 @@ from .traversal import traverse_obj
def random_user_agent(): def random_user_agent():
USER_AGENT_TMPL = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{} Safari/537.36' USER_AGENT_TMPL = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{} Safari/537.36'
# Target versions released within the last ~6 months # Target versions released within the last ~6 months
CHROME_MAJOR_VERSION_RANGE = (134, 140) CHROME_MAJOR_VERSION_RANGE = (137, 143)
return USER_AGENT_TMPL.format(f'{random.randint(*CHROME_MAJOR_VERSION_RANGE)}.0.0.0') return USER_AGENT_TMPL.format(f'{random.randint(*CHROME_MAJOR_VERSION_RANGE)}.0.0.0')