URLJOIN between m3u8 fornt url and back(main) url

项月亮
1 min readJan 6, 2020
import requests


url = "https://agmjjzyi.ixibeiren.com/20181101/WRm7KyCb/2500kb/hls/index.m3u8?wsSecret=3f625f84edd8021348089810c0375dce&wsTime=1578306531"

response = requests.get(url)

body = response.content

base_url = "https://agmjjzyi.ixibeiren.com/20181101/WRm7KyCb/2500kb/hls/"
ts_test_list = []
with open("index_sillicon.m3u8", "a") as f:
for n in body.split(b'\n'):
if n and not n.startswith(b"#"):
n = (base_url + str(n).replace("'", "")[1:])
if str(n).replace("'", "").startswith("b"):
n = str(n).replace("'", "")[1:]
f.write((str(n) + "\n"))

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response