0x776b7364 / toggle.sg-download

Python script to automate Toggle.sg video downloads
MIT License
26 stars 18 forks source link

Python script to download mp4/m3u8/wvm files from toggle.sg.

This new and updated program:

Note: the project has entered Archival state in Nov 2020. Thanks for your support!

Usage

On Linux and Mac OS X, first make the script executable:

chmod +x download_toggle_video2.py

Then run the script with as many Toggle URLs as you want:

./download_toggle_video2.py http://video.toggle.sg/blah http://video.toggle.sg/blerk ...

Or, you can include 'episode' URLs as such:

./download_toggle_video2.py http://video.toggle.sg/blah http://tv.toggle.sg/en/channel8/shows/blerk/episodes ...

On Windows, if you installed Python from the official binaries, you should already have the necessary file associations, so the following command line should work from the script directory:

download_toggle_video2.py http://video.toggle.sg/blah http://video.toggle.sg/blerk ...

Debug mode can be enabled with the -d parameter like so:

./download_toggle_video2.py -d http://video.toggle.sg/blah

Tested with:

note: going forward I will only be testing the script on Linux and OSX. Sorry, Windows users. The script should still work as expected though.

Configuration Options

The following configuration option is directly editable in the script file:

FILE_PREFERENCES

Default: Highest to lowest priority: STB-ADD-IPAD-IPH

Specifies the download file format preference, in order.

For other options, run download_toggle_video2.py -h.

ffmpeg Dependency Notes

Windows

ffmpeg.exe must be located in the same folder as the Python script. Recent builds in Windows x64 can be found in https://ffmpeg.zeranoe.com/builds/win64/static/ .

Linux

On Ubuntu 12.04, the version of libav-tools in the repo is not updated for m3u8; hence, you'll need to build ffmpeg from source from git://source.ffmpeg.org/ffmpeg.git

Ubuntu 15.04+ has a sufficiently recent libav-tools in the stock repository.

Mac OS X

Install ffmpeg from Homebrew.

$ brew install ffmpeg

Note: there are many hardcoded values used, which could cause the script to break if Toggle changes their page structure

Reporting issues

Before reporting an issue, please make sure that your issue is still present with the latest copy of the script.

If the issue still persists, please run the script with the -d debug flag, like so:

$ ./download_toggle_video2.py -d http://video.toggle.sg/blah

The output should be pasted into either the issue form field, or into a Pastebin-like site, and the particular paste referenced in the issue.

To really make my day, provide the contents of the debug files by uploading them to said Pastebin-like site, and reference them in the issue as well. These files are automatically-created when the debug flag is present:

Also, please try to describe the issue in more detail especially in the title. Titles like "cannot work" or "cannot download anything" are not very useful (because.. you wouldn't be posting an issue if it was working).

Acknowledgements

This script would not be possible without the various contributors, and the people out there who submit bug reports. In particular, I'd like to thank:

Other

I'm aware that the youtube-dl project (https://github.com/rg3/youtube-dl/) has support for Toggle links. Consider using their program if my script does not work for you.