Compare commits

...

10 Commits

Author SHA1 Message Date
dirkf
c7d4ce3821
Merge d2d6b49a5aec42b5b53a050ba18a4873b77dca40 into 4e714f9df1ed2cccd51df60d45ff5504abe827b7 2025-03-28 20:21:08 +00:00
dirkf
4e714f9df1 [Misc] Correct [_]IE_DESC/NAME in a few IEs
* thx seproDev, yt-dlp/yt-dlp/pull/12694/commits/ae69e3c
* also add documenting comment in `InfoExtractor`
2025-03-26 12:47:19 +00:00
dirkf
c1ea7f5a24 [ITV] Mark ITVX not working
* update old shim
* correct [_]IE_DESC
2025-03-26 12:17:49 +00:00
dirkf
d2d6b49a5a
Update youtube_dl/extractor/redtube.py 2023-07-22 15:36:08 +01:00
dirkf
af80da38ba
Make download test pass 2023-07-22 14:10:55 +01:00
dirkf
4d4aefdb9c
[RedTube] Update for 2023
* URLs need host://domain default
* use traverse_obj()
2023-07-21 19:32:02 +01:00
dirkf
78260bb23d
Merge branch 'ytdl-org:master' into df-rt-patch 2023-07-21 17:02:25 +01:00
df
1e490159e6 New test video to supplant test that became 'private' 2021-09-26 20:08:31 +01:00
df
d42b7b6c5e Restore coding style deprecated by @dstftw 2021-06-21 12:54:55 +01:00
dirkf
3e49222a74 Handle additional indirection in Redtube playlists
Fixes issue #29305
2021-06-21 12:54:55 +01:00
6 changed files with 77 additions and 53 deletions

View File

@ -32,7 +32,7 @@ class BokeCCBaseIE(InfoExtractor):
class BokeCCIE(BokeCCBaseIE):
_IE_DESC = 'CC视频'
IE_DESC = 'CC视频'
_VALID_URL = r'https?://union\.bokecc\.com/playvideo\.bo\?(?P<query>.*)'
_TESTS = [{

View File

@ -9,7 +9,7 @@ from ..utils import (
class CloudyIE(InfoExtractor):
_IE_DESC = 'cloudy.ec'
IE_DESC = 'cloudy.ec'
_VALID_URL = r'https?://(?:www\.)?cloudy\.ec/(?:v/|embed\.php\?.*?\bid=)(?P<id>[A-Za-z0-9]+)'
_TESTS = [{
'url': 'https://www.cloudy.ec/v/af511e2527aac',

View File

@ -422,6 +422,8 @@ class InfoExtractor(object):
_GEO_COUNTRIES = None
_GEO_IP_BLOCKS = None
_WORKING = True
# supply this in public subclasses: used in supported sites list, etc
# IE_DESC = 'short description of IE'
def __init__(self, downloader=None):
"""Constructor. Receives an optional downloader."""

View File

@ -35,15 +35,6 @@ from ..utils import (
class ITVBaseIE(InfoExtractor):
def _search_nextjs_data(self, webpage, video_id, **kw):
transform_source = kw.pop('transform_source', None)
fatal = kw.pop('fatal', True)
return self._parse_json(
self._search_regex(
r'''<script\b[^>]+\bid=('|")__NEXT_DATA__\1[^>]*>(?P<js>[^<]+)</script>''',
webpage, 'next.js data', group='js', fatal=fatal, **kw),
video_id, transform_source=transform_source, fatal=fatal)
def __handle_request_webpage_error(self, err, video_id=None, errnote=None, fatal=True):
if errnote is False:
return False
@ -109,7 +100,9 @@ class ITVBaseIE(InfoExtractor):
class ITVIE(ITVBaseIE):
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?:(?P<w>watch)|hub)/[^/]+/(?(w)[\w-]+/)(?P<id>\w+)'
_IE_DESC = 'ITVX'
IE_DESC = 'ITVX'
_WORKING = False
_TESTS = [{
'note': 'Hub URLs redirect to ITVX',
'url': 'https://www.itv.com/hub/liar/2a4547a0012',
@ -270,7 +263,7 @@ class ITVIE(ITVBaseIE):
'ext': determine_ext(href, 'vtt'),
})
next_data = self._search_nextjs_data(webpage, video_id, fatal=False, default='{}')
next_data = self._search_nextjs_data(webpage, video_id, fatal=False, default={})
video_data.update(traverse_obj(next_data, ('props', 'pageProps', ('title', 'episode')), expected_type=dict)[0] or {})
title = traverse_obj(video_data, 'headerTitle', 'episodeTitle')
info = self._og_extract(webpage, require_title=not title)
@ -323,7 +316,7 @@ class ITVIE(ITVBaseIE):
class ITVBTCCIE(ITVBaseIE):
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?!(?:watch|hub)/)(?:[^/]+/)+(?P<id>[^/?#&]+)'
_IE_DESC = 'ITV articles: News, British Touring Car Championship'
IE_DESC = 'ITV articles: News, British Touring Car Championship'
_TESTS = [{
'note': 'British Touring Car Championship',
'url': 'https://www.itv.com/btcc/articles/btcc-2018-all-the-action-from-brands-hatch',

View File

@ -1,33 +1,49 @@
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
determine_ext,
ExtractorError,
int_or_none,
join_nonempty,
merge_dicts,
str_to_int,
T,
traverse_obj,
unified_strdate,
url_or_none,
urljoin,
)
class RedTubeIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:\w+\.)?redtube\.com/|embed\.redtube\.com/\?.*?\bid=)(?P<id>[0-9]+)'
_EMBED_REGEX = [r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//embed\.redtube\.com/\?.*?\bid=\d+)']
_TESTS = [{
'url': 'http://www.redtube.com/66418',
'md5': 'fc08071233725f26b8f014dba9590005',
'url': 'https://www.redtube.com/38864951',
'md5': 'd7de9cb32e8adb3f6379f1a30f655fae',
'info_dict': {
'id': '66418',
'id': '38864951',
'ext': 'mp4',
'title': 'Sucked on a toilet',
'upload_date': '20110811',
'duration': 596,
'title': 'Public Sex on the Balcony in Freezing Paris! Amateur Couple LeoLulu',
'description': 'Watch video Public Sex on the Balcony in Freezing Paris! Amateur Couple LeoLulu on Redtube, home of free Blowjob porn videos and Blonde sex movies online. Video length: (10:46) - Uploaded by leolulu - Verified User - Starring Pornstar: LeoLulu',
'upload_date': '20210111',
'timestamp': 1610343109,
'duration': 646,
'view_count': int,
'age_limit': 18,
}
'thumbnail': r're:https://\wi-ph\.rdtcdn\.com/videos/.+/.+\.jpg',
},
'expected_warnings': [
'Failed to download m3u8 information: HTTP Error 404',
],
'params': {
'format': '[format_id !^= hls]',
},
}, {
'url': 'http://embed.redtube.com/?bgcolor=000000&id=1443286',
'only_matching': True,
@ -36,11 +52,11 @@ class RedTubeIE(InfoExtractor):
'only_matching': True,
}]
@staticmethod
def _extract_urls(webpage):
return re.findall(
r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//embed\.redtube\.com/\?.*?\bid=\d+)',
webpage)
@classmethod
def _extract_urls(cls, webpage):
for embed_re in cls._EMBED_REGEX:
for from_ in re.findall(embed_re, webpage):
yield from_
def _real_extract(self, url):
video_id = self._match_id(url)
@ -71,40 +87,53 @@ class RedTubeIE(InfoExtractor):
self._search_regex(
r'sources\s*:\s*({.+?})', webpage, 'source', default='{}'),
video_id, fatal=False)
if sources and isinstance(sources, dict):
for format_id, format_url in sources.items():
if format_url:
formats.append({
'url': format_url,
'format_id': format_id,
'height': int_or_none(format_id),
})
medias = self._parse_json(
self._search_regex(
r'mediaDefinition["\']?\s*:\s*(\[.+?}\s*\])', webpage,
'media definitions', default='{}'),
video_id, fatal=False)
if medias and isinstance(medias, list):
for media in medias:
format_url = url_or_none(media.get('videoUrl'))
def full_url(u):
return urljoin(url, u)
for fmt in traverse_obj(sources, (T(dict.items), {
'url': (1, T(full_url)),
'format_id': (2, T(compat_str)),
'height': (2, T(int_or_none)), })):
if 'url' in fmt:
formats.append(fmt)
medias = self._search_regex(
r'''mediaDefinitions?["']?\s*:\s*(\[[\s\S]+?}\s*\])''', webpage,
'media definitions', default='{}')
medias = self._parse_json(medias, video_id, fatal=False)
for fmt in traverse_obj(medias, (Ellipsis, T(dict))):
format_url = full_url(fmt.get('videoUrl'))
if not format_url:
continue
more_media = None
if fmt['format'] == 'hls' or (fmt['format'] == 'mp4' and not fmt.get('quality')):
more_media = self._download_json(format_url, video_id, fatal=False)
if more_media is None:
more_media = [fmt]
for fmt in traverse_obj(more_media, (Ellipsis, {
'url': ('videoUrl', T(full_url)),
'ext': ('format', T(compat_str)),
'format_id': ('quality', T(compat_str)), })):
format_url = fmt.get('url')
if not format_url:
continue
if media.get('format') == 'hls' or determine_ext(format_url) == 'm3u8':
if fmt.get('ext') == 'hls' or determine_ext(format_url) == 'm3u8':
formats.extend(self._extract_m3u8_formats(
format_url, video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id='hls',
fatal=False))
continue
format_id = media.get('quality')
formats.append({
'url': format_url,
'format_id': format_id,
'height': int_or_none(format_id),
})
fmt['height'] = int_or_none(fmt.get('format_id'))
fmt['format_id'] = join_nonempty('ext', 'format_id', from_dict=fmt)
formats.append(fmt)
if not formats:
video_url = self._html_search_regex(
r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL')
formats.append({'url': video_url})
video_url = url_or_none(self._html_search_regex(
r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL'))
if video_url:
formats.append({'url': video_url})
self._check_formats(formats, video_id)
self._sort_formats(formats)
thumbnail = self._og_search_thumbnail(webpage)

View File

@ -47,7 +47,7 @@ class SenateISVPIE(InfoExtractor):
['vetaff', '76462', 'http://vetaff-f.akamaihd.net'],
['arch', '', 'http://ussenate-f.akamaihd.net/']
]
_IE_NAME = 'senate.gov'
IE_NAME = 'senate.gov'
_VALID_URL = r'https?://(?:www\.)?senate\.gov/isvp/?\?(?P<qs>.+)'
_TESTS = [{
'url': 'http://www.senate.gov/isvp/?comm=judiciary&type=live&stt=&filename=judiciary031715&auto_play=false&wmode=transparent&poster=http%3A%2F%2Fwww.judiciary.senate.gov%2Fthemes%2Fjudiciary%2Fimages%2Fvideo-poster-flash-fit.png',