mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 01:31:25 +01:00
Compare commits
5 Commits
956db48b43
...
c46c351651
Author | SHA1 | Date | |
---|---|---|---|
|
c46c351651 | ||
|
b83ca24eb7 | ||
|
240a7d43c8 | ||
|
f13df591d4 | ||
|
e67441a1e4 |
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
|
@ -504,7 +504,8 @@ jobs:
|
||||||
- windows32
|
- windows32
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v4
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: artifact
|
path: artifact
|
||||||
pattern: build-bin-*
|
pattern: build-bin-*
|
||||||
|
|
17
.github/workflows/release-master.yml
vendored
17
.github/workflows/release-master.yml
vendored
|
@ -28,3 +28,20 @@ jobs:
|
||||||
actions: write # For cleaning up cache
|
actions: write # For cleaning up cache
|
||||||
id-token: write # mandatory for trusted publishing
|
id-token: write # mandatory for trusted publishing
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
publish_pypi:
|
||||||
|
needs: [release]
|
||||||
|
if: vars.MASTER_PYPI_PROJECT != ''
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write # mandatory for trusted publishing
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
name: build-pypi
|
||||||
|
- name: Publish to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
verbose: true
|
||||||
|
|
17
.github/workflows/release-nightly.yml
vendored
17
.github/workflows/release-nightly.yml
vendored
|
@ -41,3 +41,20 @@ jobs:
|
||||||
actions: write # For cleaning up cache
|
actions: write # For cleaning up cache
|
||||||
id-token: write # mandatory for trusted publishing
|
id-token: write # mandatory for trusted publishing
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
publish_pypi:
|
||||||
|
needs: [release]
|
||||||
|
if: vars.NIGHTLY_PYPI_PROJECT != ''
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write # mandatory for trusted publishing
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
name: build-pypi
|
||||||
|
- name: Publish to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
verbose: true
|
||||||
|
|
19
.github/workflows/release.yml
vendored
19
.github/workflows/release.yml
vendored
|
@ -2,10 +2,6 @@ name: Release
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
prerelease:
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: boolean
|
|
||||||
source:
|
source:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
@ -18,6 +14,10 @@ on:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
type: string
|
type: string
|
||||||
|
prerelease:
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
source:
|
source:
|
||||||
|
@ -278,11 +278,20 @@ jobs:
|
||||||
make clean-cache
|
make clean-cache
|
||||||
python -m build --no-isolation .
|
python -m build --no-isolation .
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
if: github.event_name != 'workflow_dispatch'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-pypi
|
||||||
|
path: |
|
||||||
|
dist/*
|
||||||
|
compression-level: 0
|
||||||
|
|
||||||
- name: Publish to PyPI
|
- name: Publish to PyPI
|
||||||
|
if: github.event_name == 'workflow_dispatch'
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
verbose: true
|
verbose: true
|
||||||
attestations: false # Currently doesn't work w/ reusable workflows (breaks nightly)
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: [prepare, build]
|
needs: [prepare, build]
|
||||||
|
|
|
@ -52,7 +52,7 @@ default = [
|
||||||
"pycryptodomex",
|
"pycryptodomex",
|
||||||
"requests>=2.32.2,<3",
|
"requests>=2.32.2,<3",
|
||||||
"urllib3>=1.26.17,<3",
|
"urllib3>=1.26.17,<3",
|
||||||
"websockets>=13.0",
|
"websockets>=13.0,<14",
|
||||||
]
|
]
|
||||||
curl-cffi = [
|
curl-cffi = [
|
||||||
"curl-cffi==0.5.10; os_name=='nt' and implementation_name=='cpython'",
|
"curl-cffi==0.5.10; os_name=='nt' and implementation_name=='cpython'",
|
||||||
|
|
|
@ -24,7 +24,7 @@ try:
|
||||||
from Crypto.Cipher import AES, PKCS1_OAEP, Blowfish, PKCS1_v1_5 # noqa: F401
|
from Crypto.Cipher import AES, PKCS1_OAEP, Blowfish, PKCS1_v1_5 # noqa: F401
|
||||||
from Crypto.Hash import CMAC, SHA1 # noqa: F401
|
from Crypto.Hash import CMAC, SHA1 # noqa: F401
|
||||||
from Crypto.PublicKey import RSA # noqa: F401
|
from Crypto.PublicKey import RSA # noqa: F401
|
||||||
except ImportError:
|
except (ImportError, OSError):
|
||||||
__version__ = f'broken {__version__}'.strip()
|
__version__ = f'broken {__version__}'.strip()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,96 +14,7 @@ from ..utils import (
|
||||||
class PlaySuisseIE(InfoExtractor):
|
class PlaySuisseIE(InfoExtractor):
|
||||||
_NETRC_MACHINE = 'playsuisse'
|
_NETRC_MACHINE = 'playsuisse'
|
||||||
_VALID_URL = r'https?://(?:www\.)?playsuisse\.ch/(?:watch|detail)/(?:[^#]*[?&]episodeId=)?(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://(?:www\.)?playsuisse\.ch/(?:watch|detail)/(?:[^#]*[?&]episodeId=)?(?P<id>[0-9]+)'
|
||||||
_TESTS = [
|
|
||||||
{
|
|
||||||
# Old URL
|
|
||||||
'url': 'https://www.playsuisse.ch/watch/763211/0',
|
|
||||||
'only_matching': True,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
# episode in a series
|
|
||||||
'url': 'https://www.playsuisse.ch/watch/763182?episodeId=763211',
|
|
||||||
'md5': '82df2a470b2dfa60c2d33772a8a60cf8',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '763211',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Knochen',
|
|
||||||
'description': 'md5:8ea7a8076ba000cd9e8bc132fd0afdd8',
|
|
||||||
'duration': 3344,
|
|
||||||
'series': 'Wilder',
|
|
||||||
'season': 'Season 1',
|
|
||||||
'season_number': 1,
|
|
||||||
'episode': 'Knochen',
|
|
||||||
'episode_number': 1,
|
|
||||||
'thumbnail': 're:https://playsuisse-img.akamaized.net/',
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
# film
|
|
||||||
'url': 'https://www.playsuisse.ch/watch/808675',
|
|
||||||
'md5': '818b94c1d2d7c4beef953f12cb8f3e75',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '808675',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Der Läufer',
|
|
||||||
'description': 'md5:9f61265c7e6dcc3e046137a792b275fd',
|
|
||||||
'duration': 5280,
|
|
||||||
'thumbnail': 're:https://playsuisse-img.akamaized.net/',
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
# series (treated as a playlist)
|
|
||||||
'url': 'https://www.playsuisse.ch/detail/1115687',
|
|
||||||
'info_dict': {
|
|
||||||
'description': 'md5:e4a2ae29a8895823045b5c3145a02aa3',
|
|
||||||
'id': '1115687',
|
|
||||||
'series': 'They all came out to Montreux',
|
|
||||||
'title': 'They all came out to Montreux',
|
|
||||||
},
|
|
||||||
'playlist': [{
|
|
||||||
'info_dict': {
|
|
||||||
'description': 'md5:f2462744834b959a31adc6292380cda2',
|
|
||||||
'duration': 3180,
|
|
||||||
'episode': 'Folge 1',
|
|
||||||
'episode_number': 1,
|
|
||||||
'id': '1112663',
|
|
||||||
'season': 'Season 1',
|
|
||||||
'season_number': 1,
|
|
||||||
'series': 'They all came out to Montreux',
|
|
||||||
'thumbnail': 're:https://playsuisse-img.akamaized.net/',
|
|
||||||
'title': 'Folge 1',
|
|
||||||
'ext': 'mp4',
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
'info_dict': {
|
|
||||||
'description': 'md5:9dfd308699fe850d3bce12dc1bad9b27',
|
|
||||||
'duration': 2935,
|
|
||||||
'episode': 'Folge 2',
|
|
||||||
'episode_number': 2,
|
|
||||||
'id': '1112661',
|
|
||||||
'season': 'Season 1',
|
|
||||||
'season_number': 1,
|
|
||||||
'series': 'They all came out to Montreux',
|
|
||||||
'thumbnail': 're:https://playsuisse-img.akamaized.net/',
|
|
||||||
'title': 'Folge 2',
|
|
||||||
'ext': 'mp4',
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
'info_dict': {
|
|
||||||
'description': 'md5:14a93a3356b2492a8f786ab2227ef602',
|
|
||||||
'duration': 2994,
|
|
||||||
'episode': 'Folge 3',
|
|
||||||
'episode_number': 3,
|
|
||||||
'id': '1112664',
|
|
||||||
'season': 'Season 1',
|
|
||||||
'season_number': 1,
|
|
||||||
'series': 'They all came out to Montreux',
|
|
||||||
'thumbnail': 're:https://playsuisse-img.akamaized.net/',
|
|
||||||
'title': 'Folge 3',
|
|
||||||
'ext': 'mp4',
|
|
||||||
},
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
_GRAPHQL_QUERY = '''
|
_GRAPHQL_QUERY = '''
|
||||||
query AssetWatch($assetId: ID!) {
|
query AssetWatch($assetId: ID!) {
|
||||||
assetV2(id: $assetId) {
|
assetV2(id: $assetId) {
|
||||||
|
@ -179,8 +90,6 @@ class PlaySuisseIE(InfoExtractor):
|
||||||
raise ExtractorError('Login failed')
|
raise ExtractorError('Login failed')
|
||||||
|
|
||||||
def _get_media_data(self, media_id):
|
def _get_media_data(self, media_id):
|
||||||
# NOTE In the web app, the "locale" header is used to switch between languages,
|
|
||||||
# However this doesn't seem to take effect when passing the header here.
|
|
||||||
response = self._download_json(
|
response = self._download_json(
|
||||||
'https://www.playsuisse.ch/api/graphql',
|
'https://www.playsuisse.ch/api/graphql',
|
||||||
media_id, data=json.dumps({
|
media_id, data=json.dumps({
|
||||||
|
@ -188,7 +97,7 @@ class PlaySuisseIE(InfoExtractor):
|
||||||
'query': self._GRAPHQL_QUERY,
|
'query': self._GRAPHQL_QUERY,
|
||||||
'variables': {'assetId': media_id},
|
'variables': {'assetId': media_id},
|
||||||
}).encode(),
|
}).encode(),
|
||||||
headers={'Content-Type': 'application/json', 'locale': 'de'})
|
headers={'Content-Type': 'application/json', 'locale': 'fr'})
|
||||||
|
|
||||||
return response['data']['assetV2']
|
return response['data']['assetV2']
|
||||||
|
|
||||||
|
@ -199,14 +108,25 @@ class PlaySuisseIE(InfoExtractor):
|
||||||
media_id = self._match_id(url)
|
media_id = self._match_id(url)
|
||||||
media_data = self._get_media_data(media_id)
|
media_data = self._get_media_data(media_id)
|
||||||
info = self._extract_single(media_data)
|
info = self._extract_single(media_data)
|
||||||
|
|
||||||
|
if info is None:
|
||||||
|
raise ExtractorError('Unable to extract media information')
|
||||||
|
|
||||||
if media_data.get('episodes'):
|
if media_data.get('episodes'):
|
||||||
info.update({
|
info.update({
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
'entries': map(self._extract_single, media_data['episodes']),
|
'entries': [
|
||||||
|
self._extract_single(episode)
|
||||||
|
for episode in media_data['episodes']
|
||||||
|
if self._extract_single(episode) is not None
|
||||||
|
],
|
||||||
})
|
})
|
||||||
return info
|
return info
|
||||||
|
|
||||||
def _extract_single(self, media_data):
|
def _extract_single(self, media_data):
|
||||||
|
if not media_data or 'id' not in media_data:
|
||||||
|
return None
|
||||||
|
|
||||||
thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail'))
|
thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail'))
|
||||||
|
|
||||||
formats, subtitles = [], {}
|
formats, subtitles = [], {}
|
||||||
|
@ -219,16 +139,24 @@ class PlaySuisseIE(InfoExtractor):
|
||||||
formats.extend(f)
|
formats.extend(f)
|
||||||
self._merge_subtitles(subs, target=subtitles)
|
self._merge_subtitles(subs, target=subtitles)
|
||||||
|
|
||||||
|
series_name = media_data.get('seriesName', '')
|
||||||
|
episode_name = media_data.get('name', '')
|
||||||
|
|
||||||
|
if series_name and episode_name:
|
||||||
|
title = f"{series_name} - {episode_name}"
|
||||||
|
else:
|
||||||
|
title = episode_name or series_name or 'Unknown Title'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': media_data['id'],
|
'id': media_data['id'],
|
||||||
'title': media_data.get('name'),
|
'title': title,
|
||||||
'description': media_data.get('description'),
|
'description': media_data.get('description'),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'duration': int_or_none(media_data.get('duration')),
|
'duration': int_or_none(media_data.get('duration')),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
'series': media_data.get('seriesName'),
|
'series': series_name,
|
||||||
'season_number': int_or_none(media_data.get('seasonNumber')),
|
'season_number': int_or_none(media_data.get('seasonNumber')),
|
||||||
'episode': media_data.get('name') if media_data.get('episodeNumber') else None,
|
'episode': episode_name if media_data.get('episodeNumber') else None,
|
||||||
'episode_number': int_or_none(media_data.get('episodeNumber')),
|
'episode_number': int_or_none(media_data.get('episodeNumber')),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user