Ai
1 Star 0 Fork 2

Lindddt/基于Python的爬取TwitCasting视频的工具

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
downloadTs.py 774 Bytes
一键复制 编辑 原始数据 按行查看 历史
PtvMiKu 提交于 2020-02-27 13:56 +08:00 . first upload
import requests
import dealHtml
import dealTxt
import io
import os
def download_ts_files(download_from_url):
download_url = download_from_url.replace('index.m3u8','')
path = "temp/ts/"
txt_name = dealTxt.filename_edited_txt(dealHtml.url)
if not os.path.exists(path):
os.mkdir(path)
f = open("temp/" + txt_name,'r')
number_of_lines = len(f.readlines())
f.close()
session=requests.session()
f = open("temp/" + txt_name,'r')
for line in f.readlines():
line = line.strip()
r = session.get(download_url + line)
fr = open(path + line, 'wb')
print("Downloading %s . Remain %d files." % (line,number_of_lines))
number_of_lines -= 1
fr.write(r.content)
fr.close()
f.close()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/Lindddt/PythonTwitCastingWebCrawler.git
git@gitee.com:Lindddt/PythonTwitCastingWebCrawler.git
Lindddt
PythonTwitCastingWebCrawler
基于Python的爬取TwitCasting视频的工具
master

搜索帮助