Compare commits

...

6 Commits

Author SHA1 Message Date
bashonly
22ea0688ed
[ci] Bump actions/setup-python to v6 (#14282)
Authored by: bashonly
2025-09-10 21:29:12 +00:00
bashonly
5c1abcdc49
[ie/tiktok:live] Fix room ID extraction (#14287)
Closes #9418
Authored by: bashonly
2025-09-10 21:26:27 +00:00
doe1080
3d9a88bd8e
[ie/pixivsketch] Remove extractors (#14196)
Authored by: doe1080
2025-09-10 21:22:10 +00:00
doe1080
9def9a4b0e
[ie/newspicks] Warn when only preview is available (#14197)
Closes #14137
Authored by: doe1080
2025-09-10 21:20:03 +00:00
bashonly
679587dac7
[ie/vimeo] Fix login error handling (#14280)
Closes #14279
Authored by: bashonly
2025-09-10 18:39:07 +00:00
Will Smillie
a1c98226a4
[ie/xhamster] Fix extractor (#14286)
Closes #14145
Authored by: nicolaasjan, willsmillie

Co-authored-by: nicolaasjan <14093220+nicolaasjan@users.noreply.github.com>
2025-09-10 18:17:24 +00:00
13 changed files with 44 additions and 150 deletions

View File

@ -131,7 +131,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for changelog
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install Requirements
@ -460,7 +460,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.arch }}

View File

@ -53,7 +53,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install test requirements

View File

@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.9
- name: Install test requirements
@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install test requirements

View File

@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install test requirements
@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install dev dependencies

View File

@ -79,7 +79,7 @@ jobs:
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.10" # Keep this in sync with test-workflows.yml
@ -173,7 +173,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.10"
@ -241,7 +241,7 @@ jobs:
path: artifact
pattern: build-*
merge-multiple: true
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.10"

View File

@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install test requirements

View File

@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.10" # Keep this in sync with release.yml's prepare job
- name: Install requirements

View File

@ -1523,10 +1523,6 @@ from .piramidetv import (
PiramideTVChannelIE,
PiramideTVIE,
)
from .pixivsketch import (
PixivSketchIE,
PixivSketchUserIE,
)
from .planetmarathi import PlanetMarathiIE
from .platzi import (
PlatziCourseIE,

View File

@ -50,7 +50,14 @@ class NewsPicksIE(InfoExtractor):
webpage = self._download_webpage(url, video_id)
fragment = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['fragment']
m3u8_url = traverse_obj(fragment, ('movie', 'movieUrl', {url_or_none}, {require('m3u8 URL')}))
movie = fragment['movie']
if traverse_obj(movie, ('viewable', {str})) == 'PARTIAL_FREE' and not traverse_obj(movie, ('canWatch', {bool})):
self.report_warning(
'Full video is for Premium members. Without cookies, '
f'only the preview is downloaded. {self._login_hint()}', video_id)
m3u8_url = traverse_obj(movie, ('movieUrl', {url_or_none}, {require('m3u8 URL')}))
formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4')
return {
@ -59,12 +66,12 @@ class NewsPicksIE(InfoExtractor):
'series': traverse_obj(fragment, ('series', 'title', {str})),
'series_id': series_id,
'subtitles': subtitles,
**traverse_obj(fragment, ('movie', {
**traverse_obj(movie, {
'title': ('title', {str}),
'cast': ('relatedUsers', ..., 'displayName', {str}, filter, all, filter),
'description': ('explanation', {clean_html}),
'release_timestamp': ('onAirStartDate', {parse_iso8601}),
'thumbnail': (('image', 'coverImageUrl'), {url_or_none}, any),
'timestamp': ('published', {parse_iso8601}),
})),
}),
}

View File

@ -1,119 +0,0 @@
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
traverse_obj,
unified_timestamp,
)
class PixivSketchBaseIE(InfoExtractor):
def _call_api(self, video_id, path, referer, note='Downloading JSON metadata'):
response = self._download_json(f'https://sketch.pixiv.net/api/{path}', video_id, note=note, headers={
'Referer': referer,
'X-Requested-With': referer,
})
errors = traverse_obj(response, ('errors', ..., 'message'))
if errors:
raise ExtractorError(' '.join(f'{e}.' for e in errors))
return response.get('data') or {}
class PixivSketchIE(PixivSketchBaseIE):
IE_NAME = 'pixiv:sketch'
_VALID_URL = r'https?://sketch\.pixiv\.net/@(?P<uploader_id>[a-zA-Z0-9_-]+)/lives/(?P<id>\d+)/?'
_TESTS = [{
'url': 'https://sketch.pixiv.net/@nuhutya/lives/3654620468641830507',
'info_dict': {
'id': '7370666691623196569',
'title': 'まにあえクリスマス!',
'uploader': 'ぬふちゃ',
'uploader_id': 'nuhutya',
'channel_id': '9844815',
'age_limit': 0,
'timestamp': 1640351536,
},
'skip': True,
}, {
# these two (age_limit > 0) requires you to login on website, but it's actually not required for download
'url': 'https://sketch.pixiv.net/@namahyou/lives/4393103321546851377',
'info_dict': {
'id': '4907995960957946943',
'title': 'クリスマスなんて知らん🖕',
'uploader': 'すゃもり',
'uploader_id': 'suya2mori2',
'channel_id': '31169300',
'age_limit': 15,
'timestamp': 1640347640,
},
'skip': True,
}, {
'url': 'https://sketch.pixiv.net/@8aki/lives/3553803162487249670',
'info_dict': {
'id': '1593420639479156945',
'title': 'おまけ本作業(リョナ有)',
'uploader': 'おぶい / Obui',
'uploader_id': 'oving',
'channel_id': '17606',
'age_limit': 18,
'timestamp': 1640330263,
},
'skip': True,
}]
def _real_extract(self, url):
video_id, uploader_id = self._match_valid_url(url).group('id', 'uploader_id')
data = self._call_api(video_id, f'lives/{video_id}.json', url)
if not traverse_obj(data, 'is_broadcasting'):
raise ExtractorError(f'This live is offline. Use https://sketch.pixiv.net/@{uploader_id} for ongoing live.', expected=True)
m3u8_url = traverse_obj(data, ('owner', 'hls_movie', 'url'))
formats = self._extract_m3u8_formats(
m3u8_url, video_id, ext='mp4',
entry_protocol='m3u8_native', m3u8_id='hls')
return {
'id': video_id,
'title': data.get('name'),
'formats': formats,
'uploader': traverse_obj(data, ('user', 'name'), ('owner', 'user', 'name')),
'uploader_id': traverse_obj(data, ('user', 'unique_name'), ('owner', 'user', 'unique_name')),
'channel_id': str(traverse_obj(data, ('user', 'pixiv_user_id'), ('owner', 'user', 'pixiv_user_id'))),
'age_limit': 18 if data.get('is_r18') else 15 if data.get('is_r15') else 0,
'timestamp': unified_timestamp(data.get('created_at')),
'is_live': True,
}
class PixivSketchUserIE(PixivSketchBaseIE):
IE_NAME = 'pixiv:sketch:user'
_VALID_URL = r'https?://sketch\.pixiv\.net/@(?P<id>[a-zA-Z0-9_-]+)/?'
_TESTS = [{
'url': 'https://sketch.pixiv.net/@nuhutya',
'only_matching': True,
}, {
'url': 'https://sketch.pixiv.net/@namahyou',
'only_matching': True,
}, {
'url': 'https://sketch.pixiv.net/@8aki',
'only_matching': True,
}]
@classmethod
def suitable(cls, url):
return super().suitable(url) and not PixivSketchIE.suitable(url)
def _real_extract(self, url):
user_id = self._match_id(url)
data = self._call_api(user_id, f'lives/users/@{user_id}.json', url)
if not traverse_obj(data, 'is_broadcasting'):
try:
self._call_api(user_id, 'users/current.json', url, 'Investigating reason for request failure')
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 401:
self.raise_login_required(f'Please log in, or use direct link like https://sketch.pixiv.net/@{user_id}/1234567890', method='cookies')
raise ExtractorError('This user is offline', expected=True)
return self.url_result(f'https://sketch.pixiv.net/@{user_id}/lives/{data["id"]}')

View File

@ -1518,19 +1518,22 @@ class TikTokLiveIE(TikTokBaseIE):
def _real_extract(self, url):
uploader, room_id = self._match_valid_url(url).group('uploader', 'id')
webpage = self._download_webpage(
url, uploader or room_id, headers={'User-Agent': 'Mozilla/5.0'}, fatal=not room_id)
if not room_id:
webpage = self._download_webpage(
format_field(uploader, None, self._UPLOADER_URL_FORMAT), uploader)
room_id = traverse_obj(
self._get_universal_data(webpage, uploader),
('webapp.user-detail', 'userInfo', 'user', 'roomId', {str}))
if webpage:
if not uploader or not room_id:
webpage = self._download_webpage(url, uploader or room_id, fatal=not room_id)
data = self._get_sigi_state(webpage, uploader or room_id)
room_id = (
traverse_obj(data, ((
('LiveRoom', 'liveRoomUserInfo', 'user'),
('UserModule', 'users', ...)), 'roomId', {str}, any))
or self._search_regex(r'snssdk\d*://live\?room_id=(\d+)', webpage, 'room ID', default=room_id))
uploader = uploader or traverse_obj(
data, ('LiveRoom', 'liveRoomUserInfo', 'user', 'uniqueId'),
('UserModule', 'users', ..., 'uniqueId'), get_all=False, expected_type=str)
room_id = room_id or traverse_obj(data, ((
('LiveRoom', 'liveRoomUserInfo', 'user'),
('UserModule', 'users', ...)), 'roomId', {str}, any))
uploader = uploader or traverse_obj(data, ((
('LiveRoom', 'liveRoomUserInfo', 'user'),
('UserModule', 'users', ...)), 'uniqueId', {str}, any))
if not room_id:
raise UserNotLive(video_id=uploader)

View File

@ -151,7 +151,7 @@ class VimeoBaseInfoExtractor(InfoExtractor):
'Referer': self._LOGIN_URL,
})
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status in (405, 418):
if isinstance(e.cause, HTTPError) and e.cause.status in (404, 405, 418):
raise ExtractorError(
'Unable to log in: bad username or password',
expected=True)

View File

@ -1,3 +1,4 @@
import base64
import itertools
import re
@ -12,6 +13,7 @@ from ..utils import (
int_or_none,
parse_duration,
str_or_none,
try_call,
try_get,
unified_strdate,
url_or_none,
@ -229,6 +231,11 @@ class XHamsterIE(InfoExtractor):
standard_url = standard_format.get(standard_format_key)
if not standard_url:
continue
decoded = try_call(lambda: base64.b64decode(standard_url))
if decoded and decoded[:4] == b'xor_':
standard_url = bytes(
a ^ b for a, b in
zip(decoded[4:], itertools.cycle(b'xh7999'))).decode()
standard_url = urljoin(url, standard_url)
if not standard_url or standard_url in format_urls:
continue