|
@@ -3,6 +3,7 @@ from datetime import datetime
|
|
from string import Template
|
|
from string import Template
|
|
|
|
|
|
from bilibili_api import live
|
|
from bilibili_api import live
|
|
|
|
+from fake_useragent import UserAgent
|
|
import ffmpy3
|
|
import ffmpy3
|
|
|
|
|
|
class Recorder:
|
|
class Recorder:
|
|
@@ -32,7 +33,7 @@ class Recorder:
|
|
})
|
|
})
|
|
f_handler=open("./logs/"+outputName+'.log', 'w') if log else asyncio.subprocess.PIPE
|
|
f_handler=open("./logs/"+outputName+'.log', 'w') if log else asyncio.subprocess.PIPE
|
|
self.ff = ffmpy3.FFmpeg(
|
|
self.ff = ffmpy3.FFmpeg(
|
|
- inputs={url:" -v debug"},
|
|
|
|
|
|
+ inputs={url:" -v debug -user-agent \""+str(UserAgent().random)+"\" -referer \"https://live.bilibili.com/"+str(self.ROOM_DISPLAY_ID)+"\""},
|
|
outputs={"./videos/"+outputName+".flv":"-c copy -y"}
|
|
outputs={"./videos/"+outputName+".flv":"-c copy -y"}
|
|
)
|
|
)
|
|
self.process = self.ff.run_async(stdout=f_handler, stderr=f_handler)
|
|
self.process = self.ff.run_async(stdout=f_handler, stderr=f_handler)
|