From 619b05f795053ef0f879c6e8a3ff49df56ac9627 Mon Sep 17 00:00:00 2001 From: auqhjjqdo Date: Sat, 9 Dec 2023 14:36:15 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5d745af..f32afb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,20 +5,20 @@ description = "基于Streamlink的全自动直播录制工具,已支持哔哩 authors = [ {name = "auqhjjqdo", email = "auqhjjqdo@qq.com"}, ] -requires-python = ">=3.8,<3.11" +requires-python = ">=3.8" readme = "README.md" license = {text = "MIT"} keywords = ["LiveRecorder", "Live", "Streamlink", "Bilibili", "Douyu", "Douyin", "YouTube", "Twitch"] dependencies = [ - "streamlink>=6.2.0", - "httpx[http2]>=0.25.0", + "streamlink>=6.4.2", + "httpx[http2]>=0.25.2", "ffmpeg-python>=0.2.0", "loguru>=0.7.2", "jsonpath-ng>=1.6.0", "jsengine>=1.0.7.post1", - "quickjs>=1.19.2", + "quickjs>=1.19.4", "tenacity>=8.2.3", - "httpx-socks[asyncio]>=0.7.8" + "httpx-socks[asyncio]>=0.8.0" ] [project.urls] From 6542861bceb99e18f2665516a26c921ba65fecfc Mon Sep 17 00:00:00 2001 From: auqhjjqdo Date: Sat, 16 Dec 2023 20:45:16 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0streamlink=E8=A7=A3?= =?UTF-8?q?=E5=86=B3bilibili=E5=BD=95=E5=88=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f32afb9..063c42f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" license = {text = "MIT"} keywords = ["LiveRecorder", "Live", "Streamlink", "Bilibili", "Douyu", "Douyin", "YouTube", "Twitch"] dependencies = [ - "streamlink>=6.4.2", + "streamlink>=6.5.0", "httpx[http2]>=0.25.2", "ffmpeg-python>=0.2.0", "loguru>=0.7.2", From dd38dbcc51bbcfe3f7c66829f00cfdbdec302a9d Mon Sep 17 00:00:00 2001 From: auqhjjqdo Date: Wed, 20 Dec 2023 20:25:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtwitcasting=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E5=BC=80=E6=92=AD=E5=88=A4=E6=96=AD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- live_recorder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live_recorder.py b/live_recorder.py index cd9a3e0..5fe35b6 100644 --- a/live_recorder.py +++ b/live_recorder.py @@ -370,7 +370,7 @@ async def run(self): 'mode': 'client' } )).json() - if response['movie']['live']: + if response: response = (await self.request( method='GET', url=url From a744e23c2b7307f5347d827ca1dd19081666a4fc Mon Sep 17 00:00:00 2001 From: auqhjjqdo Date: Thu, 21 Dec 2023 11:33:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=B0=E5=A2=9EPixiv=20Sketch=E7=9B=B4?= =?UTF-8?q?=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + config.sample.json | 6 ++++++ live_recorder.py | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 0e95625..a026ee8 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ - [x] Afreeca - [x] Pandalive - [x] Bigolive +- [x] Pixiv Sketch - [ ] 更多平台欢迎PR ## 已知bug diff --git a/config.sample.json b/config.sample.json index eb51d42..8673f41 100644 --- a/config.sample.json +++ b/config.sample.json @@ -65,6 +65,12 @@ "platform": "Bigolive", "id": "660801666", "name": "660801666" + }, + { + "platform": "Pixivsketch", + "id": "@blue_gk", + "name": "@blue_gk", + "cookies": "_sketch_session=xxxxx" } ] } diff --git a/live_recorder.py b/live_recorder.py index 5fe35b6..05c4d3d 100644 --- a/live_recorder.py +++ b/live_recorder.py @@ -438,6 +438,22 @@ async def run(self): await asyncio.to_thread(self.run_record, stream, url, title, 'ts') +class Pixivsketch(LiveRecoder): + async def run(self): + url = f'https://sketch.pixiv.net/{self.id}' + if url not in recording: + response = (await self.request( + method='GET', + url=f'https://sketch.pixiv.net/_next/data/9yFpS_JEo_sQWcZoqUqYd/{self.id}.json', + params={'id': self.id} + )).json() + initial_state = json.loads(response['pageProps']['initialState']) + if lives := initial_state['live']['lives']: + title = list(lives.values())[0]['name'] + stream = self.get_streamlink().streams(url).get('best') # HLSStream[mpegts] + await asyncio.to_thread(self.run_record, stream, url, title, 'ts') + + async def run(): with open('config.json', 'r', encoding='utf-8') as f: config = json.load(f)