mirror of
https://github.com/imgyh/tiktok.git
synced 2025-04-05 22:55:45 +08:00
fix(tiktok): 优化视频链接获取
This commit is contained in:
parent
a984186542
commit
321d4622a1
14
TikTok.py
14
TikTok.py
@ -418,8 +418,7 @@ class TikTok(object):
|
||||
# 分区
|
||||
self.result.liveDict["partition"] = live_json['data']['partition_road_map']['partition']['title']
|
||||
self.result.liveDict["sub_partition"] = \
|
||||
live_json['data']['partition_road_map']['sub_partition']['partition'][
|
||||
'title']
|
||||
live_json['data']['partition_road_map']['sub_partition']['partition']['title']
|
||||
except Exception as e:
|
||||
self.result.liveDict["partition"] = '无'
|
||||
self.result.liveDict["sub_partition"] = '无'
|
||||
@ -429,8 +428,7 @@ class TikTok(object):
|
||||
for i, f in enumerate(self.result.liveDict["flv_pull_url"].keys()):
|
||||
flv.append(f)
|
||||
|
||||
self.result.liveDict["flv_pull_url0"] = self.result.liveDict["flv_pull_url"][flv[0]].replace("http://",
|
||||
"https://")
|
||||
self.result.liveDict["flv_pull_url0"] = self.result.liveDict["flv_pull_url"][flv[0]]
|
||||
|
||||
return self.result.liveDict, live_json
|
||||
|
||||
@ -498,8 +496,7 @@ class TikTok(object):
|
||||
# 分区
|
||||
self.result.liveDict["partition"] = live_json['data']['partition_road_map']['partition']['title']
|
||||
self.result.liveDict["sub_partition"] = \
|
||||
live_json['data']['partition_road_map']['sub_partition']['partition'][
|
||||
'title']
|
||||
live_json['data']['partition_road_map']['sub_partition']['partition']['title']
|
||||
except Exception as e:
|
||||
self.result.liveDict["partition"] = '无'
|
||||
self.result.liveDict["sub_partition"] = '无'
|
||||
@ -517,8 +514,7 @@ class TikTok(object):
|
||||
|
||||
rate = int(input('[ 🎬 ]输入数字选择推流清晰度:'))
|
||||
|
||||
self.result.liveDict["flv_pull_url0"] = self.result.liveDict["flv_pull_url"][flv[rate]].replace("http://",
|
||||
"https://")
|
||||
self.result.liveDict["flv_pull_url0"] = self.result.liveDict["flv_pull_url"][flv[rate]]
|
||||
|
||||
# 显示清晰度列表
|
||||
print('[ %s ]:%s' % (flv[rate], self.result.liveDict["flv_pull_url"][flv[rate]]))
|
||||
@ -949,7 +945,7 @@ class TikTok(object):
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
url = awemeDict["video"]["play_addr"]["url_list"]
|
||||
url = awemeDict["video"]["play_addr"]["url_list"][0]
|
||||
if url != "":
|
||||
self.isdwownload = False
|
||||
# task_id = self.progress.add_task("download", filename="[ 视频 ]:" + desc, start=False)
|
||||
|
@ -121,7 +121,7 @@ class Result(object):
|
||||
self.videoDict = {
|
||||
"play_addr": {
|
||||
"uri": "",
|
||||
"url_list": "",
|
||||
"url_list": [],
|
||||
},
|
||||
"cover_original_scale": {
|
||||
"height": "",
|
||||
@ -259,7 +259,7 @@ class Result(object):
|
||||
# 使用 这个api 可以获得1080p
|
||||
# dataNew[item]["url_list"] = "https://aweme.snssdk.com/aweme/v1/play/?video_id=%s&ratio=1080p&line=0" \
|
||||
# % dataNew[item]["uri"]
|
||||
dataNew[item]["url_list"] = dataRaw["bit_rate"][0]["play_addr"]["url_list"][0]
|
||||
dataNew[item]["url_list"] = copy.deepcopy(dataRaw["bit_rate"][0]["play_addr"]["url_list"])
|
||||
continue
|
||||
|
||||
# 常规 递归遍历 字典
|
||||
|
Loading…
x
Reference in New Issue
Block a user