Compare commits

...

5 Commits

Author SHA1 Message Date
Dong Heon Hee
c9eb8c307c
Merge f2767e2ce0 into b83ca24eb7 2024-11-10 14:42:03 +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
hui1601
f2767e2ce0
[ie/CHZZK] Support download channel videos 2024-02-14 23:31:29 +09:00
8 changed files with 138 additions and 8 deletions

View File

@ -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-*

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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'",

View File

@ -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()

View File

@ -376,6 +376,7 @@ from .chaturbate import ChaturbateIE
from .chilloutzone import ChilloutzoneIE from .chilloutzone import ChilloutzoneIE
from .chzzk import ( from .chzzk import (
CHZZKLiveIE, CHZZKLiveIE,
CHZZKChannelIE,
CHZZKVideoIE, CHZZKVideoIE,
) )
from .cinemax import CinemaxIE from .cinemax import CinemaxIE

View File

@ -85,6 +85,91 @@ class CHZZKLiveIE(InfoExtractor):
} }
def _make_vod_result(data):
assert isinstance(data, dict)
if not data.get('videoId'):
return
return {
'_type': 'url_transparent',
'id': data.get('videoId'),
'title': data.get('videoTitle'),
'url': f'https://chzzk.naver.com/video/{data.get("videoNo")}',
'thumbnail': data.get('thumbnailImageUrl'),
'timestamp': data.get('publishDateAt'),
'view_count': data.get('readCount'),
'duration': data.get('duration'),
'age_limit': 19 if data.get('adult') else 0,
'was_live': True if data.get('videoType') == 'REPLAY' else False,
}
class CHZZKChannelIE(InfoExtractor):
IE_NAME = 'chzzk:channel'
_VALID_URL = r'https?://chzzk\.naver\.com/(?P<id>[\da-f]{32})'
_TESTS = [{
'note': 'Both video and replay included',
'url': 'https://chzzk.naver.com/68f895c59a1043bc5019b5e08c83a5c5',
'info_dict': {
'id': '68f895c59a1043bc5019b5e08c83a5c5',
'channel_id': '68f895c59a1043bc5019b5e08c83a5c5',
'description': '나는 머찐 라디유 나는 머찐 라디유' * 26 + '나는 라디유',
'channel': '라디유radiyu',
'title': '라디유radiyu',
'channel_is_verified': False,
},
'playlist_mincount': 4,
}, {
'note': 'Video list paging',
'url': 'https://chzzk.naver.com/2d4aa2f79b0a397d032c479ef1b37a67',
'info_dict': {
'id': '2d4aa2f79b0a397d032c479ef1b37a67',
'channel_id': '2d4aa2f79b0a397d032c479ef1b37a67',
'description': '',
'channel': '진짜후추',
'title': '진짜후추',
'channel_is_verified': False,
},
'playlist_mincount': 86,
}]
def _real_extract(self, url):
channel_id = self._match_id(url)
# even if channel got banned, the video list is still available. but downloading videos leads to error
channel_meta = self._download_json(
f'https://api.chzzk.naver.com/service/v1/channels/{channel_id}', channel_id,
note='Downloading channel info', errnote='Unable to download channel info')
if channel_meta.get('code') != 200:
raise ExtractorError('The channel is not available: %s(%s)' % (
channel_meta.get("message"), channel_meta.get("code")), expected=True)
channel_meta = channel_meta.get('content')
if not channel_meta or not channel_meta.get('channelId'):
raise ExtractorError('The channel does not exist', expected=True)
total_count = 0
videos = []
current_count = 0
while current_count <= total_count:
videos_page = self._download_json(
f'https://api.chzzk.naver.com/service/v1/channels/{channel_id}/videos', channel_meta['channelName'],
query={'sortType': 'LATEST', 'pagingType': 'PAGE', 'size': 18, 'videoType': '', 'page': current_count},
note='Downloading videos page(%s/%s)' % (current_count + 1, total_count + 1), errnote='Unable to download videos page')
if videos_page.get('code') != 200:
raise ExtractorError('Unable to download videos page: %s(%s){videos_page.get("message")}' % (
videos_page.get("message"), videos_page.get("code")), expected=True)
videos_page = videos_page['content']
videos.extend(map(_make_vod_result, videos_page['data']))
total_count = videos_page['totalPages']
current_count += 1
if len(videos) != total_count:
self.to_screen('Warning: The total count of videos is not equal to the actual count: %s != %s' % (len(videos), total_count))
return self.playlist_result(
videos, channel_id, channel_meta['channelName'], channel_meta['channelDescription'],
channel=channel_meta['channelName'], channel_id=channel_id, channel_is_verified=channel_meta['verifiedMark'],
)
class CHZZKVideoIE(InfoExtractor): class CHZZKVideoIE(InfoExtractor):
IE_NAME = 'chzzk:video' IE_NAME = 'chzzk:video'
_VALID_URL = r'https?://chzzk\.naver\.com/video/(?P<id>\d+)' _VALID_URL = r'https?://chzzk\.naver\.com/video/(?P<id>\d+)'