I have used TVH API for correcting the urls with a python script:
- exporting list with urls
- correcting url
- importing back to TVH
Here the main code:
# connect server
session = Session()
session.auth = HTTPBasicAuth("xxx", "xxx")
# reading streamlist
response = session.get(f"http://xxxx:9981/api/raw/export?class=iptv_mux", verify=False)
j = json.loads(response.text)
print("Server response during reading list:",response.status_code)
# changing streamlink and write back to server
for i in j:
if "iptv_sname" in i.keys():
i["iptv_url"]=i["iptv_url"].replace("%5F","_")
i["iptv_url_cmpid"]=i["iptv_url_cmpid"].replace("%5F","_")
#headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r2 = session.post(f"http://xxxxx:9981/api/raw/import?uuid={i['uuid']}",data={"node":json.dumps(i)})
# print result
print(i["iptv_sname"],"responsecode from server: ",r2.status_code)
Maybe this is helpful...