Welcome to Simple Manga Downloader’s documentation!¶
Introduction¶
smd is a tool to search and download manga from web sites, with support for several sites and manga translated to several languages.
This are some of the features of smd:
- You can download and keep updated your favorite mangas for offline reading in your favorite manga reader application, without all that ads that are common in manga web sites.
- smd only download the necessary files, so it saves bandwidth and it is faster than reading manga online.
- smd never forgets a download, so you can cancel your download at any time and the next time you run the program, you can continue the canceled download from the same point it was.
- Also downloaded ongoing mangas can be updated to get the new released chapters.
- Besides having mangas in multiple languages, smd itself has a multilingual interface.
- It is configurable.
- smd is free software, and it always will be. For more information see License.
To get started with smd read the Tutorial.
Tutorial¶
This tutorial will give you some advice on how to install and use the smd application.
Requirements¶
To use smd you need to have Python 3 installed in your machine. To know if you have python installed run the following command in your terminal:
$ python3 --version
If you don’t see a message like “Python 3.X.X
” you have to install Python 3, for help installing it, read this python installation guide.
Installation¶
The more easy way to install smd is using pip
, open your terminal and execute the following command:
$ pip3 install smd
or
$ python3 -m pip install smd
To install smd from source extract the file smd-X.X.X.tar.gz
(where X represents the version numbers), then open your terminal inside the extracted folder and execute the following command:
$ python3 setup.py install
Once installed, the command smd
should be available in your terminal. To test if the application was installed correctly, run the following command:
$ smd --help
or
$ python3 -m smd --help
You should see the smd help.
Note
If you have troubles with the installation read this tutorial about installing packages in python.
Upgrading¶
To check for new versions of smd and upgrade it use the following command:
$ pip3 install --upgrade smd
or
$ python3 -m pip install --upgrade smd
Quick start¶
This section have some examples to showcase the most common uses of smd.
To select site and manga interactively just run:
$ smd
To select site interactively and search (and download) ‘One Piece’:
$ smd 'One Piece'
To search mangaall.net for mangas containing the word ‘love’ in its name, and select which one to download interactively:
$ smd -s mangaall love
To select a site with English language, and search/download ‘Bleach’:
$ smd --lang en Bleach
To download from chapter 10th to 20th (ignoring chapter 15th) of ‘Naruto’:
$ smd --chapters '10:20,!15' Naruto
Warning
Chapters are enumerated based on they order in the chapter list, so this number may not match the chapter title (e.g. if there are a chapter named “15.5” actually it is the chapter 16 in the list and you should use “smd --chapter 16
” to download it)
To download from first chapter to 10th and the last chapter of ‘Death Note’:
$ smd --chapters :10,-1 'Death Note'
To select from a list of previously canceled downloads and continue with them:
$ smd --continue
To continue with the given previously canceled downloads:
$ smd --continue /path/to/the/canceled/download
To select from a list of previously downloaded ongoing mangas and update them:
$ smd --update
To list all supported sites that you can use with the option -s
:
$ smd -l
To list supported Spanish sites:
$ smd --lang es -l
To see all available options use:
$ smd -h
SMD data folder¶
smd creates a folder called smd
in your user home folder (on GNU/Linux it is /home/<your user name>
on Windows it is C:\Users\<your user name>
). Inside this folder is located some useful files like the smd is configuration file and the log files that keep track of errors.
Configuration File¶
The configuration file is named smd.cfg
. At the time the only configurable options are:
language
: this set the language of the application, can be set toen
(English),es
(Spanish) orSYSTEM
(to use the language of the system, this is the default).manga_dir
: use this option to set the path to the folder where the program should download and look for manga folders, by default is set to ‘.’ (dot) which means that the current working directory will be used.
Log files¶
The log of the more recent execution will be saved on smd.log
, when the size of this file grows the older logs are moved to smd.log.1
.
Simple Manga Downloader Changelog¶
Version 1.6.0¶
Released on July 31, 2018
- New: Now
smd
is smarter, it keeps metadata about the mangas and remember download status, downloading only missing or incomplete chapters, also useful to download new chapters from ongoing mangas. - New: Added option
--update
(to get new chapters for ongoing mangas). - New: Added option
--continue
(to resume a canceled manga download). - New: Now
smd
have a multilingual interface, currently only English and Spanish languages are supported. - New: Added configuration file to configure language, folder where to find and save mangas, etc.
- New: Added documentation to the project and integrated it with Read the Docs.
- New: Updated
tests
module.
Version 1.5.0¶
Released on July 18, 2018
- New: Added new option
-d
or--directory
to set the place where to save mangas (default: working directory). - Fix: If the manga title or chapter title are an invalid folder name, ask the user for a new name instead of crashing.
- New: Removed
--start
and--stop
options in favor of a more powerful--chapters
option. Now use--chapters 10:20
instead of--start 10 --stop 20
. - New: Log file now moved to
[USER HOME]/smd/smd.log
and log size limited. - New: Now exception traces are sent only to log file and small messages to console.
- New: Added
--verbose
option to make the program print debug messages and error stack traces. - Fix: On ConnectionResetError retry only a fixed number of times.
- New: Added new package to the project:
tests
for unit testing.
Previous versions¶
Changes to previous versions were not tracked.
The smd API reference¶
smd is a tool to search and download manga from online manga reading web sites.
-
smd.
get_args_parser
(version)¶ Creates an arguments parser for the program is command line interface.
Parameters: version (str) – the application is version number. Return type: argparse.ArgumentParser
-
smd.
show_copyright
()¶ Shows copyright notice.
smd.downloader¶
This module provides the downloaders able to grab content from the supported sites.
-
class
smd.downloader.
Downloader
(name, lang, site_url)¶ Abstract class base of all manga downloaders.
-
download
(manga, chapter_selectors=None)¶ Searches for the given manga and, if found, chapters specified in
chapter_selectors
are downloaded.Parameters: - manga (str) – the manga to download.
- chapter_selectors (str) – a string specifying the chapters to download.
Returns: True
if the manga was downloaded successfully,False
otherwise.
-
download_img
(url, name)¶ Receives an image URL and a filename (without a file extension) and downloads the image, detects image format and save it to the given filename plus the proper extension.
Parameters: - url (str) – the URL of the image.
- name (str) – the name to use for the saved image (without file extension)
Returns: the file name with file extension of the downloaded image.
Return type: str
-
get
(url, data=None, method='GET', xhr=False, decode=True)¶ Retrieves data from given URL.
Parameters: - url (str) – the URL to retrieve.
- data (dict) – the data to send with the request.
- method (str) – the method to use to request the URL (POST/GET).
- xhr (bool) – if
True
set the header ‘X-Requested-With’ to ‘XMLHttpRequest’ - decode (bool) – if
True
decode the response data.
Returns: the response data.
Raises: ConnectionResetError – if the connection is reset more than five times.
-
get_chapters
(manga_url)¶ Extracts the manga chapters from the given manga URL.
Parameters: manga_url (str) – the URL of a manga. Returns: a list of tuples each one with two strings: the title and URL of a chapter from the given manga.
-
classmethod
get_image
(image_url)¶ If needed, extracts the image link from the given URL.
Parameters: image_url (str) – the image URL or an URL to a page where the image link can be extracted. Returns: the image URL. Return type: str
-
get_images
(chapter_url)¶ Extracts the images links from a chapter URL.
Parameters: chapter_url (str) – the URL of a manga chapter. Returns: list of image URLs for the given chapter, or a list of URLs where the images can be extracted using get_image()
.
-
get_json
(url, data=None, method='GET')¶ Request json data from the given url.
Parameters: - url (str) – the URL to request.
- data (dict) – the data to send in the request.
- method (str) – the method to use for the request.
Returns: the response data object.
-
resume
(manga)¶ Continues with the (unfinished) download of the given manga.
Parameters: manga ( Manga
) – the manga to continue downloading.Returns: the number of resumed mangas. Return type: int
-
search
(manga)¶ Searches for mangas matching the given text.
Parameters: manga (str) – a frase or manga title to search. Returns: a list of tuples each one with two strings: the title and URL of a matched manga.
-
-
class
smd.downloader.
HeavenManga
¶ Downloads manga from heavenmanga.com.
-
get_chapters
(manga_url)¶ Extracts the manga chapters from the given manga URL.
Parameters: manga_url (str) – the URL of a manga. Returns: a list of tuples each one with two strings: the title and URL of a chapter from the given manga.
-
get_image
(image_url)¶ If needed, extracts the image link from the given URL.
Parameters: image_url (str) – the image URL or an URL to a page where the image link can be extracted. Returns: the image URL. Return type: str
-
get_images
(chapter_url)¶ Extracts the images links from a chapter URL.
Parameters: chapter_url (str) – the URL of a manga chapter. Returns: list of image URLs for the given chapter, or a list of URLs where the images can be extracted using get_image()
.
-
search
(manga)¶ Searches for mangas matching the given text.
Parameters: manga (str) – a frase or manga title to search. Returns: a list of tuples each one with two strings: the title and URL of a matched manga.
-
-
class
smd.downloader.
MangaAll
¶ Downloads manga from mangaall.net.
-
get_chapters
(manga_url)¶ Extracts the manga chapters from the given manga URL.
Parameters: manga_url (str) – the URL of a manga. Returns: a list of tuples each one with two strings: the title and URL of a chapter from the given manga.
-
get_image
(image_url)¶ If needed, extracts the image link from the given URL.
Parameters: image_url (str) – the image URL or an URL to a page where the image link can be extracted. Returns: the image URL. Return type: str
-
get_images
(chapter_url)¶ Extracts the images links from a chapter URL.
Parameters: chapter_url (str) – the URL of a manga chapter. Returns: list of image URLs for the given chapter, or a list of URLs where the images can be extracted using get_image()
.
-
search
(manga)¶ Searches for mangas matching the given text.
Parameters: manga (str) – a frase or manga title to search. Returns: a list of tuples each one with two strings: the title and URL of a matched manga.
-
-
class
smd.downloader.
MangaDoor
¶ Downloads manga from mangadoor.com.
-
get_chapters
(manga_url)¶ Extracts the manga chapters from the given manga URL.
Parameters: manga_url (str) – the URL of a manga. Returns: a list of tuples each one with two strings: the title and URL of a chapter from the given manga.
-
get_image
(image_url)¶ If needed, extracts the image link from the given URL.
Parameters: image_url (str) – the image URL or an URL to a page where the image link can be extracted. Returns: the image URL. Return type: str
-
get_images
(chapter_url)¶ Extracts the images links from a chapter URL.
Parameters: chapter_url (str) – the URL of a manga chapter. Returns: list of image URLs for the given chapter, or a list of URLs where the images can be extracted using get_image()
.
-
search
(manga)¶ Searches for mangas matching the given text.
Parameters: manga (str) – a frase or manga title to search. Returns: a list of tuples each one with two strings: the title and URL of a matched manga.
-
-
class
smd.downloader.
MangaHere
¶ Downloads manga from www.mangahere.cc.
-
get_chapters
(manga_url)¶ Extracts the manga chapters from the given manga URL.
Parameters: manga_url (str) – the URL of a manga. Returns: a list of tuples each one with two strings: the title and URL of a chapter from the given manga.
-
get_image
(image_url)¶ If needed, extracts the image link from the given URL.
Parameters: image_url (str) – the image URL or an URL to a page where the image link can be extracted. Returns: the image URL. Return type: str
-
get_images
(chapter_url)¶ Extracts the images links from a chapter URL.
Parameters: chapter_url (str) – the URL of a manga chapter. Returns: list of image URLs for the given chapter, or a list of URLs where the images can be extracted using get_image()
.
-
search
(manga)¶ Searches for mangas matching the given text.
Parameters: manga (str) – a frase or manga title to search. Returns: a list of tuples each one with two strings: the title and URL of a matched manga.
-
-
class
smd.downloader.
MangaNelo
¶ Downloads manga from manganelo.com.
-
get_chapters
(manga_url)¶ Extracts the manga chapters from the given manga URL.
Parameters: manga_url (str) – the URL of a manga. Returns: a list of tuples each one with two strings: the title and URL of a chapter from the given manga.
-
get_images
(chapter_url)¶ Extracts the images links from a chapter URL.
Parameters: chapter_url (str) – the URL of a manga chapter. Returns: list of image URLs for the given chapter, or a list of URLs where the images can be extracted using get_image()
.
-
search
(manga)¶ Searches for mangas matching the given text.
Parameters: manga (str) – a frase or manga title to search. Returns: a list of tuples each one with two strings: the title and URL of a matched manga.
-
-
class
smd.downloader.
MangaReader
¶ Downloads manga from www.mangareader.net.
-
get_chapters
(manga_url)¶ Extracts the manga chapters from the given manga URL.
Parameters: manga_url (str) – the URL of a manga. Returns: a list of tuples each one with two strings: the title and URL of a chapter from the given manga.
-
get_image
(image_url)¶ If needed, extracts the image link from the given URL.
Parameters: image_url (str) – the image URL or an URL to a page where the image link can be extracted. Returns: the image URL. Return type: str
-
get_images
(chapter_url)¶ Extracts the images links from a chapter URL.
Parameters: chapter_url (str) – the URL of a manga chapter. Returns: list of image URLs for the given chapter, or a list of URLs where the images can be extracted using get_image()
.
-
search
(manga)¶ Searches for mangas matching the given text.
Parameters: manga (str) – a frase or manga title to search. Returns: a list of tuples each one with two strings: the title and URL of a matched manga.
-
-
class
smd.downloader.
NineManga
(site)¶ Downloads manga from ninemanga.com.
-
get_chapters
(manga_url)¶ Extracts the manga chapters from the given manga URL.
Parameters: manga_url (str) – the URL of a manga. Returns: a list of tuples each one with two strings: the title and URL of a chapter from the given manga.
-
get_image
(image_url)¶ If needed, extracts the image link from the given URL.
Parameters: image_url (str) – the image URL or an URL to a page where the image link can be extracted. Returns: the image URL. Return type: str
-
get_images
(chapter_url)¶ Extracts the images links from a chapter URL.
Parameters: chapter_url (str) – the URL of a manga chapter. Returns: list of image URLs for the given chapter, or a list of URLs where the images can be extracted using get_image()
.
-
search
(manga)¶ Searches for mangas matching the given text.
Parameters: manga (str) – a frase or manga title to search. Returns: a list of tuples each one with two strings: the title and URL of a matched manga.
-
-
smd.downloader.
get_downloaders
()¶ Creates a list with instances of all supported downloaders.
Returns: the list of all supported downloaders. Return type: list of Downloader
smd.utils¶
This module provides utility functions and classes.
-
class
smd.utils.
Chapter
(path, title=None, url=None)¶ Class representing a chapter folder.
-
static
from_folder
(path)¶ Creates a
Chapter
instance from a folder path.Parameters: path (str) – the path to the chapter folder. Returns: the created Chapter
instance.
-
classmethod
is_chapter
(chapter_path)¶ Checks whether the given folder is a chapter folder or not.
Parameters: chapter_path (str) – path to a folder. Returns: True
if the given folder is a chapter,False
otherwise.
-
save_data
()¶ Saves chapter meta data.
-
static
-
class
smd.utils.
Config
(path)¶ Class to manage the configuration of
smd
-
exists
()¶ Checks if the configuration file already exists.
Returns: True
if the configuration file exists,False
otherwise.
-
load
()¶ Loads the configuration from disk.
Returns: a list with the loaded configuration files.
-
reset
()¶ Resets all configuration values to the defaults.
-
save
()¶ Saves the configuration to disk.
-
-
class
smd.utils.
ConsoleFilter
¶ A filter to avoid showing exceptions stack traces text in user’s terminal.
-
static
filter
(record)¶ Removes exception stack traces information.
-
static
-
class
smd.utils.
Manga
(path, title=None, url=None, site=None)¶ Class representing a manga folder.
-
chapters
¶ The chapters found in the manga folder
-
chapters_iter
()¶ Returns an iterator that yields chapters found in the manga folder
-
static
from_folder
(path)¶ Creates a
Manga
instance from a folder path.Parameters: path (str) – the path to the manga folder. Returns: the created Manga
instance.
-
classmethod
is_manga
(manga_path)¶ Checks whether the given folder is a manga folder or not.
Parameters: manga_path (str) – path to a folder. Returns: True
if the given folder is a manga,False
otherwise.
-
save_data
()¶ Saves manga meta data.
-
-
smd.utils.
create_config_folder
()¶ Creates the application is configuration folder.
Returns: the path to the configuration folder. Return type: str
-
smd.utils.
die
(msg, status=1)¶ Shows a message and terminates the program execution.
Parameters: - msg (str) – the message to show before terminating the application.
- status (int) – the exit code.
-
smd.utils.
download
(downloaders, manga, chapter_selectors, tryall)¶ Downloads the given manga using one of the given downloaders.
Parameters: - downloaders (list) – the downloaders.
- manga (str) – the manga name.
- chapter_selectors (str) – the chapters to download.
- tryall (bool) – when
True
if a downloader fail, then tries other downloaders.
Returns: True
if the download succeeded,False
otherwise.
-
smd.utils.
filter_downloaders
(lang, downloaders)¶ Selects from the given list, the downloaders with the given language.
Parameters: - lang (str) – the language of the downloaders to select.
- downloaders (list) – a list of downloaders
(
Downloader
).
Returns: a list of downloaders with the given language.
-
smd.utils.
get_mangas
(path)¶ Gets all mangas found in the given folder.
Parameters: path (str) – path to a folder. Returns: the list of mangas found.
-
smd.utils.
get_text
(tag)¶ Extracts the text from a BeautifulSoup tag.
Parameters: tag ( bs4.Tag
) – the tag to extract text from.Returns: the tag text without \n
and with trailing white spaces removed.
-
smd.utils.
keyboard_interrupt
(function)¶ Makes the decorated function to handle keyboard interrupt gracefully.
-
smd.utils.
list_downloaders
(downloaders)¶ Prints the list of the given downloaders (
Downloader
).Parameters: downloaders (list) – a list of downloaders.
-
smd.utils.
mkdir
(dirname, basename)¶ Tries to create a new folder
basename
in the folderdirname
if the name of the new folder is invalid or already exists ask the user to enter a new one.Parameters: - dirname (str) – the parent directory of the new folder.
- basename (str) – the name of the folder.
Returns: the path of the new created folder.
Return type: str
-
smd.utils.
resume
(downloaders, mangas)¶ Resumes a previously canceled manga download.
Parameters: - downloaders (list of
Downloader
) – the supported downloaders. - mangas – a list of paths to manga folders or a path to a folder where the manga folders are stored.
- downloaders (list of
-
smd.utils.
select_chapters
(chapters, selectors)¶ Selects the chapters specified in the given selectors.
Parameters: - chapters – a list of chapters (
Chapter
). - selectors (str) – a string of comma-separated selectors.
Returns: a set of selected chapters.
Return type: set
- chapters – a list of chapters (
-
smd.utils.
select_downloader
(downloaders)¶ Lets the user choose one downloader from the give list, keeps asking if the user enters invalid option.
Parameters: downloaders – a list of downloaders ( Downloader
).Returns: the selected downloader. Return type: Downloader
-
smd.utils.
select_lang
(langs)¶ Lets the user select a language from the given list, keeps asking if the user enters invalid option.
Parameters: langs (list) – the list of languages. Returns: the selected language.
-
smd.utils.
select_manga
(mangas, list_header='Found:', prompt_msg='Select a manga', multiple=False)¶ Lets the user select a manga from the given list, keeps asking if the user enters invalid option numbers.
Parameters: - mangas – a list containing the manga (
Manga
) choices. - list_header (str) – the header message to show on top of the list.
- prompt_msg (str) – the message prompt.
- multiple (bool) – if
True
allows to select multiple choices.
Returns: the selected manga (or mangas).
Return type: Manga
or list ofManga
- mangas – a list containing the manga (
-
smd.utils.
set_site
(site, downloaders)¶ Sets the downloader of the given site as the preferred.
Parameters: - site (str) – the site name (same as
smd.downloader.Downloader.name
) - downloaders – the list of supported downloaders
(
Downloader
).
- site (str) – the site name (same as
-
smd.utils.
update
(downloaders, mangas)¶ Updates a previously downloaded manga.
Parameters: - downloaders (list of
Downloader
) – the supported downloaders. - mangas – a list of paths to manga folders or a path to a folder where the manga folders are stored.
- downloaders (list of
License¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.