更改状态图片,更改liveDownloader的连接池,api使用连接池
This commit is contained in:
parent
76f280172b
commit
95565c33ec
12
api.py
12
api.py
@ -10,7 +10,6 @@ from Struct.Lottery import Lottery
|
||||
import requests
|
||||
import time
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
DEBUG = False
|
||||
|
||||
@ -27,6 +26,7 @@ class XiGuaLiveApi:
|
||||
_cursor = "0"
|
||||
_updRoomCount = 0
|
||||
lottery = None
|
||||
s = requests.session()
|
||||
|
||||
def __init__(self, name: str = "永恒de草薙"):
|
||||
"""
|
||||
@ -153,7 +153,7 @@ class XiGuaLiveApi:
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
p = s.get("https://security.snssdk.com/video/app/search/live/?version_code=730&device_platform=android"
|
||||
p = self.s.get("https://security.snssdk.com/video/app/search/live/?version_code=730&device_platform=android"
|
||||
"&format=json&keyword={}".format(self.name))
|
||||
d = p.json()
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
@ -186,7 +186,7 @@ class XiGuaLiveApi:
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
p = s.post("https://i.snssdk.com/videolive/room/enter?version_code=730"
|
||||
p = self.s.post("https://i.snssdk.com/videolive/room/enter?version_code=730"
|
||||
"&device_platform=android",
|
||||
data="room_id={roomID}&version_code=730"
|
||||
"&device_platform=android".format(roomID=self.roomID),
|
||||
@ -232,7 +232,7 @@ class XiGuaLiveApi:
|
||||
:param userId: 用户ID
|
||||
:return: XiGuaLiveApi
|
||||
"""
|
||||
p = s.get("https://live.ixigua.com/api/room?anchorId={room}".format(room=userId))
|
||||
p = requests.get("https://live.ixigua.com/api/room?anchorId={room}".format(room=userId))
|
||||
if DEBUG:
|
||||
print(p.text)
|
||||
d = p.json()
|
||||
@ -249,7 +249,7 @@ class XiGuaLiveApi:
|
||||
:return: array: 搜索结果
|
||||
"""
|
||||
ret = []
|
||||
p = s.get("https://security.snssdk.com/video/app/search/live/?version_code=730&device_platform=android"
|
||||
p = requests.get("https://security.snssdk.com/video/app/search/live/?version_code=730&device_platform=android"
|
||||
"&format=json&keyword={}".format(keyword))
|
||||
d = p.json()
|
||||
if "data" in d:
|
||||
@ -266,7 +266,7 @@ class XiGuaLiveApi:
|
||||
if not self.isValidRoom:
|
||||
self.updRoomInfo()
|
||||
return
|
||||
p = s.get("https://i.snssdk.com/videolive/im/get_msg?cursor={cursor}&room_id={roomID}"
|
||||
p = self.s.get("https://i.snssdk.com/videolive/im/get_msg?cursor={cursor}&room_id={roomID}"
|
||||
"&version_code=730&device_platform=android".format(
|
||||
roomID=self.roomID,
|
||||
cursor=self._cursor
|
||||
|
@ -15,11 +15,12 @@ isDownload = False
|
||||
def download():
|
||||
global isDownload
|
||||
while Common.api.isLive and not Common.forceNotDownload:
|
||||
session = requests.session()
|
||||
if not Common.streamUrl:
|
||||
Common.appendError("Download with No StreamUrl Specific")
|
||||
break
|
||||
path = datetime.strftime(datetime.now(), "%Y%m%d_%H%M.flv")
|
||||
p = requests.get(Common.streamUrl, stream=True)
|
||||
p = session.get(Common.streamUrl, stream=True, timeout=10)
|
||||
if p.status_code != 200:
|
||||
Common.appendDownloadStatus("Download with Response {}".format(p.status_code))
|
||||
break
|
||||
|
@ -21,9 +21,9 @@
|
||||
<td style="width: 33%">磁盘近三天</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img style="width: 100%" src="/images/rrd/df-srv-dev-disk-by-id-usb-Hitachi_HTS541612J9AT00_000000000000-0-0-part1-half_day.png"></td>
|
||||
<td><img style="width: 100%" src="/images/rrd/df-srv-dev-disk-by-id-usb-Hitachi_HTS541612J9AT00_000000000000-0-0-part1-day.png"></td>
|
||||
<td><img style="width: 100%" src="/images/rrd/df-srv-dev-disk-by-id-usb-Hitachi_HTS541612J9AT00_000000000000-0-0-part1-three_days.png"></td>
|
||||
<td><img style="width: 100%" src="/images/rrd/df-srv-dev-disk-by-label-6TB-half_day.png"></td>
|
||||
<td><img style="width: 100%" src="/images/rrd/df-srv-dev-disk-by-label-6TB-day.png"></td>
|
||||
<td><img style="width: 100%" src="/images/rrd/df-srv-dev-disk-by-label-6TB-three_days.png"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr/>
|
||||
|
Reference in New Issue
Block a user