This commit is contained in:
abc1763613206
2024-05-31 14:34:05 +08:00
parent 666ad5d64d
commit dbe5b075ea
11 changed files with 4414 additions and 27784 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5,34 +5,32 @@ import io
import time import time
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
url = 'http://epg.51zmt.top:8000/upload/' url = "http://epg.51zmt.top:8000/api/upload/"
def get_epg(a, b): def get_epg(a, b):
f = os.path.join(a, b) f = os.path.join(a, b)
if ('utf8' in f) or ('ignored' in f): if ("utf8" in f) or ("ignored" in f):
return return
files = {'myfile': open(f,'rb')} files = {"myfile": open(f, "rb")}
print('Converting {}'.format(f)) print("Converting {}".format(f))
r = requests.post(url, files=files) r = requests.post(url, files=files)
print(r.text) print(r.text)
soup = BeautifulSoup(r.text, 'html.parser') soup = BeautifulSoup(r.text, "html.parser")
links = soup.find_all('a') links = soup.find_all("a")
for item in links: for item in links:
m3u8url = item.get('href') m3u8url = item.get("href")
print(m3u8url) print(m3u8url)
r1 = requests.get(m3u8url) r1 = requests.get(m3u8url)
name = str(b)[:-4] + '.m3u' name = str(b)[:-4] + ".m3u"
with open(name, 'wb') as f1: with open(name, "wb") as f1:
f1.write(r1.content) f1.write(r1.content)
return return
if __name__ == "__main__":
if __name__ == '__main__':
for root, dirs, files in os.walk("..", topdown=False): for root, dirs, files in os.walk("..", topdown=False):
for name in files: for name in files:
if '.txt' in name: if ".txt" in name:
# print(os.path.join(root, name)) # print(os.path.join(root, name))
get_epg(root, name) get_epg(root, name)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff