Skip to main content

CLI Tool/Client Library for twist.moe

Project description

Twist.Moe Downloader Helper

Description

This is a small python tool for downloading video contents of series available on the website twist.moe locally. To download a particular series, use the series's url like so https://twist.moe/a/made-in-abyss and to search for a series enter a part of its name as found in a twist.moe's url string like fate.

Additional to the commandline interface this package also provides a pure python object oriented api for twist.moe.

Remember to support twist.moe with donations if you can, as they do a great job of operating their site!

Installation

The scripts has been tested against python 2.7 and 3.7. Simply install the requirements.txt to complete installation. I encourage you to use a virtualenv here if you can.

$ git clone https://github.com/JFryy/twist-moe-downloader.git
$ cd twist-moe-downloader
$ sudo pip install -r requirements.txt

And you're done! You can started with something as simple as the command below.

$ python cli.py fate

Running the script

$ python cli.py

usage: python cli.py [title] [--range RANGE][--directory DIRECTORY] [-h]

Twist-dl is a small python tool for downloading video contents of series
available on the website twist.moe locally! To download a list of particular
series, enter a keyword of the series name. i.e. 'code geass' can be found by
simply entering 'code'.

positional arguments:
  title                 To download a particular series, use the series's url
                        like so "https://twist.moe/a/made-in-abyss" and to
                        search for a series enter a part of its name as found
                        in a twist.moe's url string like "fate".

optional arguments:
  -h, --help            show this help message and exit
  --directory DIRECTORY
                        Directory path to save downloaded contents
  --range RANGE         Range of episodes to download. i.e. --range=1-24 or
                        for a single episode --range=1

Example Usage:

Search and download with CLI

Download by passing the series title as found from search. Not specifying a range with --range will prompt you with to a enter range. If no range is entrered all episodes will be downloaded.

$ python cli.py code
? Anime(s) found. Please choose a series to download:  Code Geass: Hangyaku no Lelouch R2
Episode selection between 1-25. To download a range enter "1-5", for a single episode enter "5" or leave it empty press "Enter" to download all episodes.
Input: 1-5
anime/code-geass-hangyaku-no-lelouch-r2/Code Geass: Hangyaku no Lelouch R2 - 01.mp4:   6%|| 30/478 [00:12<03:13,  2.32MB/s]
...

Search and download with API

from pathlib import Path
from twistdl import TwistDL

client = TwistDL()
animes = client.search_animes(title='code geass')

for anime in animes:
    for episode in anime.episodes:
        file = Path(f'anime/{anime.slug_name}/{anime.title} - {episode.number}')
        print(f'{anime.title} - {episode.number}')
        file.parent.mkdir(exist_ok=True, parents=True)
        episode.download(file)
Disclaimer

Downloading copyright videos may be illegal in your country. This tool is for educational purposes only.

Project details


Download files

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

Files for twistdl, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size twistdl-1.1-py2.py3-none-any.whl (10.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size twistdl-1.1.tar.gz (7.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page