https://github.com/kedpter/M3u8Downloader
Python downloader for HTTP Live Streaming (HLS)
https://github.com/kedpter/M3u8Downloader
download header hls m3u8 python referer
Last synced: 11 months ago
JSON representation
Python downloader for HTTP Live Streaming (HLS)
- Host: GitHub
- URL: https://github.com/kedpter/M3u8Downloader
- Owner: kedpter
- License: mit
- Created: 2019-03-13T05:36:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T20:39:02.000Z (over 3 years ago)
- Last Synced: 2024-11-19T23:37:43.269Z (over 1 year ago)
- Topics: download, header, hls, m3u8, python, referer
- Language: Python
- Homepage:
- Size: 25.4 KB
- Stars: 36
- Watchers: 5
- Forks: 17
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
### M3u8-dl



M3u8-dl is a simple command-line util which downloads m3u8 file.
### Install
```bash
pip install m3u8-dl
```
### Usage
Get the HLS Request infomation from web browser with `Developer Tools`.
Such As `Request URL` and `Referer`.
```bash
# HLS_URL -> Request URL
# OUTPUT -> such as example.ts
m3u8-dl HLS_URL OUTPUT
# code below may not work since the website server may reject an out-of-date request
m3u8-dl https://proxy-038.dc3.dailymotion.com/sec\(4pkX4jyJ09RyW9jaEyekktbBu55uix9cMXQu-o5e13EelVKd1csb9zYSD66hQl7PlA_V5ntIHivm_tuQqkANmQj8DbX33OMJ5Db-9n67_SQ\)/video/795/864/249468597_mp4_h264_aac.m3u8 example.ts -u https://proxy-038.dc3.dailymotion.com/sec\(4pkX4jyJ09RyW9jaEyekktbBu55uix9cMXQu-o5e13EelVKd1csb9zYSD66hQl7PlA_V5ntIHivm_tuQqkANmQj8DbX33OMJ5Db-9n67_SQ\)/video/795/864/ -r https://www.dailymotion.com/video/x44iz79
# restore last session if the task was interrupted
m3u8-dl --restore
```
If you are failed to download the stream, try it again with the options below:
- Specify the Referer with `-r` when you're blocked by the website (403 forbidden).
- Specify the base url with `-u` when `#EXTINF hls-720p0.ts` has no base url in `output.m3u8`.
You can even make it run faster by using `-t`, which means how many threads you want to start.
`--restore` will restore the last session.
For more details, check `--help`.
### Notes
- Version 0.2.0
1. Add support to local m3u8 files. For example
```
m3u8-dl file:///Users/username/Downloads/master.m3u8 example.ts
```
2. Create a fake m3u8 file depends on ts range. For example
```
m3u8-dl -f master.m3u8 -r 1,100 --ts seg-@NUMBER-f1-v1-a1.ts?validfrom=1581996390&validto=1582003590&ip=89.187.161.206&hdl=-1&hash=rz91LEl6l%2FSZH83nXkv5BXzUhOQ%3D
```