Skip to main content

Videodl: A lightweight video downloader written in pure python

Project description


📄 Documents: videofetch.readthedocs.io

🌌 VideoDL Live Status Dashboard (VideoDL有效性实时监测)
Auto-updated every day via GitHub Actions, with ~3 randomly sampled preview clips.

demo

学习收获更多有趣的内容, 欢迎关注微信公众号:Charles的皮卡丘

🆕 What's New

  • 2025-12-23: Released videofetch v0.4.2 - introduce multiple new parsing endpoints.
  • 2025-12-19: Released videofetch v0.4.1 - added support for two general-purpose video parsing and downloading platforms, as well as one specific platform’s video parsing and downloading, and optimized the parsing and downloading for Xigua videos.
  • 2025-12-17: Released videofetch v0.4.0 - support parsing for more platforms; automatically enable N_m3u8DL-RE acceleration for all m3u8/HLS streams; and fix some bugs.
  • 2025-12-15: Released videofetch v0.3.9 - supports the SnapWC universal parsing API, and updated the CCTV M3U8 downloader to use N_m3u8DL-RE instead of the previous solution.
  • 2025-12-15: Released videofetch v0.3.8 - remove the general parsing endpoints that have switched to paid access, and add two free general parsing endpoints and make some improvements.

🚀 Introduction

A fast and lightweight video downloader built entirely in Python! 🚀 If you find this project useful, don't forget to star the repository and help us grow—your support means the world! 🙌

📜 Statement

This repository is created solely for learning purposes (commercial use is prohibited). All APIs used here are sourced from public networks. If you wish to download paid videos, please ensure you have a paid membership on the respective video platform (respect copyright, please!). If any content in this repository causes concerns or infringes on copyright, please reach out to me, and I’ll promptly remove it.

🎥 Supported Video Client

The video platforms currently supported for parsing are,

VideoClient (EN) VideoClient (CN) WeChat Article Search ParseURL Download Core Code
AcFunVideoClient A站 click ✔️ ✔️ acfun.py
PipigaoxiaoVideoClient 皮皮搞笑 click ✔️ ✔️ pipigaoxiao.py
PipixVideoClient 皮皮虾 click ✔️ ✔️ pipix.py
HaokanVideoClient 好看视频 click ✔️ ✔️ haokan.py
TedVideoClient TED视频 click ✔️ ✔️ ted.py
Ku6VideoClient 酷6网 click ✔️ ✔️ ku6.py
BilibiliVideoClient 哔哩哔哩 (B站) click ✔️ ✔️ bilibili.py
KuaishouVideoClient 快手 click ✔️ ✔️ kuaishou.py
YinyuetaiVideoClient 音悦台 (关停ing😭) click ✔️ ✔️ yinyuetai.py
BaiduTiebaVideoClient 百度贴吧 click ✔️ ✔️ baidutieba.py
MGTVVideoClient 芒果TV click ✔️ ✔️ mgtv.py
OasisVideoClient 新浪绿洲 click ✔️ ✔️ oasis.py
PearVideoClient 梨视频 click ✔️ ✔️ pear.py
HuyaVideoClient 虎牙视频 click ✔️ ✔️ huya.py
DuxiaoshiVideoClient 度小视 (全民小视频) click ✔️ ✔️ duxiaoshi.py
MeipaiVideoClient 美拍 click ✔️ ✔️ meipai.py
SixRoomVideoClient 六间房视频 click ✔️ ✔️ sixroom.py
WeishiVideoClient 微视 click ✔️ ✔️ weishi.py
ZuiyouVideoClient 最右 click ✔️ ✔️ zuiyou.py
XinpianchangVideoClient 新片场 click ✔️ ✔️ xinpianchang.py
WeSingVideoClient 全民K歌 click ✔️ ✔️ wesing.py
XiguaVideoClient 西瓜视频 click ✔️ ✔️ xigua.py
RednoteVideoClient 小红书 click ✔️ ✔️ rednote.py
WeiboVideoClient 微博视频 click ✔️ ✔️ weibo.py
CCTVVideoClient 央视网 click ✔️ ✔️ cctv.py
SohuVideoClient 搜狐视频 click ✔️ ✔️ sohu.py
YouTubeVideoClient 油管视频 click ✔️ ✔️ youtube.py
ZhihuVideoClient 知乎视频 click ✔️ ✔️ zhihu.py
KakaoVideoClient KakaoTV click ✔️ ✔️ kakao.py
YoukuVideoClient 优酷视频 click ✔️ ✔️ youku.py
TencentVideoClient 腾讯视频 click ✔️ ✔️ tencent.py
GeniusVideoClient Rap Genius (嘻哈百科) click ✔️ ✔️ genius.py
UnityVideoClient Unity click ✔️ ✔️ unity.py
FoxNewsVideoClient 福克斯新闻 click ✔️ ✔️ foxnews.py
SinaVideoClient 新浪视频 click ✔️ ✔️ sina.py
XuexiCNVideoClient 学习强国 click ✔️ ✔️ xuexicn.py
Open163VideoClient 网易公开课 click ✔️ ✔️ open163.py
CCtalkVideoClient CCtalk click ✔️ ✔️ cctalk.py
EyepetizerVideoClient 开眼视频 click ✔️ ✔️ eyepetizer.py
ArteTVVideoClient 德法公共电视网 click ✔️ ✔️ artetv.py
C56VideoClient 56视频网 click ✔️ ✔️ c56.py
RedditVideoClient 红迪网 click ✔️ ✔️ reddit.py
WWEVideoClient 世界摔角娱乐 click ✔️ ✔️ wwe.py

To make videodl more robust and able to adaptively parse videos from more websites, even when the video URL is not in the supported list above, I also plan to gradually add some general-purpose parsing interfaces. The currently supported generic parsers include:

CommonVideoClient (EN) CommonVideoClient (CN) ParseURL Download Core Code
IIILabVideoClient 兽音译者 ✔️ ✔️ iiilab.py
KedouVideoClient Kedou视频解析 ✔️ ✔️ kedou.py
SnapAnyVideoClient SnapAny万能解析 ✔️ ✔️ snapany.py
GVVIPVideoClient GreenVideoVIP视频解析 ✔️ ✔️ gvvip.py
VgetVideoClient Vget视频解析 ✔️ ✔️ vget.py
ILoveAPIVideoClient 我爱API ✔️ ✔️ iloveapi.py
XMFlvVideoClient 虾米解析 ✔️ ✔️ xmflv.py
QZXDPToolsVideoClient 全栈工具视频解析 ✔️ ✔️ qzxdptools.py
KuKuToolVideoClient KuKuTool视频解析 ✔️ ✔️ kukutool.py
LongZhuVideoClient 龙珠API视频解析 ✔️ ✔️ longzhu.py
XiazaitoolVideoClient 下载狗 ✔️ ✔️ xiazaitool.py
NoLogoVideoClient 去水印下载鸭 ✔️ ✔️ nologo.py
SnapWCVideoClient SnapWC视频解析 ✔️ ✔️ snapwc.py
BugPkVideoClient 短视频解析工具 ✔️ ✔️ bugpk.py
ZanqianbaVideoClient 考拉解析 ✔️ ✔️ zanqianba.py
CenguiguiVideoClient 聚合去水印 ✔️ ✔️ cenguigui.py
QingtingVideoClient 蜻蜓工具 ✔️ ✔️ qingting.py
BVVideoClient BestVideo下载器 ✔️ ✔️ bv.py

The default parsing order is to first use the parsers in the supported list. If those fail, the generic parsers are then invoked one by one until parsing succeeds.

📦 Install

You have three installation methods to choose from,

# from pip
pip install videofetch
# from github repo method-1
pip install git+https://github.com/CharlesPikachu/videodl.git@master
# from github repo method-2
git clone https://github.com/CharlesPikachu/videodl.git
cd videodl
python setup.py install

Some of the video downloaders supported by videodl rely on additional CLI tools to enable video decryption, stream parsing and downloading, accelerated stream downloading, and other extended features such as resuming interrupted downloads. Specifically, these CLI tools include,

  • FFmpeg: All video downloaders that need to handle HLS (HTTP Live Streaming) streams depend on FFmpeg. ❗ Therefore, we recommend that all videodl users install FFmpeg. ❗ Specifically, you need to ensure that, after installation, FFmpeg can be invoked directly from your system environment (i.e., it is on your PATH). A quick way to verify this is to open a terminal (or Command Prompt on Windows) and run,

    ffmpeg -version
    

    If the installation is correct, you should see detailed version information instead of a "command not found" or "'ffmpeg' is not recognized" error.

  • N_m3u8DL-RE: FFmpeg is a general-purpose media tool that can download standard HLS/m3u8 streams, but it assumes that the playlist and segment URLs strictly follow the protocol. N_m3u8DL-RE is a specialized m3u8 downloader that adds extensive logic for handling encryption, anti-leech headers, redirects, and malformed playlists, so it can capture many ‘protected’ or non-standard videos that FFmpeg fails on. In many cases it’s also faster, because N_m3u8DL-RE can download HLS segments in parallel with optimized retries/merging, while FFmpeg typically pulls segments sequentially by default. ❗ Therefore, we recommend that all videodl users install N_m3u8DL-RE to ensure videodl delivers the best possible performance. ❗ Of course, you can choose not to install it, but in that case you may not be able to use videodl to parse the following platforms,

    CCTVVideoClient, FoxNewsVideoClient, TencentVideoClient, GVVIPVideoClient, 
    SnapAnyVideoClient, VgetVideoClient, ArteTVVideoClient, XMFlvVideoClient, 
    RedditVideoClient, IIILabVideoClient, WWEVideoClient
    

    and downloads from many other sites that provide m3u8/HLS streams may also be significantly limited. As with FFmpeg, after installation you should make sure this tool can be run directly from the command line, i.e., its location is included in your system PATH. A quick way to check whether N_m3u8DL-RE has been installed successfully is to open a terminal (or Command Prompt on Windows) and run:

    N_m3u8DL-RE --version
    

    If N_m3u8DL-RE is installed correctly, N_m3u8DL-RE --version will print the N_m3u8DL-RE version (e.g., 0.5.1+c1f6db5639397dde362c31b31eebd88c796c90da). If you see a similar command not found / not recognized error, N_m3u8DL-RE is not installed correctly or not available on your PATH.

  • CBox: CBox is an optional dependency for CCTVVideoClient. It helps prevent garbled output when downloading HD streams, which can happen when the m3u8 playlist is encrypted. To enable it, download CBox from the GitHub release above and add the CBox folder to your system PATH. If you intend to use CCTVVideoClient, you should also install FFmpeg and N_m3u8DL-RE and ensure they are available on your PATH as well. If you’re not using CCTVVideoClient for HD downloads, you can skip the CBox setup entirely. To verify your setup, these commands should print the full executable paths (instead of returning nothing):

    python -c "import shutil; print(shutil.which('cbox'))"
    python -c "import shutil; print(shutil.which('N_m3u8DL-RE'))"
    python -c "import shutil; print(shutil.which('ffmpeg'))"
    
  • Node.js: Currently, Node.js is only used in YouTubeVideoClient to execute certain JavaScript code for video parsing. Therefore, if you don’t need to use YouTubeVideoClient, you can safely skip installing this CLI tool. A quick way to check whether Node.js has been installed successfully is to open a terminal (or Command Prompt on Windows) and run:

    node -v (npm -v)
    

    If Node.js is installed correctly, node -v will print the Node.js version (e.g., v22.11.0), and npm -v will print the npm version. If you see a similar command not found / not recognized error, Node.js is not installed correctly or not available on your PATH.

  • aria2c: videodl now also supports manually integrating aria2c to accelerate downloads (for example, MP4 files) and to enable resuming interrupted video downloads, etc. Before using this feature, you must ensure that aria2c is available on the system PATH in your runtime environment. You can verify this by opening a terminal and running aria2c --version (or aria2c -v); if the command returns version information instead of a “command not found” error, then aria2c is correctly installed and detectable. On Linux/macOS you can also run which aria2c, and on Windows where aria2c, to confirm that the executable can be found. To enable aria2c during video downloading, please refer to the Quick Start section.

⚡ Quick Start

After a successful installation, you can run the snippet below,

from videodl import videodl

video_client = videodl.VideoClient()
video_client.startparseurlcmdui()

Or just run videodl -i "URL" (maybe videodl --help to show usage information) from the terminal.

Usage: videodl [OPTIONS]

Options:
  --version                       Show the version and exit.
  -i, --index-url, --index_url TEXT
                                  URL of the video to download. If not
                                  specified, videodl will start in terminal
                                  mode.
  -a, --allowed-video-sources, --allowed_video_sources TEXT
                                  Platforms to search. Separate multiple
                                  platforms with "," (e.g.,
                                  "AcFunVideoClient,PipixVideoClient"). If not
                                  specified, videodl will search all supported
                                  platforms globally and use the first one
                                  that can download the video url.
  -c, --init-video-clients-cfg, --init_video_clients_cfg TEXT
                                  Config such as `work_dir` for each video
                                  client as a JSON string.
  -r, --requests-overrides, --requests_overrides TEXT
                                  Requests.get kwargs such as `headers` and
                                  `proxies` for each video client as a JSON
                                  string.
  -t, --clients-threadings, --clients_threadings TEXT
                                  Number of threads used for each video client
                                  as a JSON string.
  -g, --apply-common-video-clients-only, --apply_common_video_clients_only
                                  Only apply common video clients.
  --help                          Show this message and exit.

The demonstration is as follows,


Recommended parsing and downloading commands for some widely used video platforms are as follows:

# IQIYI / YOUKU / TENCENT (爱奇艺, 优酷, 腾讯视频)
videodl -i "IQIYI/YOUKU/TENCENT VIDEO URL" -g -a XMFlvVideoClient
# MIGU (咪咕视频)
videodl -i "MIGU VIDEO URL" -g -a KedouVideoClient
# DOUYIN / TIKTOK / KUAISHOU / XIAOHONGSHU (抖音, 抖音海外, 快手, 小红书等短视频)
videodl -i "DOUYIN/TIKTOK/KUAISHOU/XIAOHONGSHU VIDEO URL" -g -a SnapWCVideoClient
videodl -i "DOUYIN/TIKTOK/KUAISHOU/XIAOHONGSHU VIDEO URL" -g -a KedouVideoClient
videodl -i "DOUYIN/TIKTOK/KUAISHOU/XIAOHONGSHU VIDEO URL" -g -a KuKuToolVideoClient
videodl -i "DOUYIN/TIKTOK/KUAISHOU/XIAOHONGSHU VIDEO URL" -g -a NoLogoVideoClient
videodl -i "DOUYIN/TIKTOK/KUAISHOU/XIAOHONGSHU VIDEO URL" -g -a IIILabVideoClient
...
# CCTV (央视网)
videodl -i "CCTV VIDEO URL" -a CCTVVideoClient
# YOUTUBE (油管)
videodl -i "YOUTUBE VIDEO URL" -a YouTubeVideoClient
# BILIBILI (B站)
videodl -i "BILIBILI VIDEO URL" -a BilibiliVideoClient

In fact, the general-purpose video parsers in the support list can be used to parse and download videos from most widely used platforms. The main difference is usually the resolution/quality of the downloaded video. If you care about video quality, you can try different general-purpose parsers, compare the results yourself, and you’re also welcome to share your findings in the repo’s Discussions section.

If you just want to parse a video link and retrieve information about the video, you can do it like this,

from videodl import videodl

video_client = videodl.VideoClient()
video_infos = video_client.parsefromurl("https://v.youku.com/v_show/id_XNDUxOTc1NDg4MA==.html?spm=a2hkl.14919748_WEBHOME_HOME.scg_scroll_3.d_2_play&s=faab858435f24d5bb6d3&scm=20140719.rcmd.feed.show_faab858435f24d5bb6d3&alginfo=-1reqId-249a939e8%203783%204341%2099d9%20974d2b07ad23%231764142230027-1seqId-20IX2riz0CjZG971l-1abId-2468080-1sceneId-246595&scg_id=22896555")
print(video_infos)

The output of this code looks like,

[
  {
    "source": "YoukuVideoClient",
    "raw_data": {
      "cost": 0.020000001,
      ...
    },
    "download_url": "http://pl-ali.youku.com/playlist/m3u8?vid=XNDUxOTc1NDg4MA%3D%3D&type=mp4hd2v3&ups_client_netip=725c13f7&utid=dJytIY%2Bx4WYCAXJcE%2Few6YTM&ccode=0564&psid=2fb1945e5c8cc1b213f831c70ace818841346&duration=2205&expire=18000&drm_type=1&drm_device=0&drm_default=1&dyt=0&ups_ts=1764142708&onOff=0&encr=0&ups_key=f30ad69f9025369053e0932bfe1d2276&ckt=3&m_onoff=0&pn=&drm_type_value=default&v=v1&bkp=0",
    "title": "史家绝唱",
    "file_path": "videodl_outputs\\YoukuVideoClient\\史家绝唱.m3u",
    "ext": "m3u",
    "download_with_ffmpeg": true,
    "err_msg": "NULL",
    "identifier": "XNDUxOTc1NDg4MA==",
    "guess_video_ext_result": {
      "ext": "m3u",
      "sniffer": "requests.head",
      "ok": true
    }
  }
]

Then you can also call the video downloading function to download the video parsed by videodl. The code is as follows:

from videodl import videodl

video_client = videodl.VideoClient()
video_infos = video_client.parsefromurl("https://v.youku.com/v_show/id_XNDUxOTc1NDg4MA==.html?spm=a2hkl.14919748_WEBHOME_HOME.scg_scroll_3.d_2_play&s=faab858435f24d5bb6d3&scm=20140719.rcmd.feed.show_faab858435f24d5bb6d3&alginfo=-1reqId-249a939e8%203783%204341%2099d9%20974d2b07ad23%231764142230027-1seqId-20IX2riz0CjZG971l-1abId-2468080-1sceneId-246595&scg_id=22896555")
video_client.download(video_infos=video_infos)

If you want to use aria2c to accelerate the download of non-HLS/m3u8 streams, such as mp4 files, you can do the following:

from videodl import videodl

video_client = videodl.VideoClient()
video_infos = video_client.parsefromurl("https://www.bilibili.com/video/BV1KZgHzJEs6/?spm_id_from=333.337.search-card.all.click")
for v in video_infos: v['download_with_aria2c'] = True
video_client.download(video_infos=video_infos)

If you want to use N_m3u8DL-RE to speed up the download of HLS/m3u8 streams, you can do the following (starting from videofetch 0.4.0, as long as the environment variables include N_m3u8DL-RE, the program will automatically invoke N_m3u8DL-RE to accelerate video downloads.):

from videodl import videodl

video_client = videodl.VideoClient()
video_infos = video_client.parsefromurl("https://www.acfun.cn/v/ac36491489")
for v in video_infos: v['enable_nm3u8dlre'] = True
video_client.download(video_infos=video_infos)

If you know that the video you want to parse is definitely not in the supported list and you want to use the generic parser directly, you can set apply_common_video_clients_only to True, e.g., just run videodl -i "URL" -g from the terminal, or coding as following,

from videodl import videodl

video_client = videodl.VideoClient(apply_common_video_clients_only=True)
video_client.startparseurlcmdui()

If you’re a VIP member of a video platform, such as Tencent Video, you can try the following code to improve the quality of the videos you download:

from videodl import videodl

your_vip_cookies_with_str_or_dict_format = ""
init_video_clients_cfg = dict()
init_video_clients_cfg['TencentVideoClient'] = {'default_parse_cookies': your_vip_cookies_with_str_or_dict_format, 'default_download_cookies': your_vip_cookies_with_str_or_dict_format}
video_client = videodl.VideoClient(init_video_clients_cfg=init_video_clients_cfg)
video_client.startparseurlcmdui()

Alternatively, you can run the following command directly in the terminal:

videodl -i "URL" -c "{'TencentVideoClient': {'default_parse_cookies': your_vip_cookies_with_str_or_dict_format, 'default_download_cookies': your_vip_cookies_with_str_or_dict_format}}"

Of course, you can also choose a general-purpose parser that supports VIP video parsing to achieve video extraction, for example:

videodl -i "IQIYI/YOUKU/TENCENT VIDEO URL" -g -a XMFlvVideoClient

If you want to speed up the parsing, you can try specifying the parser used for the video you’re downloading. For example, when downloading a Douyin / TikTok video, you can run the command like this:

videodl -i "https://www.douyin.com/jingxuan?modal_id=7578412593719577899" -g -a "KedouVideoClient"
videodl -i "https://www.douyin.com/jingxuan?modal_id=7580605435187596559" -g -a "SnapWCVideoClient"
videodl -i "https://www.tiktok.com/@mustsharenews/video/7581408863128161552?lang=en" -g -a "SnapWCVideoClient"

💡 Recommended Projects

Project ⭐ Stars 📦 Version ⏱ Last Update 🛠 Repository
🎵 Musicdl
轻量级无损音乐下载器
Stars Version Last Commit 🛠 Repository
🎬 Videodl
轻量级高清无水印视频下载器
Stars Version Last Commit 🛠 Repository
🖼️ Imagedl
轻量级海量图片搜索下载器
Stars Version Last Commit 🛠 Repository
🌐 FreeProxy
全球海量高质量免费代理采集器
Stars Version Last Commit 🛠 Repository
🌐 MusicSquare
简易音乐搜索下载和播放网页
Stars Version Last Commit 🛠 Repository
🌐 FreeGPTHub
真正免费的GPT统一接口
Stars Version Last Commit 🛠 Repository

📚 Citation

If you use this project in your research, please cite the repository.

@misc{videodl2021,
    author = {Zhenchao Jin},
    title = {Videodl: A lightweight video downloader written in pure python},
    year = {2021},
    publisher = {GitHub},
    journal = {GitHub repository},
    howpublished = {\url{https://github.com/CharlesPikachu/videodl/}},
}

🌟 Star History

Star History Chart

☕ Appreciation (赞赏 / 打赏)

WeChat Appreciation QR Code (微信赞赏码) Alipay Appreciation QR Code (支付宝赞赏码)

📱 WeChat Official Account (微信公众号)

Charles的皮卡丘 (Charles_pikachu)
img

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

videofetch-0.4.2.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

videofetch-0.4.2-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

Details for the file videofetch-0.4.2.tar.gz.

File metadata

  • Download URL: videofetch-0.4.2.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for videofetch-0.4.2.tar.gz
Algorithm Hash digest
SHA256 34a39d1829feda13d5ad3baa4ec1f2a7fe34de65d8dc816eaa09815690ad22b6
MD5 fcd3750eee4ca34ded990de265c1a0c4
BLAKE2b-256 2ea46ceb8d6f952619314e462a61d7cf00339fe493cabebced5f734795ee3279

See more details on using hashes here.

File details

Details for the file videofetch-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: videofetch-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for videofetch-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7247849dc83015ce73c3e40c3f08a6c0483b134fa443437a543979b0bc088cc2
MD5 079a3ba8336984da05d5dcab60393e57
BLAKE2b-256 fb883a04019d58f6483d23a536dbd804f63fd721f842a1df45e600c4ff25e595

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page