Compare commits

...

25 Commits

Author SHA1 Message Date
ringus1
b09107f402
Merge 3302588c77 into b83ca24eb7 2024-11-10 14:42:04 +01:00
sepro
b83ca24eb7
[core] Catch broken Cryptodome installations (#11486)
Authored by: seproDev
2024-11-10 00:53:49 +01:00
bashonly
240a7d43c8
[build] Pin websockets version to >=13.0,<14 (#11488)
websockets 14.0 causes CI test failures (a lot more of them)

Authored by: bashonly
2024-11-09 23:46:47 +00:00
bashonly
f13df591d4
[build] Enable attestations for trusted publishing (#11420)
Reverts 428ffb75aa

Authored by: bashonly
2024-11-09 23:26:02 +00:00
bashonly
3302588c77
Merge branch 'yt-dlp:master' into pr/fb_parsedata_error 2024-02-15 17:02:42 -06:00
ringus1
163533ee17 PR changes 2024-02-13 12:03:07 +01:00
ringus1
88ac2d3915 Flake fix 2024-02-05 11:46:58 +01:00
ringus1
eb0cfc7420 Raising error only if video parsing fails 2024-02-05 11:45:23 +01:00
ringus1
0a8b675da9 Move getting cookies before making first request 2024-02-01 09:56:34 +01:00
ringus1
5143f916f3 PR fixes - clear up messages 2024-02-01 08:14:23 +01:00
ringus1
8f0d32fa83 Simplify login error check 2024-01-31 17:04:09 +01:00
ringus1
8e01382707 Fix props getter 2024-01-31 16:54:26 +01:00
ringus1
94f85add47 Merge branch 'fb_parsedata_error' of https://github.com/ringus1/yt-dlp into fb_parsedata_error 2024-01-31 16:38:20 +01:00
ringus1
18b4296aa3 MR fixes 2024-01-31 16:38:02 +01:00
bashonly
6ef07d4ec9
Merge branch 'master' into fb_parsedata_error 2024-01-31 08:53:05 -06:00
ringus1
821ac9c0b8 More messages for account suspension 2024-01-24 21:52:46 +01:00
ringus1
4916a77720 Add one more case when account is locked 2024-01-24 12:22:09 +01:00
ringus1
c22e4bd29f Fix double quotes 2024-01-15 13:05:53 +01:00
ringus1
6a04a4aaec Detect mobile number checkpoint 2024-01-15 10:43:10 +01:00
ringus1
1bd55358a0 Flake fix 2024-01-12 15:04:27 +01:00
ringus1
6542c5124c Formatting 2024-01-12 14:48:46 +01:00
ringus1
f1ed988c5f One more exception handling 2024-01-11 17:01:20 +01:00
ringus1
6be151fed7 Handle removed content 2024-01-11 16:02:41 +01:00
ringus1
4f58aabe67 Add better login handling 2024-01-11 14:39:52 +01:00
ringus1
fcff2c5cd0 Adding potential fix 2024-01-10 16:11:45 +01:00
7 changed files with 90 additions and 12 deletions

View File

@ -504,7 +504,8 @@ jobs:
- windows32
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifact
pattern: build-bin-*

View File

@ -28,3 +28,20 @@ jobs:
actions: write # For cleaning up cache
id-token: write # mandatory for trusted publishing
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

View File

@ -41,3 +41,20 @@ jobs:
actions: write # For cleaning up cache
id-token: write # mandatory for trusted publishing
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

View File

@ -2,10 +2,6 @@ name: Release
on:
workflow_call:
inputs:
prerelease:
required: false
default: true
type: boolean
source:
required: false
default: ''
@ -18,6 +14,10 @@ on:
required: false
default: ''
type: string
prerelease:
required: false
default: true
type: boolean
workflow_dispatch:
inputs:
source:
@ -278,11 +278,20 @@ jobs:
make clean-cache
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
if: github.event_name == 'workflow_dispatch'
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
attestations: false # Currently doesn't work w/ reusable workflows (breaks nightly)
publish:
needs: [prepare, build]

View File

@ -52,7 +52,7 @@ default = [
"pycryptodomex",
"requests>=2.32.2,<3",
"urllib3>=1.26.17,<3",
"websockets>=13.0",
"websockets>=13.0,<14",
]
curl-cffi = [
"curl-cffi==0.5.10; os_name=='nt' and implementation_name=='cpython'",

View File

@ -24,7 +24,7 @@ try:
from Crypto.Cipher import AES, PKCS1_OAEP, Blowfish, PKCS1_v1_5 # noqa: F401
from Crypto.Hash import CMAC, SHA1 # noqa: F401
from Crypto.PublicKey import RSA # noqa: F401
except ImportError:
except (ImportError, OSError):
__version__ = f'broken {__version__}'.strip()

View File

@ -443,7 +443,9 @@ class FacebookIE(InfoExtractor):
try:
login_results = self._download_webpage(request, None,
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(
r'(?s)<div[^>]+class=(["\']).*?login_error_box.*?\1[^>]*><div[^>]*>.*?</div><div[^>]*>(?P<error>.+?)</div>',
login_results, 'login error', default=None, group='error')
@ -476,13 +478,41 @@ class FacebookIE(InfoExtractor):
return
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(
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
def extract_metadata(webpage):
post_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
sjs_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
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 []
media = traverse_obj(post, (..., 'attachments', ..., lambda k, v: (
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)
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')
if len(video_data) > 1: