mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 01:31:25 +01:00
Compare commits
25 Commits
545c1608d1
...
b09107f402
Author | SHA1 | Date | |
---|---|---|---|
|
b09107f402 | ||
|
b83ca24eb7 | ||
|
240a7d43c8 | ||
|
f13df591d4 | ||
|
3302588c77 | ||
|
163533ee17 | ||
|
88ac2d3915 | ||
|
eb0cfc7420 | ||
|
0a8b675da9 | ||
|
5143f916f3 | ||
|
8f0d32fa83 | ||
|
8e01382707 | ||
|
94f85add47 | ||
|
18b4296aa3 | ||
|
6ef07d4ec9 | ||
|
821ac9c0b8 | ||
|
4916a77720 | ||
|
c22e4bd29f | ||
|
6a04a4aaec | ||
|
1bd55358a0 | ||
|
6542c5124c | ||
|
f1ed988c5f | ||
|
6be151fed7 | ||
|
4f58aabe67 | ||
|
fcff2c5cd0 |
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()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -443,7 +443,9 @@ class FacebookIE(InfoExtractor):
|
||||||
try:
|
try:
|
||||||
login_results = self._download_webpage(request, None,
|
login_results = self._download_webpage(request, None,
|
||||||
note='Logging in', errnote='unable to fetch login page')
|
note='Logging in', errnote='unable to fetch login page')
|
||||||
if re.search(r'<form(.*)name="login"(.*)</form>', login_results) is not None:
|
if 'Your Request Couldn' in login_results:
|
||||||
|
self.raise_login_required('Failed to login with credentials', method='cookies')
|
||||||
|
elif re.search(r'<form[^>]*name="login"[^<]*</form>', login_results):
|
||||||
error = self._html_search_regex(
|
error = self._html_search_regex(
|
||||||
r'(?s)<div[^>]+class=(["\']).*?login_error_box.*?\1[^>]*><div[^>]*>.*?</div><div[^>]*>(?P<error>.+?)</div>',
|
r'(?s)<div[^>]+class=(["\']).*?login_error_box.*?\1[^>]*><div[^>]*>.*?</div><div[^>]*>(?P<error>.+?)</div>',
|
||||||
login_results, 'login error', default=None, group='error')
|
login_results, 'login error', default=None, group='error')
|
||||||
|
@ -476,13 +478,41 @@ class FacebookIE(InfoExtractor):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _extract_from_url(self, url, video_id):
|
def _extract_from_url(self, url, video_id):
|
||||||
|
cookies = self._get_cookies(url)
|
||||||
|
# user passed logged-in cookies or attempted to login
|
||||||
|
login_data = cookies.get('c_user') and cookies.get('xs')
|
||||||
|
logged_in = False
|
||||||
|
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
|
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
|
||||||
|
|
||||||
def extract_metadata(webpage):
|
sjs_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
|
||||||
post_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
|
|
||||||
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
|
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
|
||||||
post = traverse_obj(post_data, (
|
|
||||||
|
if login_data:
|
||||||
|
logged_in = get_first(sjs_data, (
|
||||||
|
'require', ..., ..., ..., '__bbox', 'define',
|
||||||
|
lambda _, v: 'CurrentUserInitialData' in v, ..., 'ACCOUNT_ID'), default='0') != '0'
|
||||||
|
if logged_in and (info := get_first(sjs_data, ('require', ..., ..., ..., '__bbox', 'require', ..., ..., ...,
|
||||||
|
'__bbox', 'result', 'data', (('ufac_client', 'state',
|
||||||
|
(('set_contact_point_state_renderer', 'title'),
|
||||||
|
('intro_state_renderer', 'header_title'))),
|
||||||
|
('epsilon_checkpoint', 'screen', 'title'))))):
|
||||||
|
if any(content in info for content in ['days left to appeal', 'suspended your account']):
|
||||||
|
raise ExtractorError('Your account is suspended', expected=True)
|
||||||
|
if 'Enter mobile number' == info:
|
||||||
|
raise ExtractorError('Facebook is requiring mobile number confirmation', expected=True)
|
||||||
|
if 'your account has been locked' in info:
|
||||||
|
raise ExtractorError('Your account has been locked', expected=True)
|
||||||
|
|
||||||
|
if props := get_first(sjs_data, (
|
||||||
|
'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., 'rootView',
|
||||||
|
lambda _, v: v['title'].startswith('This content isn\'t available'))):
|
||||||
|
raise ExtractorError(
|
||||||
|
f'Content unavailable. Facebook said: {props.get("body") or props["title"]}', expected=True)
|
||||||
|
|
||||||
|
def extract_metadata(webpage):
|
||||||
|
post = traverse_obj(sjs_data, (
|
||||||
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
|
..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
|
||||||
media = traverse_obj(post, (..., 'attachments', ..., lambda k, v: (
|
media = traverse_obj(post, (..., 'attachments', ..., lambda k, v: (
|
||||||
k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict)
|
k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict)
|
||||||
|
@ -810,6 +840,10 @@ class FacebookIE(InfoExtractor):
|
||||||
video_data = extract_from_jsmods_instances(tahoe_js_data)
|
video_data = extract_from_jsmods_instances(tahoe_js_data)
|
||||||
|
|
||||||
if not video_data:
|
if not video_data:
|
||||||
|
if not login_data:
|
||||||
|
raise ExtractorError('Cannot parse data. Try logging in.', expected=True)
|
||||||
|
if not logged_in:
|
||||||
|
raise ExtractorError('Failed to login with provided data.', expected=True)
|
||||||
raise ExtractorError('Cannot parse data')
|
raise ExtractorError('Cannot parse data')
|
||||||
|
|
||||||
if len(video_data) > 1:
|
if len(video_data) > 1:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user