Skip to content

Commit

Permalink
修复pandalive直播
Browse files Browse the repository at this point in the history
  • Loading branch information
auqhjjqdo committed Oct 7, 2023
1 parent c3dbfda commit 64ab922
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions live_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from jsonpath_ng.ext import parse
from loguru import logger
from streamlink.options import Options
from streamlink.stream import StreamIO, HTTPStream
from streamlink.stream import StreamIO, HTTPStream, HLSStream
from streamlink_cli.main import open_stream
from streamlink_cli.output import FileOutput
from streamlink_cli.streamrunner import StreamRunner
Expand Down Expand Up @@ -403,14 +403,21 @@ async def run(self):
response = (await self.request(
method='POST',
url='https://api.pandalive.co.kr/v1/live/play',
headers={
'x-device-info': '{"t":"webPc","v":"1.0","ui":0}'
},
data={
'action': 'watch',
'userId': self.id
}
)).json()
if response['result']:
title = response['media']['title']
stream = self.get_streamlink().streams(url).get('best') # HLSStream[mpegts]
streams = HLSStream.parse_variant_playlist(
self.get_streamlink(),
response['PlayList']['hls'][0]['url']
)
stream = list(streams.values())[0] # HLSStream[mpegts]
await asyncio.to_thread(self.run_record, stream, url, title, 'ts')


Expand Down

0 comments on commit 64ab922

Please sign in to comment.