MdTalhaZubayer / aiom3u8

async download video by m3u8 url

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aiom3u8

解析m3u8文件进行视频文件的异步下载

下载安装

$ python -m pip install aiom3u8

# 镜像加速
$ python -m pip install aiom3u8 -i https://pypi.tuna.tsinghua.edu.cn/simple

基本用法:

import aiom3u8

aiom3u8.download("https://demo.com/demo/demo.m3u8", "C:\\video_path", "video_name")  # 使用默认参数

params = {...}
cookies = {...}
headers = {...}
aiom3u8.download("https://demo.com/demo/demo.m3u8", "C:\\video_path", "video_name",  # 使用调节参数 
                  video_name_extension=".mp4", params=params, cookies=cookies, headers=headers, proxy="http://127.0.0.1:10809/"
                  auto_highest_bandwidth=True, progress_bar_display=True, async_tasks_maintain=20, inspect_interval=3.,
                  failure_retries=5)

OR

import asyncio
import aiom3u8

async def main():
  await aiom3u8.download_coro(arguments...)
 
asyncio.run(main())

参数描述:

  • video_name_extension:   str   -  生成视频类型
  • params、cookies、headers:  dict   -  请求时附带参数
  • proxy:          str   -  自身使用的代理地址
  • auto_highest_bandwidth:  bool   -  有多个适配流时是否自动选择最高画质
  • progress_bar_display:   bool   -  是否显示下载进度条
  • async_tasks_maintain:   int   -  同时下载的异步任务数
  • inspect_interval:    float   -  添加新异步任务的检查间隔时间
  • failure_retries:      int   -  允许单个文件的下载连接失败次数


aiom3u8

Using async way to download a video file by parsing m3u8 file

Installing m3u8ToMp4

$ python -m pip install aiom3u8

# Using a mirror
$ python -m pip install aiom3u8 -i https://pypi.tuna.tsinghua.edu.cn/simple

Basic Usage:

import aiom3u8

aiom3u8.download("https://demo.com/demo/demo.m3u8", "C:\\video_path", "video_name")  # Using default arguments

params = {...}
cookies = {...}
headers = {...}
aiom3u8.download("https://demo.com/demo/demo.m3u8", "C:\\video_path", "video_name",  # Using adjustment arguments
                  video_name_extension=".mp4", params=params, cookies=cookies, headers=headers, proxy="http://127.0.0.1:10809/"
                  auto_highest_bandwidth=True, progress_bar_display=True, async_tasks_maintain=20, inspect_interval=3.,
                  failure_retries=5)

OR

import asyncio
import aiom3u8

async def main():
  await aiom3u8.download_coro(arguments...)
 
asyncio.run(main())

Parameter Description:

  • video_name_extension:   str   -  generated video type
  • params、cookies、headers:  dict   -  request with parameters
  • proxy:          str   -  used proxy address
  • auto_highest_bandwidth:  bool   -  whether to automatically select the highest quality when there are multiple adaptation streams
  • progress_bar_display:   bool   -  whether to show the download progress bar
  • async_tasks_maintain:   int   -  number of asynchronous tasks running concurrently
  • inspect_interval:    float   -  checking interval for adding new async tasks
  • failure_retries:      int   -  number of download connection failures allowed for a single file

About

async download video by m3u8 url

License:MIT License


Languages

Language:Python 100.0%