import re,requests,time,os

import threadpool

res = requests.get(url="http://pili-vod.tebaobao.vip/recordings/z1.tebaobao.tbb_dev5_4706464/f1610716867.m3u8").text

# print(res)
m3u8_res = re.findall('/fragments(.*?)ts',res)
m_res = re.findall('fragments/z1.tebaobao.tbb_dev5_4706464/(.*?)ts',res)
li = []
# print(m3u8_res)
for i in range(len(m3u8_res)):
m3_res = "http://pili-vod.tebaobao.vip/fragments" +m3u8_res[i] + "ts"
li.append(m3_res) print(li)
print(len(li)) w_li = []
for i in range(len(m3u8_res)):
m3u_res = m_res[i] + "ts"
w_li.append(m3u_res) print(w_li) r = requests.get(url='http://pili-vod.tebaobao.vip/fragments/z1.tebaobao.tbb_dev5_4706464/1610711419540-1610711423167.ts')
print(r.content)
c = 0
def download(c): for i in range(len(li)):
with open("/Users/apple/Desktop/test/" + str(c) + ".ts","wb")as f:
try:
r = requests.get(url = li[i]) f.write(r.content)
print("下载成功!,第%d次"%c)
except:
print('请求失败!')
c=c+1 def get_video():
files = os.listdir("/Users/apple/Desktop/test/")
# print(files)
aa = 0
for file in range(len(li)): with open("/Users/apple/Desktop/test/" + str(aa) + ".ts", 'rb') as f1:
with open("1.mp4", 'ab') as f2:
f2.write(f1.read()) aa = aa+1 get_video() # if __name__ == '__main__':
#
# start_time = time.time()
# pool = threadpool.ThreadPool(1000)
# results = threadpool.makeRequests(download,args_list=range(1))
# [pool.putRequest(req) for req in results] # 多线程一块执行
# pool.wait() # 线程挂起,直到结束

python:m3u8转mp4的更多相关文章

  1. ffmpeg m3u8 转 MP4

    ffmpeg -i 你的m3u8地址 -acodec copy -vcodec copy -f mp4 output.mp4

  2. Python 下载网络mp4视频资源

    最近着迷化学, 特别是古代的冶炼技术,感叹古人的聪明. 春秋时期的炼铁方法是块炼铁,即在较低的冶炼温度下,将铁矿石固态还原获得海绵铁,再经锻打成的铁块.冶炼块炼铁,一般采用地炉.平地筑炉和竖炉3种.铁 ...

  3. m3u8转mp4

    先进行一波操作 新建一个文件夹,里面床两个txt文件 如图 里面随意写一些内容 之后新建一个demo.bat文件.里面输入 copy /b 1.txt+2.txt new.txt 之后双击会有一个ne ...

  4. Python爬虫入门教程 51-100 Python3爬虫通过m3u8文件下载ts视频-Python爬虫6操作

    什么是m3u8文件 M3U8文件是指UTF-8编码格式的M3U文件. M3U文件是记录了一个索引纯文本文件, 打开它时播放软件并不是播放它,而是根据它的索引找到对应的音视频文件的网络地址进行在线播放. ...

  5. python代码下载m3u8视频

    代码如下: # -*- coding: utf-8 -*- import requests import re import os import base64 from Crypto.Cipher i ...

  6. 智普教育Python培训之Python开发视频教程网络爬虫实战项目

    网络爬虫项目实训:看我如何下载韩寒博客文章Python视频 01.mp4 网络爬虫项目实训:看我如何下载韩寒博客文章Python视频 02.mp4 网络爬虫项目实训:看我如何下载韩寒博客文章Pytho ...

  7. 下载m3u8视频

    分两种情况 同时支持m3u8和mp4文件 某些视频同时支持m3u8和mp4视频文件,将m3u8改成mp4后直接: wget -c http://www.xxx.com/xxxx.mp4 只有m3u8视 ...

  8. 使用ffmpeg下载m3u8流媒体

    安装 编译好的windows可用版本的下载地址(官网中可以连接到这个网站,和官方网站保持同步): http://ffmpeg.zeranoe.com/builds/ 或者: 百度网盘https://p ...

  9. 视频软件——ffmpeg

    1.官网下载地址:http://ffmpeg.org/download.html ffplay.exe ffplay是用于播放的应用程序. ffplay name.mp4 ffprobe.exe ff ...

  10. ffmpeg 常用命令

    mp4中的h264编码,而h264有两种封装: 一种是annexb模式,传统模式,有startcode,SPS和PPS是在ES中:另一种是mp4模式,一般mp4.mkv.avi会没有startcode ...

随机推荐

  1. python生成随机中文姓名和拼音

    def sayhello(): print('hellopython') import pinyin import random def random_name(): # 删减部分,比较大众化姓氏 f ...

  2. android 集成友盟实现 第三方分享 登录(qq,新浪,微信)

    其实友盟的文档写的非常详细了,在这只是记录一下开发过程中遇到过的坑. 开发流程,先到友盟的官网注册账号创建应用,友盟的文档地址:http://dev.umeng.com/social/android/ ...

  3. Authentication is required to set the network proxy

    在使用VNC访问集群的时候,总是弹出"Authentication is required to set the network proxy used for downloading pac ...

  4. maven安装在idea中报错

    java.lang.RuntimeException: java.lang.RuntimeException: org.codehaus.plexus.component.repository.exc ...

  5. 上传路径Class替换无效

    路径配置文件使用的常量,其它文件使用路径时,编译class时为静态常量信息,改变不同的路径常量则不生效

  6. Topsis法的python实现

    TOPSIS (Technique for Order Preference by Similarity to an Ideal Solution )法是C.L.Hwang和K.Yoon于1981年首 ...

  7. RabbitMq的部署(docker)和操作(python)详解

    一.简介: RabbitMq 是实现了高级消息队列协议(AMQP)的开源消息代理中间件.消息队列是一种应用程序对应用程序的通行方式,应用程序通过写消息,将消息传递于队列,由另一应用程序读取 完成通信. ...

  8. 微信支付 easy wechat 使用

    /*微信小程序的配置信息微信商户信息*/ public function __construct(){ parent::__construct(); $this->OrderModel = ne ...

  9. thymeleaf基础学习

    Thymeleaf 1.标准表达式 ${...}:变量表达式 *{...}: 选择表达式 #{...} : 消息表达式 @{...}: 连接表达式 <img th:src="@{url ...

  10. ST能维护的性质

    总结: 其实ST表不仅能处理最大值/最小值,凡是符合结合律且可重复贡献的信息查询都可以使用ST表高效进行.什么叫可重复贡献呢?设有一个二元运算  ,满足  ,则是可重复贡献的.显然最大值.最小值.最大 ...