mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 17:21:23 +01:00
Compare commits
8 Commits
28b75d4930
...
3f0932444c
Author | SHA1 | Date | |
---|---|---|---|
|
3f0932444c | ||
|
b83ca24eb7 | ||
|
240a7d43c8 | ||
|
f13df591d4 | ||
|
311dc3d438 | ||
|
620d721779 | ||
|
6d23661542 | ||
|
d816fb28dc |
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()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2084,6 +2084,10 @@ from .theplatform import (
|
||||||
from .thestar import TheStarIE
|
from .thestar import TheStarIE
|
||||||
from .thesun import TheSunIE
|
from .thesun import TheSunIE
|
||||||
from .theweatherchannel import TheWeatherChannelIE
|
from .theweatherchannel import TheWeatherChannelIE
|
||||||
|
from .thirtydaysinger import (
|
||||||
|
ThirtyDaySingerIE,
|
||||||
|
ThirtyDaySingerPlaylistIE
|
||||||
|
)
|
||||||
from .thisamericanlife import ThisAmericanLifeIE
|
from .thisamericanlife import ThisAmericanLifeIE
|
||||||
from .thisoldhouse import ThisOldHouseIE
|
from .thisoldhouse import ThisOldHouseIE
|
||||||
from .thisvid import (
|
from .thisvid import (
|
||||||
|
|
107
yt_dlp/extractor/thirtydaysinger.py
Normal file
107
yt_dlp/extractor/thirtydaysinger.py
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .wistia import WistiaBaseIE
|
||||||
|
from ..utils import (
|
||||||
|
clean_html,
|
||||||
|
get_elements_html_by_class
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ThirtyDaySingerBase(WistiaBaseIE):
|
||||||
|
_INDEX_EXTRACTION_RE = r'/tutorial/[\w-]+/(?P<index>[\w-]+)'
|
||||||
|
|
||||||
|
def _extract_for_url(self, url):
|
||||||
|
lesson_index = re.search(self._INDEX_EXTRACTION_RE, url).group('index')
|
||||||
|
webpage = self._download_webpage(url, lesson_index)
|
||||||
|
match = next(self._extract_wistia_async_embed(webpage))
|
||||||
|
embed_config = self._download_embed_config('medias', match.group('id'), url)
|
||||||
|
|
||||||
|
embed_infojson = self._extract_media(embed_config)
|
||||||
|
webpage_infojson = self._extract_webpage_data(webpage)
|
||||||
|
|
||||||
|
return {**embed_infojson, **webpage_infojson}
|
||||||
|
|
||||||
|
def _extract_webpage_data(self, webpage):
|
||||||
|
title = self._html_search_regex(r'<h1>([^<]+)</h1>', webpage, 'title')
|
||||||
|
fallback_title = self._html_extract_title(webpage)
|
||||||
|
description = self._html_search_meta('description', webpage, fatal=False)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'title': title or fallback_title,
|
||||||
|
'description': clean_html(self._format_html_list(description))
|
||||||
|
}
|
||||||
|
|
||||||
|
# The site makes extensive use of HTML lists for formatting and `clean_html`
|
||||||
|
# doesn't handle them well. This is needed to keep lists readable.
|
||||||
|
def _format_html_list(self, html):
|
||||||
|
replacements = {
|
||||||
|
'<ul>': '<br>',
|
||||||
|
'</ul': '<br>',
|
||||||
|
'<li>': '<br>- ',
|
||||||
|
'</li>': ''
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v in replacements.items():
|
||||||
|
html = html.replace(k, v)
|
||||||
|
|
||||||
|
return html
|
||||||
|
|
||||||
|
|
||||||
|
class ThirtyDaySingerIE(ThirtyDaySingerBase):
|
||||||
|
_VALID_URL = r'https?://www\.30daysinger\.com/tutorial/[\w-]+/[\w-]+'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.30daysinger.com/tutorial/30-day-beginner-course-with-jonathan-estabrooks/1',
|
||||||
|
'md5': '56bb11529b9777899b27b599d4b16cf6',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'tegd38l3d5',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'thumbnail': 'http://embed.wistia.com/deliveries/c26a85cb98e32efa8a5e12a0576e63355af66230.jpg',
|
||||||
|
'upload_date': '20190608',
|
||||||
|
'description': 'md5:d3291de8988be57b1d3e411126ba4d33',
|
||||||
|
'duration': 344.22,
|
||||||
|
'timestamp': 1559952526,
|
||||||
|
'title': 'Welcome to 30 Day Singer'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
return self._extract_for_url(url)
|
||||||
|
|
||||||
|
|
||||||
|
class ThirtyDaySingerPlaylistIE(ThirtyDaySingerBase):
|
||||||
|
_URI_BASE = 'https://www.30daysinger.com'
|
||||||
|
_VALID_URL = r'https?://www\.30daysinger\.com/tutorial/(?P<playlist_id>[\w-]+)/?(?:$|[#?])'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.30daysinger.com/tutorial/30-day-beginner-course-with-jonathan-estabrooks',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '30-day-beginner-course-with-jonathan-estabrooks',
|
||||||
|
'description': 'md5:8cf6d6c7c377895653c9cde9dfc4104f',
|
||||||
|
'title': '30 Day Beginner Course with Jonathan Estabrooks',
|
||||||
|
},
|
||||||
|
'playlist_count': 1,
|
||||||
|
'expected_warnings': ['This video is for premium members only']
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
playlist_id = self._match_valid_url(url).group('playlist_id')
|
||||||
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
playlist_attrs = self._extract_webpage_data(webpage)
|
||||||
|
|
||||||
|
entries = []
|
||||||
|
for html_element in get_elements_html_by_class('playlist-item-link', webpage):
|
||||||
|
href = self._search_regex(r'href="([^"]+)"', html_element, 'href')
|
||||||
|
|
||||||
|
if not href:
|
||||||
|
continue
|
||||||
|
# Often _some_ content is free so we should still download that but warn the user
|
||||||
|
# when we encounter premium content.
|
||||||
|
# NOTE: this only applies to the playlist extractor, not the single video extractor
|
||||||
|
if 'upgrade' in href:
|
||||||
|
self.report_warning('This video is for premium members only')
|
||||||
|
continue
|
||||||
|
|
||||||
|
entries.append(self._extract_for_url(self._URI_BASE + href))
|
||||||
|
|
||||||
|
return self.playlist_result(entries, playlist_id, playlist_attrs['title'], playlist_attrs['description'])
|
Loading…
Reference in New Issue
Block a user