Scrape and download from Piccoma.
Project description
Pyccoma
Directly scrape images from Piccoma.
Prerequisites
- Python 3.8+
Setup
You can get started by installing using pip or manually from source.
Install from PyPI
$ pip install pyccoma
Install from source
- First, you should get a copy of this project in your local machine by either downloading the zip file or cloning the repository.
git clone https://github.com/catsital/pyccoma.git
cd
intopyccoma
directory.- Run
python setup.py install
to install package.
Quickstart
Using the command-line utility
To download a single episode, simply use:
$ pyccoma https://piccoma.com/web/viewer/8195/1185884
You can also pass multiple links (separated by whitespace) to download in one go:
$ pyccoma https://piccoma.com/web/viewer/60171/1575237 https://piccoma.com/web/viewer/5796/332058 https://piccoma.com/web/viewer/13034/623225
See more examples on how to aggregate and batch download using the command-line utility on the next section below.
Using Python shell
Create a Scraper
instance and use fetch
to scrape and download images from a viewer page.
>>> from pyccoma import Scraper
>>> pyc = Scraper()
>>> pyc.fetch('https://piccoma.com/web/viewer/8195/1185884')
Title: ひげを剃る。そして女子高生を拾う。(しめさば ぶーた 足立いまる)
Episode: 第1話 失恋と女子高生 (1)
|███████████████████████████████████████████████████████████| 100.0% (14/14)
Elapsed time: 00:00:17
You can use login
to have access to rental or paywalled episodes from your own library.
>>> pyc.login(email, password)
>>> pyc.fetch('https://piccoma.com/web/viewer/s/4995/1217972')
Title: かぐや様は告らせたい~天才たちの恋愛頭脳戦~(赤坂アカ)
Episode: 第135話
|███████████████████████████████████████████████████████████| 100.0% (20/20)
Elapsed time: 00:00:23
Images are stored under the path specified in fetch(url, path)
. A fixed directory tree structure like below is created with subfolders for the product_name
and episode_name
. It will return an absolute path if a relative one is given. If none is supplied, an extract
folder will be automatically created inside the current working directory.
.
└───<extract>
└───<product_name>
└───<episode_name>
├───1.png
├───2.png
└───...
Usage
Using filter to aggregate and download in batch
- Downloading all free episodes in a single product page:
$ pyccoma https://piccoma.com/web/product/67171/episodes?etype=E --filter all --include is_free
- Downloading all free episodes across multiple products:
$ pyccoma https://piccoma.com/web/product/5523/episodes?etype=E https://piccoma.com/web/product/23019/episodes?etype=E --filter all --include is_free
- Downloading all first episodes across multiple products:
$ pyccoma https://piccoma.com/web/product/6575/episodes?etype=E https://piccoma.com/web/product/41993/episodes?etype=E --filter min
- Downloading all free volumes across multiple products offered on a campaign:
$ pyccoma https://piccoma.com/web/product/6342/episodes?etype=V https://piccoma.com/web/product/4708/episodes?etype=V --filter all --include is_limited_free
- Downloading using custom with range:
$ pyccoma https://piccoma.com/web/product/16070/episodes?etype=E --filter custom --range 1 5
Accessing your library
Requires user login.
- Downloading all your purchased items:
$ pyccoma purchase --filter all --include is_purchased --email foo@bar.com
- Downloading the most recent episodes you have read from your history:
$ pyccoma history --filter max --include "is_limited_read|(is_already_read&is_free)" --email foo@bar.com
- Downloading the latest unread episodes using free pass (if available) from your bookmarks:
$ pyccoma bookmark --filter min --include is_limited_free --exclude is_already_read --email foo@bar.com
Narrowing down the results
You can set restrictive conditions using the include and exclude options in the command-line utility. These two options take in statuses as arguments. To have a clearer picture as to what these statuses correspond to, see figure below.
{
1437090: {'title': '第1話 (1)', 'url': 'https://piccoma.com/web/viewer/54715/1437090', 'is_free': True, 'is_limited_read': False, 'is_already_read': True, 'is_limited_free': False, 'is_purchased': False},
1437091: {'title': '第1話 (2)', 'url': 'https://piccoma.com/web/viewer/54715/1437091', 'is_free': True, 'is_limited_read': False, 'is_already_read': True, 'is_limited_free': False, 'is_purchased': False},
1437092: {'title': '第2話 (1)', 'url': 'https://piccoma.com/web/viewer/54715/1437092', 'is_free': True, 'is_limited_read': False, 'is_already_read': True, 'is_limited_free': False, 'is_purchased': False},
1437093: {'title': '第2話 (2)', 'url': 'https://piccoma.com/web/viewer/54715/1437093', 'is_free': False, 'is_limited_read': False, 'is_already_read': True, 'is_limited_free': True, 'is_purchased': False},
1437094: {'title': '第3話 (1)', 'url': 'https://piccoma.com/web/viewer/54715/1437094', 'is_free': False, 'is_limited_read': True, 'is_already_read': True, 'is_limited_free': False, 'is_purchased': False},
1437095: {'title': '第3話 (2)', 'url': 'https://piccoma.com/web/viewer/54715/1437095', 'is_free': False, 'is_limited_read': True, 'is_already_read': True, 'is_limited_free': False, 'is_purchased': False},
1437096: {'title': '第4話 (1)', 'url': 'https://piccoma.com/web/viewer/54715/1437096', 'is_free': False, 'is_limited_read': True, 'is_already_read': True, 'is_limited_free': False, 'is_purchased': False},
1437097: {'title': '第4話 (2)', 'url': 'https://piccoma.com/web/viewer/54715/1437097', 'is_free': False, 'is_limited_read': False, 'is_already_read': False, 'is_limited_free': True, 'is_purchased': False}
}
Options
Required
Option | Description | Examples |
---|---|---|
url | Must be a valid url | https://piccoma.com/web/product/4995/episodes?etype=V , https://piccoma.com/web/product/12482/episodes?etype=E , https://piccoma.com/web/viewer/12482/631201 , bookmark , history , purchase |
Optional
Option | Description | Examples |
---|---|---|
-o, --output | Local directory to save downloaded images | D:/piccoma/ (absolute path), /piccoma/download/ (relative path) |
-f, --format | Image format | jpeg , jpg , bmp , png (default) |
--omit-author | Omit author names from titles |
Login
Option | Description | Examples |
---|---|---|
Your registered email address; this does not support OAuth authentication | foo@bar.com |
Filter
Option | Description | Examples |
---|---|---|
--etype | Preferred episode type to scrape manga, smartoon, and novel when scraping history , bookmark , purchase ; takes in three arguments, the first one for manga, the second for smartoon, and the last one for novel |
volume to scrape for volumes, episode to scrape for episodes |
--filter | Filter to use when scraping episodes from a product page or your library | min , max , all , or custom by defining --range. Use min to scrape for the first item, max for the last item, all to scrape all items, and custom to scrape for a specific index range |
--range | Range to use when scraping episodes; takes in two arguments, start and end; will always override --filter to parse custom, if omitted or otherwise | 0 10 will scrape the first up to the ninth episode |
--include | Status arguments to include when parsing a library or product; can parse in | and & operators as conditionals, see use cases above |
is_purchased , is_free , is_already_read , is_limited_read , is_limited_free |
--exclude | Status arguments to exclude when parsing a library or product; can parse in | and & operators as conditionals, see use cases above |
is_purchased , is_free , is_already_read , is_limited_read , is_limited_free |
Logging
Option | Description | Examples |
---|---|---|
-l, --loglevel | Set the log message threshold | debug , info (default), warning , error , none |
License
See LICENSE for details.
Disclaimer
Pyccoma was made for the sole purpose of helping users download media from Piccoma for offline consumption. This is for private use only, do not use this tool to promote piracy.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyccoma-0.3.0.tar.gz
.
File metadata
- Download URL: pyccoma-0.3.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f276846175d8f857731e7d39316313a12cd937a781d2f59e20d72acb6f89136 |
|
MD5 | 0df8703e2738d68f92f17a75bffd3c03 |
|
BLAKE2b-256 | da5089b3790265b0ef1b808258d57f3875e12f4f671e42427780013ea72a1db1 |
Provenance
File details
Details for the file pyccoma-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pyccoma-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 304943496c283417252208d4db7c91c7119a22f921196f8642ff31404d6bca21 |
|
MD5 | 1712d4087897a4e0e6d5b253ab08ed4b |
|
BLAKE2b-256 | 7cc28495f3a332a799ae336723ecfe50248c7503a282b139a873f676bf0dbdd6 |