M3u8 Downloader
A multithread m3u8 download module and the number of threads can decide by yourself. using how many threads is decide by your network and your device.
Github : https://github.com/walkureHHH/M3u8-Downloader/
1. Install
pip install mder
2. Import
import mder
3. Instance object and start download
downloader = mder.m3u8_downloader(m3u8_file_path='./test.m3u8',temp_file_path='./',mp4_path='./test.mp4',num_of_threads=10)
# parameters
# 1.m3u8_file_path
# default : no default (type : str)
# 2.temp_file_path
# default : '.' (type : str)
# 3.mp4_path
# default : './test.mp4' (type : str)
# 4.num_of_threads
# default : 10 (type : int)
downloader.start()
# parameters
# 1.mod
# default : 0 (type : int)
# mod 0 means delete TS folder and m3u8 file if download completely
# mod 1 means delete m3u8 file only if download completely
# mod 2 means delete TS folder only if download completely
# mod 3 means reserve TS folder and m3u8 file if download completely
# 2.time_out
# default : 60 (type : int)(units : seconds)
# The time_out is the timeout in request.get(timeout=)
before download
the structure of ./ is:
.
├── test.m3u8
└── test.py
when it is downloading
the structure of ./ is:
.
├── TS
│ ├── qzCFnDUZE9_720_5308_0000.ts
│ ├── qzCFnDUZE9_720_5308_0001.ts
│ ├── qzCFnDUZE9_720_5308_0002.ts
│ ├── qzCFnDUZE9_720_5308_0003.ts
│ ├── qzCFnDUZE9_720_5308_0004.ts
│ ├── qzCFnDUZE9_720_5308_0005.ts
│ ├── qzCFnDUZE9_720_5308_0006.ts
│ ├── qzCFnDUZE9_720_5308_0007.ts
│ ├── qzCFnDUZE9_720_5308_0008.ts
│ ├── qzCFnDUZE9_720_5308_0009.ts
│ └── qzCFnDUZE9_720_5308_0010.ts
├── test.m3u8
└── test.py
process bar: <<*>> 29% 500/1752 [01:33<04:02] <<*>>
TS is temp folder, all .ts file are in it. The path of it is %temp_file_path%/TS, in the test case, it is in ./TS. If the mission is not complete, the m3u8 file and TS folder will be reserved, you can instance a new downloader with corresponding TS folder and m3u8 file, and use the start() function to begin, in this way, the mission will go on.
after download and download successfully
the structure of ./ is:
.
├── test.mp4
└── test.py
If some .ts download failed, the module will redownload for 4 times, and the information will print to the command line
at last, the command line is like this:
<<*>> 99% 1737/1752 [05:35<00:22] <<*>>
thread0 Time out ERROR qzCFnDUZE9_720_5308_1710.ts
thread2 Time out ERROR qzCFnDUZE9_720_5308_1722.ts
thread0 redownload successfully qzCFnDUZE9_720_5308_1710.ts
<<*>> 99% 1738/1752 [06:20<03:19] <<*>>
thread2 redownload successfully qzCFnDUZE9_720_5308_1722.ts
<<*>> 100% 1752/1752 [06:26<00:00] <<*>>
downloading finished 100.00%
if complete
The attribute if_complete of class M3u8_Download can used to find if the download is conplete. In this example, we can use
a = downloader.if_complete # a == False means the downloading is incomplete.
5. restart
If you want to restart a incomplete mission, you only should use the corresponding TS folder and .m3u8 file.
Metadata
Release files for mder 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mder-1.0.2.tar.gz | 4.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mder-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / mder-1.0.2.tar.gz
| Download URL | mder-1.0.2.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db63c78555d29e9f49d7296572a1bd8055ed613186c8fddb9a7e9749d7d36b54
|
|
BLAKE2b-256 checksum How to use checksums |
d25d1a9bdf99c1716f62d512d5d308510dcf9a7b50707233460504c974533c2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
|
Release files / mder-1.0.2-py3-none-any.whl
| Download URL | mder-1.0.2-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a2ca02b4c35158ab5587d8a2ce7f561c41efc168363ce04b7b4201747214fd0
|
|
BLAKE2b-256 checksum How to use checksums |
a7c2bd96c0a6e828b1bc66add959688db435b6dc2763ee02f3fb997f9c3672a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
|
Security for mder 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.