mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-06-06 04:52:41 +09:00
Compare commits
10 Commits
3f97435151
...
c7d4ce3821
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c7d4ce3821 | ||
![]() |
4e714f9df1 | ||
![]() |
c1ea7f5a24 | ||
![]() |
d2d6b49a5a | ||
![]() |
af80da38ba | ||
![]() |
4d4aefdb9c | ||
![]() |
78260bb23d | ||
![]() |
1e490159e6 | ||
![]() |
d42b7b6c5e | ||
![]() |
3e49222a74 |
@ -32,7 +32,7 @@ class BokeCCBaseIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class BokeCCIE(BokeCCBaseIE):
|
class BokeCCIE(BokeCCBaseIE):
|
||||||
_IE_DESC = 'CC视频'
|
IE_DESC = 'CC视频'
|
||||||
_VALID_URL = r'https?://union\.bokecc\.com/playvideo\.bo\?(?P<query>.*)'
|
_VALID_URL = r'https?://union\.bokecc\.com/playvideo\.bo\?(?P<query>.*)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
|
@ -9,7 +9,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class CloudyIE(InfoExtractor):
|
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]+)'
|
_VALID_URL = r'https?://(?:www\.)?cloudy\.ec/(?:v/|embed\.php\?.*?\bid=)(?P<id>[A-Za-z0-9]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.cloudy.ec/v/af511e2527aac',
|
'url': 'https://www.cloudy.ec/v/af511e2527aac',
|
||||||
|
@ -422,6 +422,8 @@ class InfoExtractor(object):
|
|||||||
_GEO_COUNTRIES = None
|
_GEO_COUNTRIES = None
|
||||||
_GEO_IP_BLOCKS = None
|
_GEO_IP_BLOCKS = None
|
||||||
_WORKING = True
|
_WORKING = True
|
||||||
|
# supply this in public subclasses: used in supported sites list, etc
|
||||||
|
# IE_DESC = 'short description of IE'
|
||||||
|
|
||||||
def __init__(self, downloader=None):
|
def __init__(self, downloader=None):
|
||||||
"""Constructor. Receives an optional downloader."""
|
"""Constructor. Receives an optional downloader."""
|
||||||
|
@ -35,15 +35,6 @@ from ..utils import (
|
|||||||
|
|
||||||
class ITVBaseIE(InfoExtractor):
|
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):
|
def __handle_request_webpage_error(self, err, video_id=None, errnote=None, fatal=True):
|
||||||
if errnote is False:
|
if errnote is False:
|
||||||
return False
|
return False
|
||||||
@ -109,7 +100,9 @@ class ITVBaseIE(InfoExtractor):
|
|||||||
|
|
||||||
class ITVIE(ITVBaseIE):
|
class ITVIE(ITVBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?:(?P<w>watch)|hub)/[^/]+/(?(w)[\w-]+/)(?P<id>\w+)'
|
_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 = [{
|
_TESTS = [{
|
||||||
'note': 'Hub URLs redirect to ITVX',
|
'note': 'Hub URLs redirect to ITVX',
|
||||||
'url': 'https://www.itv.com/hub/liar/2a4547a0012',
|
'url': 'https://www.itv.com/hub/liar/2a4547a0012',
|
||||||
@ -270,7 +263,7 @@ class ITVIE(ITVBaseIE):
|
|||||||
'ext': determine_ext(href, 'vtt'),
|
'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 {})
|
video_data.update(traverse_obj(next_data, ('props', 'pageProps', ('title', 'episode')), expected_type=dict)[0] or {})
|
||||||
title = traverse_obj(video_data, 'headerTitle', 'episodeTitle')
|
title = traverse_obj(video_data, 'headerTitle', 'episodeTitle')
|
||||||
info = self._og_extract(webpage, require_title=not title)
|
info = self._og_extract(webpage, require_title=not title)
|
||||||
@ -323,7 +316,7 @@ class ITVIE(ITVBaseIE):
|
|||||||
|
|
||||||
class ITVBTCCIE(ITVBaseIE):
|
class ITVBTCCIE(ITVBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?!(?:watch|hub)/)(?:[^/]+/)+(?P<id>[^/?#&]+)'
|
_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 = [{
|
_TESTS = [{
|
||||||
'note': 'British Touring Car Championship',
|
'note': 'British Touring Car Championship',
|
||||||
'url': 'https://www.itv.com/btcc/articles/btcc-2018-all-the-action-from-brands-hatch',
|
'url': 'https://www.itv.com/btcc/articles/btcc-2018-all-the-action-from-brands-hatch',
|
||||||
|
@ -1,33 +1,49 @@
|
|||||||
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
join_nonempty,
|
||||||
merge_dicts,
|
merge_dicts,
|
||||||
str_to_int,
|
str_to_int,
|
||||||
|
T,
|
||||||
|
traverse_obj,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
|
urljoin,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class RedTubeIE(InfoExtractor):
|
class RedTubeIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:(?:\w+\.)?redtube\.com/|embed\.redtube\.com/\?.*?\bid=)(?P<id>[0-9]+)'
|
_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 = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.redtube.com/66418',
|
'url': 'https://www.redtube.com/38864951',
|
||||||
'md5': 'fc08071233725f26b8f014dba9590005',
|
'md5': 'd7de9cb32e8adb3f6379f1a30f655fae',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '66418',
|
'id': '38864951',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Sucked on a toilet',
|
'title': 'Public Sex on the Balcony in Freezing Paris! Amateur Couple LeoLulu',
|
||||||
'upload_date': '20110811',
|
'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',
|
||||||
'duration': 596,
|
'upload_date': '20210111',
|
||||||
|
'timestamp': 1610343109,
|
||||||
|
'duration': 646,
|
||||||
'view_count': int,
|
'view_count': int,
|
||||||
'age_limit': 18,
|
'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',
|
'url': 'http://embed.redtube.com/?bgcolor=000000&id=1443286',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@ -36,11 +52,11 @@ class RedTubeIE(InfoExtractor):
|
|||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def _extract_urls(webpage):
|
def _extract_urls(cls, webpage):
|
||||||
return re.findall(
|
for embed_re in cls._EMBED_REGEX:
|
||||||
r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//embed\.redtube\.com/\?.*?\bid=\d+)',
|
for from_ in re.findall(embed_re, webpage):
|
||||||
webpage)
|
yield from_
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
@ -71,40 +87,53 @@ class RedTubeIE(InfoExtractor):
|
|||||||
self._search_regex(
|
self._search_regex(
|
||||||
r'sources\s*:\s*({.+?})', webpage, 'source', default='{}'),
|
r'sources\s*:\s*({.+?})', webpage, 'source', default='{}'),
|
||||||
video_id, fatal=False)
|
video_id, fatal=False)
|
||||||
if sources and isinstance(sources, dict):
|
|
||||||
for format_id, format_url in sources.items():
|
def full_url(u):
|
||||||
if format_url:
|
return urljoin(url, u)
|
||||||
formats.append({
|
|
||||||
'url': format_url,
|
for fmt in traverse_obj(sources, (T(dict.items), {
|
||||||
'format_id': format_id,
|
'url': (1, T(full_url)),
|
||||||
'height': int_or_none(format_id),
|
'format_id': (2, T(compat_str)),
|
||||||
})
|
'height': (2, T(int_or_none)), })):
|
||||||
medias = self._parse_json(
|
if 'url' in fmt:
|
||||||
self._search_regex(
|
formats.append(fmt)
|
||||||
r'mediaDefinition["\']?\s*:\s*(\[.+?}\s*\])', webpage,
|
|
||||||
'media definitions', default='{}'),
|
medias = self._search_regex(
|
||||||
video_id, fatal=False)
|
r'''mediaDefinitions?["']?\s*:\s*(\[[\s\S]+?}\s*\])''', webpage,
|
||||||
if medias and isinstance(medias, list):
|
'media definitions', default='{}')
|
||||||
for media in medias:
|
medias = self._parse_json(medias, video_id, fatal=False)
|
||||||
format_url = url_or_none(media.get('videoUrl'))
|
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:
|
if not format_url:
|
||||||
continue
|
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(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
format_url, video_id, 'mp4',
|
format_url, video_id, 'mp4',
|
||||||
entry_protocol='m3u8_native', m3u8_id='hls',
|
entry_protocol='m3u8_native', m3u8_id='hls',
|
||||||
fatal=False))
|
fatal=False))
|
||||||
continue
|
continue
|
||||||
format_id = media.get('quality')
|
fmt['height'] = int_or_none(fmt.get('format_id'))
|
||||||
formats.append({
|
fmt['format_id'] = join_nonempty('ext', 'format_id', from_dict=fmt)
|
||||||
'url': format_url,
|
formats.append(fmt)
|
||||||
'format_id': format_id,
|
|
||||||
'height': int_or_none(format_id),
|
|
||||||
})
|
|
||||||
if not formats:
|
if not formats:
|
||||||
video_url = self._html_search_regex(
|
video_url = url_or_none(self._html_search_regex(
|
||||||
r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL')
|
r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL'))
|
||||||
formats.append({'url': video_url})
|
if video_url:
|
||||||
|
formats.append({'url': video_url})
|
||||||
|
|
||||||
|
self._check_formats(formats, video_id)
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
@ -47,7 +47,7 @@ class SenateISVPIE(InfoExtractor):
|
|||||||
['vetaff', '76462', 'http://vetaff-f.akamaihd.net'],
|
['vetaff', '76462', 'http://vetaff-f.akamaihd.net'],
|
||||||
['arch', '', 'http://ussenate-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>.+)'
|
_VALID_URL = r'https?://(?:www\.)?senate\.gov/isvp/?\?(?P<qs>.+)'
|
||||||
_TESTS = [{
|
_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',
|
'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',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user