live stream test
This commit is contained in:
parent
677648ecdd
commit
c8d51d2e3d
18
stream.py
18
stream.py
@ -220,10 +220,12 @@ try:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
|
||||
def rewrite(current, provider, proxy):
|
||||
resp = requests.get(current, proxies=proxy.req)
|
||||
async def rewrite(current, provider, proxy):
|
||||
async with proxy.session() as session:
|
||||
resp = await session.get(current)
|
||||
text = await resp.text()
|
||||
ndata = None
|
||||
if resp.text is not None:
|
||||
if text is not None:
|
||||
links = []
|
||||
for line in resp.text.splitlines():
|
||||
if line.startswith("#EXT-X-KEY:METHOD="):
|
||||
@ -244,10 +246,12 @@ def rewrite(current, provider, proxy):
|
||||
links.append(ldata)
|
||||
if isinstance(proxy_server, str):
|
||||
ndata = ""
|
||||
presp = requests.post(proxy_server, json=links)
|
||||
if isinstance(presp.text, str):
|
||||
links = json.loads(presp.text)
|
||||
for line in resp.text.splitlines():
|
||||
async with proxy.session() as session:
|
||||
resp = await session.post(proxy_server, json=links)
|
||||
link_text = await resp.text()
|
||||
if isinstance(link_text, str):
|
||||
links = json.loads(link_text)
|
||||
for line in text.splitlines():
|
||||
if line.startswith("#EXT-X-KEY:METHOD="):
|
||||
matches = re.findall(r'(?<=URI=").+(?=")', line)
|
||||
if len(matches) == 1:
|
||||
|
Loading…
Reference in New Issue
Block a user