mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 01:31:25 +01:00
Compare commits
5 Commits
c51be3737a
...
e2f51b743f
Author | SHA1 | Date | |
---|---|---|---|
|
e2f51b743f | ||
|
b83ca24eb7 | ||
|
240a7d43c8 | ||
|
f13df591d4 | ||
|
4910f25bcd |
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()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
remove_end,
|
remove_end,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
|
@ -10,16 +11,16 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class GoProIE(InfoExtractor):
|
class GoProIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(www\.)?gopro\.com/v/(?P<id>[A-Za-z0-9]+)'
|
_VALID_URL = r'https?://(www\.)?gopro\.com/v(/(?P<plid>[A-Za-z0-9]+))?(/(?P<id>[A-Za-z0-9]+))?'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://gopro.com/v/ZNVvED8QDzR5V',
|
'url': 'https://gopro.com/v/ZNVvED8QDzR5V',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'ZNVvED8QDzR5V',
|
'id': 'LvV9MVbapDqKy',
|
||||||
'title': 'My GoPro Adventure - 9/19/21',
|
'title': 'My GoPro Adventure - 9/19/21',
|
||||||
'thumbnail': r're:https?://.+',
|
'thumbnail': r're:https?://.+',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'timestamp': 1632072947,
|
'timestamp': 1632070674,
|
||||||
'upload_date': '20210919',
|
'upload_date': '20210919',
|
||||||
'uploader_id': 'fireydive30018',
|
'uploader_id': 'fireydive30018',
|
||||||
'duration': 396062,
|
'duration': 396062,
|
||||||
|
@ -27,11 +28,25 @@ class GoProIE(InfoExtractor):
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://gopro.com/v/KRm6Vgp2peg4e',
|
'url': 'https://gopro.com/v/KRm6Vgp2peg4e',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'KRm6Vgp2peg4e',
|
'id': '0rl3J2y2l5N3v',
|
||||||
'title': 'じゃがいも カリカリ オーブン焼き',
|
'title': 'じゃがいも カリカリ オーブン焼き',
|
||||||
'thumbnail': r're:https?://.+',
|
'thumbnail': r're:https?://.+',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'timestamp': 1607231125,
|
'timestamp': 1607231111,
|
||||||
|
'upload_date': '20201206',
|
||||||
|
'uploader_id': 'dc9bcb8b-47d2-47c6-afbc-4c48f9a3769e',
|
||||||
|
'duration': 45187,
|
||||||
|
'track': 'The Sky Machine',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://gopro.com/v/KRm6Vgp2peg4e/0rl3J2y2l5N3v',
|
||||||
|
'note': 'Same video as above, but full link (playlist+video)',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '0rl3J2y2l5N3v',
|
||||||
|
'title': 'じゃがいも カリカリ オーブン焼き',
|
||||||
|
'thumbnail': r're:https?://.+',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'timestamp': 1607231111,
|
||||||
'upload_date': '20201206',
|
'upload_date': '20201206',
|
||||||
'uploader_id': 'dc9bcb8b-47d2-47c6-afbc-4c48f9a3769e',
|
'uploader_id': 'dc9bcb8b-47d2-47c6-afbc-4c48f9a3769e',
|
||||||
'duration': 45187,
|
'duration': 45187,
|
||||||
|
@ -40,29 +55,49 @@ class GoProIE(InfoExtractor):
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://gopro.com/v/kVrK9wlJvBMwn',
|
'url': 'https://gopro.com/v/kVrK9wlJvBMwn',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'kVrK9wlJvBMwn',
|
'id': 'pJzDM128KQ8wG',
|
||||||
'title': 'DARKNESS',
|
'title': 'DARKNESS (DARKNESS)',
|
||||||
'thumbnail': r're:https?://.+',
|
'thumbnail': r're:https?://.+',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'timestamp': 1594183735,
|
'timestamp': 1594181304,
|
||||||
'upload_date': '20200708',
|
'upload_date': '20200708',
|
||||||
'uploader_id': '闇夜乃皇帝',
|
'uploader_id': '闇夜乃皇帝',
|
||||||
'duration': 313075,
|
'duration': 313075,
|
||||||
'track': 'Battery (Live)',
|
'track': 'Battery (Live)',
|
||||||
'artist': 'Metallica',
|
'artists': ['Metallica'],
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
playlist_id = self._match_valid_url(url).group('plid')
|
||||||
|
if playlist_id is None and video_id is None:
|
||||||
|
raise ExtractorError('Invalid URL: neither video ID nor playlist ID is present')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id or playlist_id)
|
||||||
metadata = self._search_json(
|
metadata = self._search_json(
|
||||||
r'window\.__reflectData\s*=', webpage, 'metadata', video_id)
|
r'window\.__reflectData\s*=', webpage, 'metadata', video_id or playlist_id)
|
||||||
|
collection_title = str_or_none(
|
||||||
|
try_get(metadata, lambda x: x['collection']['title'])
|
||||||
|
or self._html_search_meta(['og:title', 'twitter:title'], webpage)
|
||||||
|
or remove_end(self._html_search_regex(
|
||||||
|
r'<title[^>]*>([^<]+)</title>', webpage, 'title', fatal=False), ' | GoPro'))
|
||||||
|
if collection_title:
|
||||||
|
collection_title = collection_title.replace('\n', ' ')
|
||||||
|
entries = []
|
||||||
|
for video_info in metadata['collectionMedia']:
|
||||||
|
# If video_id is none, downloading the whole playlist.
|
||||||
|
if video_id is None or video_id == video_info['id']:
|
||||||
|
entries.append(self.ExtractOneEntry(webpage, metadata, collection_title, video_info))
|
||||||
|
if not entries:
|
||||||
|
raise ExtractorError(f'{url}: No videos found')
|
||||||
|
return self.playlist_result(entries, playlist_id=playlist_id,
|
||||||
|
playlist_title=collection_title)
|
||||||
|
|
||||||
video_info = metadata['collectionMedia'][0]
|
def ExtractOneEntry(self, webpage, metadata, collection_title, video_info):
|
||||||
|
video_id = video_info['id']
|
||||||
media_data = self._download_json(
|
media_data = self._download_json(
|
||||||
'https://api.gopro.com/media/{}/download'.format(video_info['id']), video_id)
|
f'https://api.gopro.com/media/{video_id}/download', video_id)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for fmt in try_get(media_data, lambda x: x['_embedded']['variations']) or []:
|
for fmt in try_get(media_data, lambda x: x['_embedded']['variations']) or []:
|
||||||
|
@ -78,13 +113,14 @@ class GoProIE(InfoExtractor):
|
||||||
'height': int_or_none(fmt.get('height')),
|
'height': int_or_none(fmt.get('height')),
|
||||||
})
|
})
|
||||||
|
|
||||||
title = str_or_none(
|
title = collection_title
|
||||||
try_get(metadata, lambda x: x['collection']['title'])
|
content_title = video_info.get('content_title')
|
||||||
or self._html_search_meta(['og:title', 'twitter:title'], webpage)
|
if content_title:
|
||||||
or remove_end(self._html_search_regex(
|
content_title = content_title.replace('\n', ' ')
|
||||||
r'<title[^>]*>([^<]+)</title>', webpage, 'title', fatal=False), ' | GoPro'))
|
|
||||||
if title:
|
if title:
|
||||||
title = title.replace('\n', ' ')
|
title += f' ({content_title})'
|
||||||
|
else:
|
||||||
|
title = content_title
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
@ -93,7 +129,8 @@ class GoProIE(InfoExtractor):
|
||||||
'thumbnail': url_or_none(
|
'thumbnail': url_or_none(
|
||||||
self._html_search_meta(['og:image', 'twitter:image'], webpage)),
|
self._html_search_meta(['og:image', 'twitter:image'], webpage)),
|
||||||
'timestamp': unified_timestamp(
|
'timestamp': unified_timestamp(
|
||||||
try_get(metadata, lambda x: x['collection']['created_at'])),
|
video_info.get('created_at')
|
||||||
|
or try_get(metadata, lambda x: x['collection']['created_at'])),
|
||||||
'uploader_id': str_or_none(
|
'uploader_id': str_or_none(
|
||||||
try_get(metadata, lambda x: x['account']['nickname'])),
|
try_get(metadata, lambda x: x['account']['nickname'])),
|
||||||
'duration': int_or_none(
|
'duration': int_or_none(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user