mirror of
https://github.com/ihmily/DouyinLiveRecorder.git
synced 2025-12-26 05:48:32 +08:00
fix: update flextv endpoint address (#1185)
This commit is contained in:
parent
c7e3cf47ce
commit
be2c3a393f
2
demo.py
2
demo.py
@ -71,7 +71,7 @@ LIVE_STREAM_CONFIG = {
|
|||||||
"func": spider.get_winktv_stream_data,
|
"func": spider.get_winktv_stream_data,
|
||||||
},
|
},
|
||||||
"flextv": {
|
"flextv": {
|
||||||
"url": "https://www.flextv.co.kr/channels/593127/live",
|
"url": "https://www.ttinglive.com/channels/685479/live",
|
||||||
"func": spider.get_flextv_stream_data,
|
"func": spider.get_flextv_stream_data,
|
||||||
},
|
},
|
||||||
"looklive": {
|
"looklive": {
|
||||||
|
|||||||
3
main.py
3
main.py
@ -671,7 +671,7 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
|
|||||||
else:
|
else:
|
||||||
logger.error("错误信息: 网络异常,请检查本网络是否能正常访问WinkTV直播平台")
|
logger.error("错误信息: 网络异常,请检查本网络是否能正常访问WinkTV直播平台")
|
||||||
|
|
||||||
elif record_url.find("www.flextv.co.kr/") > -1:
|
elif record_url.find("www.flextv.co.kr/") > -1 or record_url.find("www.ttinglive.com/") > -1:
|
||||||
platform = 'FlexTV'
|
platform = 'FlexTV'
|
||||||
with semaphore:
|
with semaphore:
|
||||||
if global_proxy or proxy_address:
|
if global_proxy or proxy_address:
|
||||||
@ -1930,6 +1930,7 @@ while True:
|
|||||||
'www.pandalive.co.kr',
|
'www.pandalive.co.kr',
|
||||||
'www.winktv.co.kr',
|
'www.winktv.co.kr',
|
||||||
'www.flextv.co.kr',
|
'www.flextv.co.kr',
|
||||||
|
'www.ttinglive.com',
|
||||||
'www.popkontv.com',
|
'www.popkontv.com',
|
||||||
'www.twitch.tv',
|
'www.twitch.tv',
|
||||||
'www.liveme.com',
|
'www.liveme.com',
|
||||||
|
|||||||
@ -1256,7 +1256,7 @@ async def login_flextv(username: str, password: str, proxy_addr: OptionalStr = N
|
|||||||
'accept': 'application/json, text/plain, */*',
|
'accept': 'application/json, text/plain, */*',
|
||||||
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
||||||
'content-type': 'application/json;charset=UTF-8',
|
'content-type': 'application/json;charset=UTF-8',
|
||||||
'referer': 'https://www.flextv.co.kr/',
|
'referer': 'https://www.ttinglive.com/',
|
||||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',
|
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1268,7 +1268,7 @@ async def login_flextv(username: str, password: str, proxy_addr: OptionalStr = N
|
|||||||
'device': 'PCWEB',
|
'device': 'PCWEB',
|
||||||
}
|
}
|
||||||
|
|
||||||
url = 'https://api.flextv.co.kr/v2/api/auth/signin'
|
url = 'https://www.ttinglive.com/v2/api/auth/signin'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print("Logging into FlexTV platform...")
|
print("Logging into FlexTV platform...")
|
||||||
@ -1296,13 +1296,13 @@ async def get_flextv_stream_url(
|
|||||||
headers = {
|
headers = {
|
||||||
'accept': 'application/json, text/plain, */*',
|
'accept': 'application/json, text/plain, */*',
|
||||||
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
||||||
'referer': 'https://www.flextv.co.kr/',
|
'referer': 'https://www.ttinglive.com/',
|
||||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',
|
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',
|
||||||
}
|
}
|
||||||
user_id = url.split('/live')[0].rsplit('/', maxsplit=1)[-1]
|
user_id = url.split('/live')[0].rsplit('/', maxsplit=1)[-1]
|
||||||
if cookie:
|
if cookie:
|
||||||
headers['Cookie'] = cookie
|
headers['Cookie'] = cookie
|
||||||
play_api = f'https://api.flextv.co.kr/api/channels/{user_id}/stream?option=all'
|
play_api = f'https://www.ttinglive.com/api/channels/{user_id}/stream?option=all'
|
||||||
json_str = await async_req(play_api, proxy_addr=proxy_addr, headers=headers, abroad=True)
|
json_str = await async_req(play_api, proxy_addr=proxy_addr, headers=headers, abroad=True)
|
||||||
if 'HTTP Error 400: Bad Request' in json_str:
|
if 'HTTP Error 400: Bad Request' in json_str:
|
||||||
raise ConnectionError(
|
raise ConnectionError(
|
||||||
@ -1324,7 +1324,7 @@ async def get_flextv_stream_data(
|
|||||||
headers = {
|
headers = {
|
||||||
'accept': 'application/json, text/plain, */*',
|
'accept': 'application/json, text/plain, */*',
|
||||||
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
||||||
'referer': 'https://www.flextv.co.kr/',
|
'referer': 'https://www.ttinglive.com/',
|
||||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',
|
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',
|
||||||
}
|
}
|
||||||
if cookies:
|
if cookies:
|
||||||
@ -1333,7 +1333,7 @@ async def get_flextv_stream_data(
|
|||||||
result = {"anchor_name": '', "is_live": False}
|
result = {"anchor_name": '', "is_live": False}
|
||||||
new_cookies = None
|
new_cookies = None
|
||||||
try:
|
try:
|
||||||
url2 = f'https://www.flextv.co.kr/channels/{user_id}/live'
|
url2 = f'https://www.ttinglive.com/channels/{user_id}/live'
|
||||||
html_str = await async_req(url2, proxy_addr=proxy_addr, headers=headers, abroad=True)
|
html_str = await async_req(url2, proxy_addr=proxy_addr, headers=headers, abroad=True)
|
||||||
json_str = re.search('<script id="__NEXT_DATA__" type=".*">(.*?)</script>', html_str).group(1)
|
json_str = re.search('<script id="__NEXT_DATA__" type=".*">(.*?)</script>', html_str).group(1)
|
||||||
json_data = json.loads(json_str)
|
json_data = json.loads(json_str)
|
||||||
@ -1371,7 +1371,7 @@ async def get_flextv_stream_data(
|
|||||||
result['play_url_list'] = play_url_list
|
result['play_url_list'] = play_url_list
|
||||||
result['is_live'] = True
|
result['is_live'] = True
|
||||||
else:
|
else:
|
||||||
url2 = f'https://www.flextv.co.kr/channels/{user_id}'
|
url2 = f'https://www.ttinglive.com/channels/{user_id}'
|
||||||
html_str = await async_req(url2, proxy_addr=proxy_addr, headers=headers, abroad=True)
|
html_str = await async_req(url2, proxy_addr=proxy_addr, headers=headers, abroad=True)
|
||||||
anchor_name = re.search('<meta name="twitter:title" content="(.*?)의', html_str).group(1)
|
anchor_name = re.search('<meta name="twitter:title" content="(.*?)의', html_str).group(1)
|
||||||
result["anchor_name"] = anchor_name
|
result["anchor_name"] = anchor_name
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user