mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-15 00:48:28 +00:00
Merge branch 'master' into build/python3-10
This commit is contained in:
commit
cb85c2a30f
4
.github/workflows/core.yml
vendored
4
.github/workflows/core.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
# CPython 3.10 is in quick-test
|
# CPython 3.10 is in quick-test
|
||||||
python-version: ['3.11', '3.12', '3.13', pypy-3.10, pypy-3.11]
|
python-version: ['3.11', '3.12', '3.13', pypy-3.11]
|
||||||
include:
|
include:
|
||||||
# atleast one of each CPython/PyPy tests must be in windows
|
# atleast one of each CPython/PyPy tests must be in windows
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
@ -49,7 +49,7 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: '3.13'
|
python-version: '3.13'
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: pypy-3.10
|
python-version: pypy-3.11
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
4
.github/workflows/download.yml
vendored
4
.github/workflows/download.yml
vendored
@ -28,13 +28,13 @@ jobs:
|
|||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
python-version: ['3.11', '3.12', '3.13', pypy-3.10]
|
python-version: ['3.11', '3.12', '3.13', pypy-3.11]
|
||||||
include:
|
include:
|
||||||
# atleast one of each CPython/PyPy tests must be in windows
|
# atleast one of each CPython/PyPy tests must be in windows
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: pypy-3.10
|
python-version: pypy-3.11
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
2
.github/workflows/signature-tests.yml
vendored
2
.github/workflows/signature-tests.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest]
|
os: [ubuntu-latest, windows-latest]
|
||||||
python-version: ['3.10', '3.11', '3.12', '3.13', pypy-3.10, pypy-3.11]
|
python-version: ['3.10', '3.11', '3.12', '3.13', pypy-3.11]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
@ -272,7 +272,7 @@ ## Adding support for a new site
|
|||||||
|
|
||||||
You can use `hatch fmt` to automatically fix problems. Rules that the linter/formatter enforces should not be disabled with `# noqa` unless a maintainer requests it. The only exception allowed is for old/printf-style string formatting in GraphQL query templates (use `# noqa: UP031`).
|
You can use `hatch fmt` to automatically fix problems. Rules that the linter/formatter enforces should not be disabled with `# noqa` unless a maintainer requests it. The only exception allowed is for old/printf-style string formatting in GraphQL query templates (use `# noqa: UP031`).
|
||||||
|
|
||||||
1. Make sure your code works under all [Python](https://www.python.org/) versions supported by yt-dlp, namely CPython >=3.10 and PyPy >=3.10. Backward compatibility is not required for even older versions of Python.
|
1. Make sure your code works under all [Python](https://www.python.org/) versions supported by yt-dlp, namely CPython >=3.10 and PyPy >=3.11. Backward compatibility is not required for even older versions of Python.
|
||||||
1. When the tests pass, [add](https://git-scm.com/docs/git-add) the new files, [commit](https://git-scm.com/docs/git-commit) them and [push](https://git-scm.com/docs/git-push) the result, like this:
|
1. When the tests pass, [add](https://git-scm.com/docs/git-add) the new files, [commit](https://git-scm.com/docs/git-commit) them and [push](https://git-scm.com/docs/git-push) the result, like this:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
@ -171,7 +171,7 @@ # To install nightly with pip:
|
|||||||
```
|
```
|
||||||
|
|
||||||
## DEPENDENCIES
|
## DEPENDENCIES
|
||||||
Python versions 3.10+ (CPython) and 3.10+ (PyPy) are supported. Other versions and implementations may or may not work correctly.
|
Python versions 3.10+ (CPython) and 3.11+ (PyPy) are supported. Other versions and implementations may or may not work correctly.
|
||||||
|
|
||||||
<!-- Python 3.5+ uses VC++14 and it is already embedded in the binary created
|
<!-- Python 3.5+ uses VC++14 and it is already embedded in the binary created
|
||||||
<!x-- https://www.microsoft.com/en-us/download/details.aspx?id=26999 --x>
|
<!x-- https://www.microsoft.com/en-us/download/details.aspx?id=26999 --x>
|
||||||
|
@ -1335,7 +1335,7 @@ def prepare_line(line):
|
|||||||
if len(cookie_list) != self._ENTRY_LEN:
|
if len(cookie_list) != self._ENTRY_LEN:
|
||||||
raise http.cookiejar.LoadError(f'invalid length {len(cookie_list)}')
|
raise http.cookiejar.LoadError(f'invalid length {len(cookie_list)}')
|
||||||
cookie = self._CookieFileEntry(*cookie_list)
|
cookie = self._CookieFileEntry(*cookie_list)
|
||||||
if cookie.expires_at and not cookie.expires_at.isdigit():
|
if cookie.expires_at and not re.fullmatch(r'[0-9]+(?:\.[0-9]+)?', cookie.expires_at):
|
||||||
raise http.cookiejar.LoadError(f'invalid expires at {cookie.expires_at}')
|
raise http.cookiejar.LoadError(f'invalid expires at {cookie.expires_at}')
|
||||||
return line
|
return line
|
||||||
|
|
||||||
|
@ -1781,6 +1781,7 @@
|
|||||||
RTVEALaCartaIE,
|
RTVEALaCartaIE,
|
||||||
RTVEAudioIE,
|
RTVEAudioIE,
|
||||||
RTVELiveIE,
|
RTVELiveIE,
|
||||||
|
RTVEProgramIE,
|
||||||
RTVETelevisionIE,
|
RTVETelevisionIE,
|
||||||
)
|
)
|
||||||
from .rtvs import RTVSIE
|
from .rtvs import RTVSIE
|
||||||
@ -2234,6 +2235,7 @@
|
|||||||
from .tvplayer import TVPlayerIE
|
from .tvplayer import TVPlayerIE
|
||||||
from .tvw import (
|
from .tvw import (
|
||||||
TvwIE,
|
TvwIE,
|
||||||
|
TvwNewsIE,
|
||||||
TvwTvChannelsIE,
|
TvwTvChannelsIE,
|
||||||
)
|
)
|
||||||
from .tweakers import TweakersIE
|
from .tweakers import TweakersIE
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
InAdvancePagedList,
|
||||||
clean_html,
|
clean_html,
|
||||||
determine_ext,
|
determine_ext,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
|
int_or_none,
|
||||||
make_archive_id,
|
make_archive_id,
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
qualities,
|
qualities,
|
||||||
@ -371,3 +373,62 @@ def _real_extract(self, url):
|
|||||||
raise ExtractorError('The webpage doesn\'t contain any video', expected=True)
|
raise ExtractorError('The webpage doesn\'t contain any video', expected=True)
|
||||||
|
|
||||||
return self.url_result(play_url, ie=RTVEALaCartaIE.ie_key())
|
return self.url_result(play_url, ie=RTVEALaCartaIE.ie_key())
|
||||||
|
|
||||||
|
|
||||||
|
class RTVEProgramIE(RTVEBaseIE):
|
||||||
|
IE_NAME = 'rtve.es:program'
|
||||||
|
IE_DESC = 'RTVE.es programs'
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?rtve\.es/play/videos/(?P<id>[\w-]+)/?(?:[?#]|$)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.rtve.es/play/videos/saber-vivir/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '111570',
|
||||||
|
'title': 'Saber vivir - Programa de ciencia y futuro en RTVE Play',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 400,
|
||||||
|
}]
|
||||||
|
_PAGE_SIZE = 60
|
||||||
|
|
||||||
|
def _fetch_page(self, program_id, page_num):
|
||||||
|
return self._download_json(
|
||||||
|
f'https://www.rtve.es/api/programas/{program_id}/videos',
|
||||||
|
program_id, note=f'Downloading page {page_num}',
|
||||||
|
query={
|
||||||
|
'type': 39816,
|
||||||
|
'page': page_num,
|
||||||
|
'size': 60,
|
||||||
|
})
|
||||||
|
|
||||||
|
def _entries(self, page_data):
|
||||||
|
for video in traverse_obj(page_data, ('page', 'items', lambda _, v: url_or_none(v['htmlUrl']))):
|
||||||
|
yield self.url_result(
|
||||||
|
video['htmlUrl'], RTVEALaCartaIE, url_transparent=True,
|
||||||
|
**traverse_obj(video, {
|
||||||
|
'id': ('id', {str}),
|
||||||
|
'title': ('longTitle', {str}),
|
||||||
|
'description': ('shortDescription', {str}),
|
||||||
|
'duration': ('duration', {float_or_none(scale=1000)}),
|
||||||
|
'series': (('programInfo', 'title'), {str}, any),
|
||||||
|
'season_number': ('temporadaOrden', {int_or_none}),
|
||||||
|
'season_id': ('temporadaId', {str}),
|
||||||
|
'season': ('temporada', {str}),
|
||||||
|
'episode_number': ('episode', {int_or_none}),
|
||||||
|
'episode': ('title', {str}),
|
||||||
|
'thumbnail': ('thumbnail', {url_or_none}),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
program_slug = self._match_id(url)
|
||||||
|
program_page = self._download_webpage(url, program_slug)
|
||||||
|
|
||||||
|
program_id = self._html_search_meta('DC.identifier', program_page, 'Program ID', fatal=True)
|
||||||
|
|
||||||
|
first_page = self._fetch_page(program_id, 1)
|
||||||
|
page_count = traverse_obj(first_page, ('page', 'totalPages', {int})) or 1
|
||||||
|
|
||||||
|
entries = InAdvancePagedList(
|
||||||
|
lambda idx: self._entries(self._fetch_page(program_id, idx + 1) if idx else first_page),
|
||||||
|
page_count, self._PAGE_SIZE)
|
||||||
|
|
||||||
|
return self.playlist_result(entries, program_id, self._html_extract_title(program_page))
|
||||||
|
@ -10,12 +10,15 @@
|
|||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
from ..utils.traversal import find_element, traverse_obj
|
from ..utils.traversal import find_element, find_elements, traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class TvwIE(InfoExtractor):
|
class TvwIE(InfoExtractor):
|
||||||
IE_NAME = 'tvw'
|
IE_NAME = 'tvw'
|
||||||
_VALID_URL = r'https?://(?:www\.)?tvw\.org/video/(?P<id>[^/?#]+)'
|
_VALID_URL = [
|
||||||
|
r'https?://(?:www\.)?tvw\.org/video/(?P<id>[^/?#]+)',
|
||||||
|
r'https?://(?:www\.)?tvw\.org/watch/?\?(?:[^#]+&)?eventID=(?P<id>\d+)',
|
||||||
|
]
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://tvw.org/video/billy-frank-jr-statue-maquette-unveiling-ceremony-2024011211/',
|
'url': 'https://tvw.org/video/billy-frank-jr-statue-maquette-unveiling-ceremony-2024011211/',
|
||||||
'md5': '9ceb94fe2bb7fd726f74f16356825703',
|
'md5': '9ceb94fe2bb7fd726f74f16356825703',
|
||||||
@ -75,6 +78,20 @@ class TvwIE(InfoExtractor):
|
|||||||
'display_id': 'washington-to-washington-a-new-space-race-2022041111',
|
'display_id': 'washington-to-washington-a-new-space-race-2022041111',
|
||||||
'categories': ['Washington to Washington', 'General Interest'],
|
'categories': ['Washington to Washington', 'General Interest'],
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://tvw.org/watch?eventID=2025041235',
|
||||||
|
'md5': '7d697c02f110b37d6a47622ea608ca90',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '2025041235',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Legislative Review - Medicaid Postpartum Bill Sparks Debate & Senate Approves Automatic Voter Registration',
|
||||||
|
'thumbnail': r're:^https?://.*\.(?:jpe?g|png)$',
|
||||||
|
'description': 'md5:37d0f3a9187ae520aac261b3959eaee6',
|
||||||
|
'timestamp': 1745006400,
|
||||||
|
'upload_date': '20250418',
|
||||||
|
'location': 'Hayner Media Center',
|
||||||
|
'categories': ['Legislative Review'],
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -125,6 +142,41 @@ def _real_extract(self, url):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TvwNewsIE(InfoExtractor):
|
||||||
|
IE_NAME = 'tvw:news'
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?tvw\.org/\d{4}/\d{2}/(?P<id>[^/?#]+)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://tvw.org/2024/01/the-impact-issues-to-watch-in-the-2024-legislative-session/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'the-impact-issues-to-watch-in-the-2024-legislative-session',
|
||||||
|
'title': 'The Impact - Issues to Watch in the 2024 Legislative Session',
|
||||||
|
'description': 'md5:65f0b33ec8f18ff1cd401c5547aa5441',
|
||||||
|
},
|
||||||
|
'playlist_count': 6,
|
||||||
|
}, {
|
||||||
|
'url': 'https://tvw.org/2024/06/the-impact-water-rights-and-the-skookumchuck-dam-debate/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'the-impact-water-rights-and-the-skookumchuck-dam-debate',
|
||||||
|
'title': 'The Impact - Water Rights and the Skookumchuck Dam Debate',
|
||||||
|
'description': 'md5:185f3a2350ef81e3fa159ac3e040a94b',
|
||||||
|
},
|
||||||
|
'playlist_count': 1,
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
playlist_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
|
||||||
|
video_ids = traverse_obj(webpage, (
|
||||||
|
{find_elements(cls='invintus-player', html=True)}, ..., {extract_attributes}, 'data-eventid'))
|
||||||
|
|
||||||
|
return self.playlist_from_matches(
|
||||||
|
video_ids, playlist_id,
|
||||||
|
playlist_title=remove_end(self._og_search_title(webpage, default=None), ' - TVW'),
|
||||||
|
playlist_description=self._og_search_description(webpage, default=None),
|
||||||
|
getter=lambda x: f'https://tvw.org/watch?eventID={x}', ie=TvwIE)
|
||||||
|
|
||||||
|
|
||||||
class TvwTvChannelsIE(InfoExtractor):
|
class TvwTvChannelsIE(InfoExtractor):
|
||||||
IE_NAME = 'tvw:tvchannels'
|
IE_NAME = 'tvw:tvchannels'
|
||||||
_VALID_URL = r'https?://(?:www\.)?tvw\.org/tvchannels/(?P<id>[^/?#]+)'
|
_VALID_URL = r'https?://(?:www\.)?tvw\.org/tvchannels/(?P<id>[^/?#]+)'
|
||||||
|
Loading…
Reference in New Issue
Block a user