hcjohn463 / JableTVDownload

下載 jable好幫手
Apache License 2.0
676 stars 149 forks source link

download.py中的result = re.search("https://.+m3u8", dr.page_source)获取m3u8地址似乎有问题 #127

Open addwater1 opened 1 year ago

addwater1 commented 1 year ago

比如输入网址https://jp.jable.tv/videos/ipzz-102/,得到的m3u8地址是https://assets-cdn.jable.tv/contents/videos_screenshots/35000/35852/preview.jpg" id="player" playsinline="" src="https://homi-doki-mani.mushroomtrack.com/hls/wXr2r2xSTWhEOkwBU3Jvqg/1694602926/35000/35852/35852.m3u8,实际上要的是src后面的那一串

kptung commented 1 year ago

可以用python對字串進行後處理,例如

使用字串分割提取src後面的內容

start_index = m3u8url .find('src="')
if start_index != -1:
    start_index += len('src="')
    end_index = m3u8url .find('m3u8', start_index)
    if end_index != -1:
        src_url = m3u8url [start_index:end_index]+"m3u8"
        print(src_url)
    else:
        print("未找到src屬性的結束引號")
else:
    print("未找到src屬性")
m3u8url = src_url