mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-07-01 16:09:28 +02:00
Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
221ff6b32c | |||
bc6ef0cf5d | |||
c8c63cbc11 | |||
a63856d076 | |||
aa4986189f | |||
0fb81599dc | |||
e9f9651d07 | |||
1860b5f0cf | |||
eff4f3bf9b | |||
501840172e | |||
e5ed6d098a | |||
98606202fb | |||
5a3f1009c9 | |||
61945a6e97 | |||
443fcdc7da | |||
31b95fe2dd | |||
be8c97f8d4 | |||
348e51676e | |||
ea356a1ca2 | |||
5a4dfb8a76 | |||
4b15744ceb | |||
b05fa16286 | |||
0879486881 | |||
c66ba730d3 | |||
606c5e0ffd | |||
ba04f81a6f | |||
6519e6f221 | |||
7594625d72 | |||
4948c8f0c5 | |||
e22a99fa8c | |||
19a1d5c404 | |||
ad1e876611 | |||
1de7e1f998 | |||
b97e707817 | |||
6ef2189bfe | |||
24be2d37d4 | |||
d9d2a6fb91 | |||
bd38294bb7 | |||
2cf4e6718e | |||
8cd4b948e7 | |||
f884384eb3 | |||
87afab46c4 | |||
c7b1d7e6a8 | |||
ad02371158 | |||
7c9d55e0ee | |||
00aad774ae | |||
373086b459 | |||
3a83f99771 | |||
00627ab36a | |||
592e163891 | |||
84523475b0 | |||
5f5461c902 | |||
05e6ceb3cd | |||
db59426503 | |||
74197f8f90 | |||
6d91a39533 | |||
e181e0b9dd | |||
6fed1f94cb | |||
9cfb23c8ec | |||
fc347cdadf | |||
1cdebaab61 | |||
ce8ae54536 | |||
7aedb905d6 | |||
08bb8ffda4 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ dist/
|
||||
.DS_Store
|
||||
output/
|
||||
venv/
|
||||
.vscode/
|
||||
|
@ -2,3 +2,4 @@ include README.md
|
||||
include requirements.txt
|
||||
include nhentai/viewer/*
|
||||
include nhentai/viewer/default/*
|
||||
include nhentai/viewer/minimal/*
|
94
README.rst
94
README.rst
@ -51,10 +51,17 @@ Installation (Gentoo)
|
||||
layman -fa glicOne
|
||||
sudo emerge net-misc/nhentai
|
||||
|
||||
=====================
|
||||
Installation (NixOs)
|
||||
=====================
|
||||
.. code-block::
|
||||
|
||||
nix-env -iA nixos.nhentai
|
||||
|
||||
=====
|
||||
Usage
|
||||
=====
|
||||
**IMPORTANT**: To bypass the nhentai frequency limit, you should use `--cookie` option to store your cookie.
|
||||
**⚠️IMPORTANT⚠️**: To bypass the nhentai frequency limit, you should use `--cookie` and `--useragent` options to store your cookie and your user-agent.
|
||||
|
||||
*The default download folder will be the path where you run the command (CLI path).*
|
||||
|
||||
@ -63,9 +70,26 @@ Set your nhentai cookie against captcha:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
nhentai --useragent "USER AGENT of YOUR BROWSER"
|
||||
nhentai --cookie "YOUR COOKIE FROM nhentai.net"
|
||||
|
||||
**NOTE**: The format of the cookie is `"csrftoken=TOKEN; sessionid=ID"`
|
||||
**NOTE**
|
||||
|
||||
- The format of the cookie is `"csrftoken=TOKEN; sessionid=ID; cf_clearance=CLOUDFLARE"`
|
||||
- `cf_clearance` cookie and useragent must be set if you encounter "blocked by cloudflare captcha" error. Make sure you use the same IP and useragent as when you got it
|
||||
|
||||
| To get csrftoken and sessionid, first login to your nhentai account in web browser, then:
|
||||
| (Chrome) |ve| |ld| More tools |ld| Developer tools |ld| Application |ld| Storage |ld| Cookies |ld| https://nhentai.net
|
||||
| (Firefox) |hv| |ld| Web Developer |ld| Web Developer Tools |ld| Storage |ld| Cookies |ld| https://nhentai.net
|
||||
|
|
||||
|
||||
.. |hv| unicode:: U+2630 .. https://www.compart.com/en/unicode/U+2630
|
||||
.. |ve| unicode:: U+22EE .. https://www.compart.com/en/unicode/U+22EE
|
||||
.. |ld| unicode:: U+2014 .. https://www.compart.com/en/unicode/U+2014
|
||||
|
||||
.. image:: ./images/usage.png?raw=true
|
||||
:alt: nhentai
|
||||
:align: center
|
||||
|
||||
Download specified doujinshi:
|
||||
|
||||
@ -112,30 +136,41 @@ Supported doujinshi folder formatter:
|
||||
- %t: Doujinshi name
|
||||
- %s: Doujinshi subtitle (translated name)
|
||||
- %a: Doujinshi authors' name
|
||||
- %p: Doujinshi pretty name
|
||||
|
||||
|
||||
Other options:
|
||||
|
||||
.. code-block::
|
||||
|
||||
Usage:
|
||||
nhentai --search [keyword] --download
|
||||
NHENTAI=http://h.loli.club nhentai --id [ID ...]
|
||||
nhentai --file [filename]
|
||||
|
||||
Environment Variable:
|
||||
NHENTAI nhentai mirror url
|
||||
|
||||
Options:
|
||||
# Operation options
|
||||
# Operation options, control the program behaviors
|
||||
-h, --help show this help message and exit
|
||||
-D, --download download doujinshi (for search results)
|
||||
-S, --show just show the doujinshi information
|
||||
|
||||
# Doujinshi options
|
||||
# Doujinshi options, specify id, keyword, etc.
|
||||
--id=ID doujinshi ids set, e.g. 1,2,3
|
||||
-s KEYWORD, --search=KEYWORD
|
||||
search doujinshi by keyword
|
||||
--tag=TAG download doujinshi by tag
|
||||
-F, --favorites list or download your favorites.
|
||||
|
||||
# Multi-page options
|
||||
--page=PAGE page number of search results
|
||||
--max-page=MAX_PAGE The max page when recursive download tagged doujinshi
|
||||
# Page options, control the page to fetch / download
|
||||
--page-all all search results
|
||||
--page=PAGE, --page-range=PAGE
|
||||
page number of search results. e.g. 1,2-5,14
|
||||
--sorting=SORTING sorting of doujinshi (recent / popular /
|
||||
popular-[today|week])
|
||||
|
||||
# Download options
|
||||
# Download options, the output directory, threads, timeout, delay, etc.
|
||||
-o OUTPUT_DIR, --output=OUTPUT_DIR
|
||||
output dir
|
||||
-t THREADS, --threads=THREADS
|
||||
@ -144,23 +179,36 @@ Other options:
|
||||
timeout for downloading doujinshi
|
||||
-d DELAY, --delay=DELAY
|
||||
slow down between downloading every doujinshi
|
||||
-p PROXY, --proxy=PROXY
|
||||
uses a proxy, for example: http://127.0.0.1:1080
|
||||
--proxy=PROXY store a proxy, for example: -p 'http://127.0.0.1:1080'
|
||||
-f FILE, --file=FILE read gallery IDs from file.
|
||||
--format=NAME_FORMAT format the saved folder name
|
||||
-r, --dry-run Dry run, skip file download.
|
||||
|
||||
# Generating options
|
||||
# Generate options, for generate html viewer, cbz file, pdf file, etc
|
||||
--html generate a html viewer at current directory
|
||||
--no-html don't generate HTML after downloading
|
||||
--gen-main generate a main viewer contain all the doujin in the folder
|
||||
--gen-main generate a main viewer contain all the doujin in the
|
||||
folder
|
||||
-C, --cbz generate Comic Book CBZ File
|
||||
-P --pdf generate PDF file
|
||||
--rm-origin-dir remove downloaded doujinshi dir when generated CBZ
|
||||
or PDF file.
|
||||
|
||||
# nHentai options
|
||||
--cookie=COOKIE set cookie of nhentai to bypass Google recaptcha
|
||||
-P, --pdf generate PDF file
|
||||
--rm-origin-dir remove downloaded doujinshi dir when generated CBZ or
|
||||
PDF file.
|
||||
--meta generate a metadata file in doujinshi format
|
||||
--regenerate-cbz regenerate the cbz file if exists
|
||||
|
||||
# nhentai options, set cookie, user-agent, language, remove caches, histories, etc
|
||||
--cookie=COOKIE set cookie of nhentai to bypass Cloudflare captcha
|
||||
--useragent=USERAGENT
|
||||
set useragent to bypass Cloudflare captcha
|
||||
--language=LANGUAGE set default language to parse doujinshis
|
||||
--clean-language set DEFAULT as language to parse doujinshis
|
||||
--save-download-history
|
||||
save downloaded doujinshis, whose will be skipped if
|
||||
you re-download them
|
||||
--clean-download-history
|
||||
clean download history
|
||||
--template=VIEWER_TEMPLATE
|
||||
set viewer template
|
||||
|
||||
==============
|
||||
nHentai Mirror
|
||||
@ -190,14 +238,6 @@ Set `NHENTAI` env var to your nhentai mirror.
|
||||
:alt: nhentai
|
||||
:align: center
|
||||
|
||||
============
|
||||
あなたも変態
|
||||
============
|
||||
.. image:: ./images/image.jpg?raw=true
|
||||
:alt: nhentai
|
||||
:align: center
|
||||
|
||||
|
||||
|
||||
.. |travis| image:: https://travis-ci.org/RicterZ/nhentai.svg?branch=master
|
||||
:target: https://travis-ci.org/RicterZ/nhentai
|
||||
|
BIN
images/image.jpg
BIN
images/image.jpg
Binary file not shown.
Before Width: | Height: | Size: 34 KiB |
BIN
images/usage.png
Normal file
BIN
images/usage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 679 KiB |
@ -1,3 +1,3 @@
|
||||
__version__ = '0.4.12'
|
||||
__version__ = '0.4.18'
|
||||
__author__ = 'RicterZ'
|
||||
__email__ = 'ricterzheng@gmail.com'
|
||||
|
@ -71,9 +71,9 @@ def cmd_parser():
|
||||
help='all search results')
|
||||
parser.add_option('--page', '--page-range', type='string', dest='page', action='store', default='',
|
||||
help='page number of search results. e.g. 1,2-5,14')
|
||||
parser.add_option('--sorting', dest='sorting', action='store', default='recent',
|
||||
parser.add_option('--sorting', dest='sorting', action='store', default='popular',
|
||||
help='sorting of doujinshi (recent / popular / popular-[today|week])',
|
||||
choices=['recent', 'popular', 'popular-today', 'popular-week'])
|
||||
choices=['recent', 'popular', 'popular-today', 'popular-week', 'date'])
|
||||
|
||||
# download options
|
||||
parser.add_option('--output', '-o', type='string', dest='output_dir', action='store', default='./',
|
||||
@ -84,11 +84,12 @@ def cmd_parser():
|
||||
help='timeout for downloading doujinshi')
|
||||
parser.add_option('--delay', '-d', type='int', dest='delay', action='store', default=0,
|
||||
help='slow down between downloading every doujinshi')
|
||||
parser.add_option('--proxy', type='string', dest='proxy', action='store', default='',
|
||||
parser.add_option('--proxy', type='string', dest='proxy', action='store',
|
||||
help='store a proxy, for example: -p \'http://127.0.0.1:1080\'')
|
||||
parser.add_option('--file', '-f', type='string', dest='file', action='store', help='read gallery IDs from file.')
|
||||
parser.add_option('--format', type='string', dest='name_format', action='store',
|
||||
help='format the saved folder name', default='[%i][%a][%t]')
|
||||
parser.add_option('--dry-run', '-r', action='store_true', dest='dryrun', help='Dry run, skip file download.')
|
||||
|
||||
# generate options
|
||||
parser.add_option('--html', dest='html_viewer', action='store_true',
|
||||
@ -103,10 +104,16 @@ def cmd_parser():
|
||||
help='generate PDF file')
|
||||
parser.add_option('--rm-origin-dir', dest='rm_origin_dir', action='store_true', default=False,
|
||||
help='remove downloaded doujinshi dir when generated CBZ or PDF file.')
|
||||
parser.add_option('--meta', dest='generate_metadata', action='store_true',
|
||||
help='generate a metadata file in doujinshi format')
|
||||
parser.add_option('--regenerate-cbz', dest='regenerate_cbz', action='store_true', default=False,
|
||||
help='regenerate the cbz file if exists')
|
||||
|
||||
# nhentai options
|
||||
parser.add_option('--cookie', type='str', dest='cookie', action='store',
|
||||
help='set cookie of nhentai to bypass Google recaptcha')
|
||||
help='set cookie of nhentai to bypass Cloudflare captcha')
|
||||
parser.add_option('--useragent', '--user-agent', type='str', dest='useragent', action='store',
|
||||
help='set useragent to bypass Cloudflare captcha')
|
||||
parser.add_option('--language', type='str', dest='language', action='store',
|
||||
help='set default language to parse doujinshis')
|
||||
parser.add_option('--clean-language', dest='clean_language', action='store_true', default=False,
|
||||
@ -117,6 +124,8 @@ def cmd_parser():
|
||||
help='clean download history')
|
||||
parser.add_option('--template', dest='viewer_template', action='store',
|
||||
help='set viewer template', default='')
|
||||
parser.add_option('--legacy', dest='legacy', action='store_true', default=False,
|
||||
help='use legacy searching method')
|
||||
|
||||
try:
|
||||
sys.argv = [unicode(i.decode(sys.stdin.encoding)) for i in sys.argv]
|
||||
@ -128,7 +137,7 @@ def cmd_parser():
|
||||
args, _ = parser.parse_args(sys.argv[1:])
|
||||
|
||||
if args.html_viewer:
|
||||
generate_html()
|
||||
generate_html(template=constant.CONFIG['template'])
|
||||
exit(0)
|
||||
|
||||
if args.main_viewer and not args.id and not args.keyword and not args.favorites:
|
||||
@ -145,20 +154,24 @@ def cmd_parser():
|
||||
# --- set config ---
|
||||
if args.cookie is not None:
|
||||
constant.CONFIG['cookie'] = args.cookie
|
||||
write_config()
|
||||
logger.info('Cookie saved.')
|
||||
write_config()
|
||||
exit(0)
|
||||
|
||||
if args.language is not None:
|
||||
constant.CONFIG['language'] = args.language
|
||||
logger.info('Default language now set to \'{0}\''.format(args.language))
|
||||
elif args.useragent is not None:
|
||||
constant.CONFIG['useragent'] = args.useragent
|
||||
write_config()
|
||||
logger.info('User-Agent saved.')
|
||||
exit(0)
|
||||
elif args.language is not None:
|
||||
constant.CONFIG['language'] = args.language
|
||||
write_config()
|
||||
logger.info('Default language now set to \'{0}\''.format(args.language))
|
||||
exit(0)
|
||||
# TODO: search without language
|
||||
|
||||
if args.proxy is not None:
|
||||
proxy_url = urlparse(args.proxy)
|
||||
if not args.proxy == '' and proxy_url.scheme not in ('http', 'https'):
|
||||
if not args.proxy == '' and proxy_url.scheme not in ('http', 'https', 'socks5', 'socks5h', 'socks4', 'socks4a'):
|
||||
logger.error('Invalid protocol \'{0}\' of proxy, ignored'.format(proxy_url.scheme))
|
||||
exit(0)
|
||||
else:
|
||||
@ -214,4 +227,8 @@ def cmd_parser():
|
||||
logger.critical('Maximum number of used threads is 15')
|
||||
exit(1)
|
||||
|
||||
if args.dryrun and (args.is_cbz or args.is_pdf):
|
||||
logger.critical('Cannot generate PDF or CBZ during dry-run')
|
||||
exit(1)
|
||||
|
||||
return args
|
||||
|
@ -8,12 +8,12 @@ import time
|
||||
|
||||
from nhentai import constant
|
||||
from nhentai.cmdline import cmd_parser, banner
|
||||
from nhentai.parser import doujinshi_parser, search_parser, print_doujinshi, favorites_parser
|
||||
from nhentai.parser import doujinshi_parser, search_parser, legacy_search_parser, print_doujinshi, favorites_parser
|
||||
from nhentai.doujinshi import Doujinshi
|
||||
from nhentai.downloader import Downloader
|
||||
from nhentai.logger import logger
|
||||
from nhentai.constant import BASE_URL
|
||||
from nhentai.utils import generate_html, generate_cbz, generate_main_html, generate_pdf, \
|
||||
from nhentai.utils import generate_html, generate_cbz, generate_main_html, generate_pdf, generate_metadata_file, \
|
||||
paging, check_cookie, signal_handler, DB
|
||||
|
||||
|
||||
@ -55,7 +55,9 @@ def main():
|
||||
if constant.CONFIG['language']:
|
||||
logger.info('Using default language: {0}'.format(constant.CONFIG['language']))
|
||||
options.keyword += ' language:{}'.format(constant.CONFIG['language'])
|
||||
doujinshis = search_parser(options.keyword, sorting=options.sorting, page=page_list,
|
||||
|
||||
_search_parser = legacy_search_parser if options.legacy else search_parser
|
||||
doujinshis = _search_parser(options.keyword, sorting=options.sorting, page=page_list,
|
||||
is_page_all=options.page_all)
|
||||
|
||||
elif not doujinshi_ids:
|
||||
@ -69,29 +71,27 @@ def main():
|
||||
with DB() as db:
|
||||
data = map(int, db.get_all())
|
||||
|
||||
doujinshi_ids = list(set(doujinshi_ids) - set(data))
|
||||
|
||||
if doujinshi_ids:
|
||||
for i, id_ in enumerate(doujinshi_ids):
|
||||
if options.delay:
|
||||
time.sleep(options.delay)
|
||||
|
||||
doujinshi_info = doujinshi_parser(id_)
|
||||
|
||||
if doujinshi_info:
|
||||
doujinshi_list.append(Doujinshi(name_format=options.name_format, **doujinshi_info))
|
||||
|
||||
if (i + 1) % 10 == 0:
|
||||
logger.info('Progress: %d / %d' % (i + 1, len(doujinshi_ids)))
|
||||
doujinshi_ids = list(set(map(int, doujinshi_ids)) - set(data))
|
||||
|
||||
if not options.is_show:
|
||||
downloader = Downloader(path=options.output_dir, size=options.threads,
|
||||
timeout=options.timeout, delay=options.delay)
|
||||
|
||||
for doujinshi in doujinshi_list:
|
||||
for doujinshi_id in doujinshi_ids:
|
||||
doujinshi_info = doujinshi_parser(doujinshi_id)
|
||||
if doujinshi_info:
|
||||
doujinshi = Doujinshi(name_format=options.name_format, **doujinshi_info)
|
||||
else:
|
||||
continue
|
||||
|
||||
if not options.dryrun:
|
||||
doujinshi.downloader = downloader
|
||||
doujinshi.download()
|
||||
doujinshi.download(regenerate_cbz=options.regenerate_cbz)
|
||||
|
||||
if options.generate_metadata:
|
||||
table = doujinshi.table
|
||||
generate_metadata_file(options.output_dir, table, doujinshi)
|
||||
|
||||
if options.is_save_download_history:
|
||||
with DB() as db:
|
||||
db.add_one(doujinshi.id)
|
||||
@ -112,11 +112,16 @@ def main():
|
||||
logger.log(15, 'All done.')
|
||||
|
||||
else:
|
||||
[doujinshi.show() for doujinshi in doujinshi_list]
|
||||
for doujinshi_id in doujinshi_ids:
|
||||
doujinshi_info = doujinshi_parser(doujinshi_id)
|
||||
if doujinshi_info:
|
||||
doujinshi = Doujinshi(name_format=options.name_format, **doujinshi_info)
|
||||
else:
|
||||
continue
|
||||
doujinshi.show()
|
||||
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -14,6 +14,7 @@ BASE_URL = os.getenv('NHENTAI', 'https://nhentai.net')
|
||||
__api_suspended_DETAIL_URL = '%s/api/gallery' % BASE_URL
|
||||
|
||||
DETAIL_URL = '%s/g' % BASE_URL
|
||||
LEGACY_SEARCH_URL = '%s/search/' % BASE_URL
|
||||
SEARCH_URL = '%s/api/galleries/search' % BASE_URL
|
||||
|
||||
|
||||
@ -29,10 +30,17 @@ NHENTAI_HOME = os.path.join(os.getenv('HOME', tempfile.gettempdir()), '.nhentai'
|
||||
NHENTAI_HISTORY = os.path.join(NHENTAI_HOME, 'history.sqlite3')
|
||||
NHENTAI_CONFIG_FILE = os.path.join(NHENTAI_HOME, 'config.json')
|
||||
|
||||
|
||||
CONFIG = {
|
||||
'proxy': {'http': '', 'https': ''},
|
||||
'cookie': '',
|
||||
'language': '',
|
||||
'template': '',
|
||||
'useragent': 'nhentai command line client (https://github.com/RicterZ/nhentai)'
|
||||
}
|
||||
|
||||
LANGUAGEISO ={
|
||||
'english' : 'en',
|
||||
'chinese' : 'zh',
|
||||
'japanese' : 'ja',
|
||||
'translated' : 'translated'
|
||||
}
|
||||
|
@ -26,8 +26,10 @@ class DoujinshiInfo(dict):
|
||||
|
||||
|
||||
class Doujinshi(object):
|
||||
def __init__(self, name=None, id=None, img_id=None, ext='', pages=0, name_format='[%i][%a][%t]', **kwargs):
|
||||
def __init__(self, name=None, pretty_name=None, id=None, img_id=None,
|
||||
ext='', pages=0, name_format='[%i][%a][%t]', **kwargs):
|
||||
self.name = name
|
||||
self.pretty_name = pretty_name
|
||||
self.id = id
|
||||
self.img_id = img_id
|
||||
self.ext = ext
|
||||
@ -36,17 +38,15 @@ class Doujinshi(object):
|
||||
self.url = '%s/%d' % (DETAIL_URL, self.id)
|
||||
self.info = DoujinshiInfo(**kwargs)
|
||||
|
||||
name_format = name_format.replace('%i', str(self.id))
|
||||
name_format = name_format.replace('%a', self.info.artists)
|
||||
name_format = name_format.replace('%t', self.name)
|
||||
name_format = name_format.replace('%s', self.info.subtitle)
|
||||
self.filename = format_filename(name_format)
|
||||
name_format = name_format.replace('%i', format_filename(str(self.id)))
|
||||
name_format = name_format.replace('%a', format_filename(self.info.artists))
|
||||
|
||||
def __repr__(self):
|
||||
return '<Doujinshi: {0}>'.format(self.name)
|
||||
name_format = name_format.replace('%t', format_filename(self.name))
|
||||
name_format = name_format.replace('%p', format_filename(self.pretty_name))
|
||||
name_format = name_format.replace('%s', format_filename(self.info.subtitle))
|
||||
self.filename = format_filename(name_format, 255, True)
|
||||
|
||||
def show(self):
|
||||
table = [
|
||||
self.table = [
|
||||
["Parodies", self.info.parodies],
|
||||
["Doujinshi", self.name],
|
||||
["Subtitle", self.info.subtitle],
|
||||
@ -57,26 +57,25 @@ class Doujinshi(object):
|
||||
["URL", self.url],
|
||||
["Pages", self.pages],
|
||||
]
|
||||
logger.info(u'Print doujinshi information of {0}\n{1}'.format(self.id, tabulate(table)))
|
||||
|
||||
def download(self):
|
||||
def __repr__(self):
|
||||
return '<Doujinshi: {0}>'.format(self.name)
|
||||
|
||||
def show(self):
|
||||
|
||||
logger.info(u'Print doujinshi information of {0}\n{1}'.format(self.id, tabulate(self.table)))
|
||||
|
||||
def download(self, regenerate_cbz=False):
|
||||
logger.info('Starting to download doujinshi: %s' % self.name)
|
||||
if self.downloader:
|
||||
download_queue = []
|
||||
|
||||
if len(self.ext) != self.pages:
|
||||
logger.warning('Page count and ext count do not equal')
|
||||
|
||||
for i in range(1, min(self.pages, len(self.ext)) + 1):
|
||||
download_queue.append('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i, self.ext[i - 1]))
|
||||
|
||||
self.downloader.download(download_queue, self.filename)
|
||||
|
||||
'''
|
||||
for i in range(len(self.ext)):
|
||||
download_queue.append('%s/%d/%d.%s' % (IMAGE_URL, int(self.img_id), i+1, EXT_MAP[self.ext[i]]))
|
||||
'''
|
||||
|
||||
self.downloader.download(download_queue, self.filename, regenerate_cbz=regenerate_cbz)
|
||||
else:
|
||||
logger.critical('Downloader has not been loaded')
|
||||
|
||||
|
@ -14,6 +14,7 @@ try:
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
from nhentai import constant
|
||||
from nhentai.logger import logger
|
||||
from nhentai.parser import request
|
||||
from nhentai.utils import Singleton
|
||||
@ -34,7 +35,7 @@ class Downloader(Singleton):
|
||||
self.timeout = timeout
|
||||
self.delay = delay
|
||||
|
||||
def download_(self, url, folder='', filename='', retried=0):
|
||||
def download_(self, url, folder='', filename='', retried=0, proxy=None):
|
||||
if self.delay:
|
||||
time.sleep(self.delay)
|
||||
logger.info('Starting to download {0} ...'.format(url))
|
||||
@ -51,7 +52,7 @@ class Downloader(Singleton):
|
||||
i = 0
|
||||
while i < 10:
|
||||
try:
|
||||
response = request('get', url, stream=True, timeout=self.timeout)
|
||||
response = request('get', url, stream=True, timeout=self.timeout, proxies=proxy)
|
||||
if response.status_code != 200:
|
||||
raise NHentaiImageNotExistException
|
||||
|
||||
@ -77,7 +78,8 @@ class Downloader(Singleton):
|
||||
except (requests.HTTPError, requests.Timeout) as e:
|
||||
if retried < 3:
|
||||
logger.warning('Warning: {0}, retrying({1}) ...'.format(str(e), retried))
|
||||
return 0, self.download_(url=url, folder=folder, filename=filename, retried=retried+1)
|
||||
return 0, self.download_(url=url, folder=folder, filename=filename,
|
||||
retried=retried+1, proxy=proxy)
|
||||
else:
|
||||
return 0, None
|
||||
|
||||
@ -111,24 +113,29 @@ class Downloader(Singleton):
|
||||
else:
|
||||
logger.log(15, '{0} downloaded successfully'.format(data))
|
||||
|
||||
def download(self, queue, folder=''):
|
||||
def download(self, queue, folder='', regenerate_cbz=False):
|
||||
if not isinstance(folder, text):
|
||||
folder = str(folder)
|
||||
|
||||
if self.path:
|
||||
folder = os.path.join(self.path, folder)
|
||||
|
||||
if os.path.exists(folder + '.cbz'):
|
||||
if not regenerate_cbz:
|
||||
logger.warning('CBZ file \'{}.cbz\' exists, ignored download request'.format(folder))
|
||||
return
|
||||
|
||||
if not os.path.exists(folder):
|
||||
logger.warn('Path \'{0}\' does not exist, creating.'.format(folder))
|
||||
logger.warning('Path \'{0}\' does not exist, creating.'.format(folder))
|
||||
try:
|
||||
os.makedirs(folder)
|
||||
except EnvironmentError as e:
|
||||
logger.critical('{0}'.format(str(e)))
|
||||
|
||||
else:
|
||||
logger.warn('Path \'{0}\' already exist.'.format(folder))
|
||||
logger.warning('Path \'{0}\' already exist.'.format(folder))
|
||||
|
||||
queue = [(self, url, folder) for url in queue]
|
||||
queue = [(self, url, folder, constant.CONFIG['proxy']) for url in queue]
|
||||
|
||||
pool = multiprocessing.Pool(self.size, init_worker)
|
||||
[pool.apply_async(download_wrapper, args=item) for item in queue]
|
||||
@ -137,9 +144,9 @@ class Downloader(Singleton):
|
||||
pool.join()
|
||||
|
||||
|
||||
def download_wrapper(obj, url, folder=''):
|
||||
def download_wrapper(obj, url, folder='', proxy=None):
|
||||
if sys.platform == 'darwin' or semaphore.get_value():
|
||||
return Downloader.download_(obj, url=url, folder=folder)
|
||||
return Downloader.download_(obj, url=url, folder=folder, proxy=proxy)
|
||||
else:
|
||||
return -3, None
|
||||
|
||||
|
@ -173,7 +173,7 @@ logger.setLevel(logging.DEBUG)
|
||||
if __name__ == '__main__':
|
||||
logger.log(15, 'nhentai')
|
||||
logger.info('info')
|
||||
logger.warn('warn')
|
||||
logger.warning('warning')
|
||||
logger.debug('debug')
|
||||
logger.error('error')
|
||||
logger.critical('critical')
|
||||
|
@ -126,20 +126,23 @@ def doujinshi_parser(id_):
|
||||
return doujinshi_parser(str(id_))
|
||||
|
||||
except Exception as e:
|
||||
logger.warn('Error: {}, ignored'.format(str(e)))
|
||||
logger.warning('Error: {}, ignored'.format(str(e)))
|
||||
return None
|
||||
|
||||
html = BeautifulSoup(response, 'html.parser')
|
||||
doujinshi_info = html.find('div', attrs={'id': 'info'})
|
||||
|
||||
title = doujinshi_info.find('h1').text
|
||||
pretty_name = doujinshi_info.find('h1').find('span', attrs={'class': 'pretty'}).text
|
||||
subtitle = doujinshi_info.find('h2')
|
||||
|
||||
doujinshi['name'] = title
|
||||
doujinshi['pretty_name'] = pretty_name
|
||||
doujinshi['subtitle'] = subtitle.text if subtitle else ''
|
||||
|
||||
doujinshi_cover = html.find('div', attrs={'id': 'cover'})
|
||||
img_id = re.search('/galleries/([\d]+)/cover\.(jpg|png|gif)$', doujinshi_cover.a.img.attrs['data-src'])
|
||||
img_id = re.search('/galleries/([0-9]+)/cover.(jpg|png|gif)$',
|
||||
doujinshi_cover.a.img.attrs['data-src'])
|
||||
|
||||
ext = []
|
||||
for i in html.find_all('div', attrs={'class': 'thumb-container'}):
|
||||
@ -174,13 +177,15 @@ def doujinshi_parser(id_):
|
||||
return doujinshi
|
||||
|
||||
|
||||
def old_search_parser(keyword, sorting='date', page=1):
|
||||
def legacy_search_parser(keyword, sorting='date', page=1, is_page_all=False):
|
||||
logger.warning('Using legacy searching method, `--all` options will not be supported')
|
||||
logger.debug('Searching doujinshis of keyword {0}'.format(keyword))
|
||||
response = request('get', url=constant.SEARCH_URL, params={'q': keyword, 'page': page, 'sort': sorting}).content
|
||||
response = request('get', url=constant.LEGACY_SEARCH_URL,
|
||||
params={'q': keyword, 'page': page, 'sort': sorting}).content
|
||||
|
||||
result = _get_title_and_id(response)
|
||||
if not result:
|
||||
logger.warn('Not found anything of keyword {}'.format(keyword))
|
||||
logger.warning('Not found anything of keyword {}'.format(keyword))
|
||||
|
||||
return result
|
||||
|
||||
@ -197,6 +202,7 @@ def print_doujinshi(doujinshi_list):
|
||||
def search_parser(keyword, sorting, page, is_page_all=False):
|
||||
# keyword = '+'.join([i.strip().replace(' ', '-').lower() for i in keyword.split(',')])
|
||||
result = []
|
||||
response = None
|
||||
if not page:
|
||||
page = [1]
|
||||
|
||||
@ -206,6 +212,7 @@ def search_parser(keyword, sorting, page, is_page_all=False):
|
||||
page = range(1, init_response['num_pages']+1)
|
||||
|
||||
total = '/{0}'.format(page[-1]) if is_page_all else ''
|
||||
not_exists_persist = False
|
||||
for p in page:
|
||||
i = 0
|
||||
|
||||
@ -217,20 +224,23 @@ def search_parser(keyword, sorting, page, is_page_all=False):
|
||||
response = request('get', url.replace('%2B', '+')).json()
|
||||
except Exception as e:
|
||||
logger.critical(str(e))
|
||||
|
||||
response = None
|
||||
break
|
||||
|
||||
if 'result' not in response:
|
||||
logger.warn('No result in response in page {}'.format(p))
|
||||
if response is None or 'result' not in response:
|
||||
logger.warning('No result in response in page {}'.format(p))
|
||||
if not_exists_persist is True:
|
||||
break
|
||||
continue
|
||||
|
||||
for row in response['result']:
|
||||
title = row['title']['english']
|
||||
title = title[:85] + '..' if len(title) > 85 else title
|
||||
result.append({'id': row['id'], 'title': title})
|
||||
|
||||
not_exists_persist = False
|
||||
if not result:
|
||||
logger.warn('No results for keywords {}'.format(keyword))
|
||||
logger.warning('No results for keywords {}'.format(keyword))
|
||||
|
||||
return result
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
import json
|
||||
import os
|
||||
from xml.sax.saxutils import escape
|
||||
from nhentai.constant import LANGUAGEISO
|
||||
|
||||
|
||||
def serialize_json(doujinshi, dir):
|
||||
@ -26,12 +27,12 @@ def serialize_json(doujinshi, dir):
|
||||
metadata['Pages'] = doujinshi.pages
|
||||
|
||||
with open(os.path.join(dir, 'metadata.json'), 'w') as f:
|
||||
json.dump(metadata, f, separators=','':')
|
||||
json.dump(metadata, f, separators=(',', ':'))
|
||||
|
||||
|
||||
def serialize_comicxml(doujinshi, dir):
|
||||
def serialize_comic_xml(doujinshi, dir):
|
||||
from iso8601 import parse_date
|
||||
with open(os.path.join(dir, 'ComicInfo.xml'), 'w') as f:
|
||||
with open(os.path.join(dir, 'ComicInfo.xml'), 'w', encoding="utf-8") as f:
|
||||
f.write('<?xml version="1.0" encoding="utf-8"?>\n')
|
||||
f.write('<ComicInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" '
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n')
|
||||
@ -45,7 +46,8 @@ def serialize_comicxml(doujinshi, dir):
|
||||
xml_write_simple_tag(f, 'NhentaiId', doujinshi.id)
|
||||
xml_write_simple_tag(f, 'Genre', doujinshi.info.categories)
|
||||
|
||||
xml_write_simple_tag(f, 'BlackAndWhite', 'No' if doujinshi.info.tags and 'full color' in doujinshi.info.tags else 'Yes')
|
||||
xml_write_simple_tag(f, 'BlackAndWhite', 'No' if doujinshi.info.tags and
|
||||
'full color' in doujinshi.info.tags else 'Yes')
|
||||
|
||||
if doujinshi.info.date:
|
||||
dt = parse_date(doujinshi.info.date)
|
||||
@ -59,13 +61,14 @@ def serialize_comicxml(doujinshi, dir):
|
||||
if doujinshi.info.tags:
|
||||
xml_write_simple_tag(f, 'Tags', doujinshi.info.tags)
|
||||
if doujinshi.info.artists:
|
||||
xml_write_simple_tag(f, 'Writer', ' & '.join([i.strip() for i in doujinshi.info.artists.split(',')]))
|
||||
# if doujinshi.info.groups:
|
||||
# metadata['group'] = [i.strip() for i in doujinshi.info.groups.split(',')]
|
||||
xml_write_simple_tag(f, 'Writer', ' & '.join([i.strip() for i in
|
||||
doujinshi.info.artists.split(',')]))
|
||||
|
||||
if doujinshi.info.languages:
|
||||
languages = [i.strip() for i in doujinshi.info.languages.split(',')]
|
||||
xml_write_simple_tag(f, 'Translated', 'Yes' if 'translated' in languages else 'No')
|
||||
[xml_write_simple_tag(f, 'Language', i) for i in languages if i != 'translated']
|
||||
[xml_write_simple_tag(f, 'LanguageISO', LANGUAGEISO[i]) for i in languages
|
||||
if (i != 'translated' and i in LANGUAGEISO)]
|
||||
|
||||
f.write('</ComicInfo>')
|
||||
|
||||
@ -120,7 +123,7 @@ def serialize_unique(lst):
|
||||
def set_js_database():
|
||||
with open('data.js', 'w') as f:
|
||||
indexed_json = merge_json()
|
||||
unique_json = json.dumps(serialize_unique(indexed_json), separators=','':')
|
||||
indexed_json = json.dumps(indexed_json, separators=','':')
|
||||
unique_json = json.dumps(serialize_unique(indexed_json), separators=(',', ':'))
|
||||
indexed_json = json.dumps(indexed_json, separators=(',', ':'))
|
||||
f.write('var data = ' + indexed_json)
|
||||
f.write(';\nvar tags = ' + unique_json)
|
||||
|
@ -10,24 +10,35 @@ import sqlite3
|
||||
|
||||
from nhentai import constant
|
||||
from nhentai.logger import logger
|
||||
from nhentai.serializer import serialize_json, serialize_comicxml, set_js_database
|
||||
from nhentai.serializer import serialize_json, serialize_comic_xml, set_js_database
|
||||
|
||||
|
||||
MAX_FIELD_LENGTH = 100
|
||||
|
||||
|
||||
def request(method, url, **kwargs):
|
||||
session = requests.Session()
|
||||
session.headers.update({
|
||||
'Referer': constant.LOGIN_URL,
|
||||
'User-Agent': 'nhentai command line client (https://github.com/RicterZ/nhentai)',
|
||||
'User-Agent': constant.CONFIG['useragent'],
|
||||
'Cookie': constant.CONFIG['cookie']
|
||||
})
|
||||
return getattr(session, method)(url, proxies=constant.CONFIG['proxy'], verify=False, **kwargs)
|
||||
|
||||
if not kwargs.get('proxies', None):
|
||||
kwargs['proxies'] = constant.CONFIG['proxy']
|
||||
|
||||
return getattr(session, method)(url, verify=False, **kwargs)
|
||||
|
||||
|
||||
def check_cookie():
|
||||
response = request('get', constant.BASE_URL).text
|
||||
username = re.findall('"/users/\d+/(.*?)"', response)
|
||||
response = request('get', constant.BASE_URL)
|
||||
if response.status_code == 503 and 'cf-browser-verification' in response.text:
|
||||
logger.error('Blocked by Cloudflare captcha, please set your cookie and useragent')
|
||||
exit(-1)
|
||||
|
||||
username = re.findall('"/users/\d+/(.*?)"', response.text)
|
||||
if not username:
|
||||
logger.error('Cannot get your username, please check your cookie or use `nhentai --cookie` to set your cookie')
|
||||
logger.warning('Cannot get your username, please check your cookie or use `nhentai --cookie` to set your cookie')
|
||||
else:
|
||||
logger.info('Login successfully! Your username: {}'.format(username[0]))
|
||||
|
||||
@ -70,6 +81,13 @@ def generate_html(output_dir='.', doujinshi_obj=None, template='default'):
|
||||
else:
|
||||
doujinshi_dir = '.'
|
||||
|
||||
if not os.path.exists(doujinshi_dir):
|
||||
logger.warning('Path \'{0}\' does not exist, creating.'.format(doujinshi_dir))
|
||||
try:
|
||||
os.makedirs(doujinshi_dir)
|
||||
except EnvironmentError as e:
|
||||
logger.critical('{0}'.format(str(e)))
|
||||
|
||||
file_list = os.listdir(doujinshi_dir)
|
||||
file_list.sort()
|
||||
|
||||
@ -166,11 +184,11 @@ def generate_main_html(output_dir='./'):
|
||||
logger.warning('Writing Main Viewer failed ({})'.format(str(e)))
|
||||
|
||||
|
||||
def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False, write_comic_info=False):
|
||||
def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False, write_comic_info=True):
|
||||
if doujinshi_obj is not None:
|
||||
doujinshi_dir = os.path.join(output_dir, doujinshi_obj.filename)
|
||||
if write_comic_info:
|
||||
serialize_comicxml(doujinshi_obj, doujinshi_dir)
|
||||
serialize_comic_xml(doujinshi_obj, doujinshi_dir)
|
||||
cbz_filename = os.path.join(os.path.join(doujinshi_dir, '..'), '{}.cbz'.format(doujinshi_obj.filename))
|
||||
else:
|
||||
cbz_filename = './doujinshi.cbz'
|
||||
@ -194,8 +212,6 @@ def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False, write_
|
||||
def generate_pdf(output_dir='.', doujinshi_obj=None, rm_origin_dir=False):
|
||||
try:
|
||||
import img2pdf
|
||||
except ImportError:
|
||||
logger.error("Please install img2pdf package by using pip.")
|
||||
|
||||
"""Write images to a PDF file using img2pdf."""
|
||||
if doujinshi_obj is not None:
|
||||
@ -223,6 +239,9 @@ def generate_pdf(output_dir='.', doujinshi_obj=None, rm_origin_dir=False):
|
||||
|
||||
logger.log(15, 'PDF file has been written to \'{0}\''.format(doujinshi_dir))
|
||||
|
||||
except ImportError:
|
||||
logger.error("Please install img2pdf package by using pip.")
|
||||
|
||||
|
||||
def unicode_truncate(s, length, encoding='utf-8'):
|
||||
"""https://stackoverflow.com/questions/1809531/truncating-unicode-so-it-fits-a-maximum-size-when-encoded-for-wire-transfer
|
||||
@ -231,7 +250,7 @@ def unicode_truncate(s, length, encoding='utf-8'):
|
||||
return encoded.decode(encoding, 'ignore')
|
||||
|
||||
|
||||
def format_filename(s):
|
||||
def format_filename(s, length=MAX_FIELD_LENGTH, _truncate_only=False):
|
||||
"""
|
||||
It used to be a whitelist approach allowed only alphabet and a part of symbols.
|
||||
but most doujinshi's names include Japanese 2-byte characters and these was rejected.
|
||||
@ -239,16 +258,20 @@ def format_filename(s):
|
||||
if filename include forbidden characters (\'/:,;*?"<>|) ,it replace space character(' ').
|
||||
"""
|
||||
# maybe you can use `--format` to select a suitable filename
|
||||
|
||||
if not _truncate_only:
|
||||
ban_chars = '\\\'/:,;*?"<>|\t'
|
||||
filename = s.translate(str.maketrans(ban_chars, ' ' * len(ban_chars))).strip()
|
||||
filename = ' '.join(filename.split())
|
||||
print(repr(filename))
|
||||
|
||||
while filename.endswith('.'):
|
||||
filename = filename[:-1]
|
||||
else:
|
||||
filename = s
|
||||
|
||||
if len(filename) > 100:
|
||||
filename = filename[:100] + u'…'
|
||||
# limit `length` chars
|
||||
if len(filename) >= length:
|
||||
filename = filename[:length - 1] + u'…'
|
||||
|
||||
# Remove [] from filename
|
||||
filename = filename.replace('[]', '').strip()
|
||||
@ -280,6 +303,34 @@ def paging(page_string):
|
||||
return page_list
|
||||
|
||||
|
||||
def generate_metadata_file(output_dir, table, doujinshi_obj=None):
|
||||
logger.info('Writing Metadata Info')
|
||||
|
||||
if doujinshi_obj is not None:
|
||||
doujinshi_dir = os.path.join(output_dir, doujinshi_obj.filename)
|
||||
else:
|
||||
doujinshi_dir = '.'
|
||||
|
||||
logger.info(doujinshi_dir)
|
||||
|
||||
f = open(os.path.join(doujinshi_dir, 'info.txt'), 'w', encoding='utf-8')
|
||||
|
||||
fields = ['TITLE', 'ORIGINAL TITLE', 'AUTHOR', 'ARTIST', 'CIRCLE', 'SCANLATOR',
|
||||
'TRANSLATOR', 'PUBLISHER', 'DESCRIPTION', 'STATUS', 'CHAPTERS', 'PAGES',
|
||||
'TAGS', 'TYPE', 'LANGUAGE', 'RELEASED', 'READING DIRECTION', 'CHARACTERS',
|
||||
'SERIES', 'PARODY', 'URL']
|
||||
special_fields = ['PARODY', 'TITLE', 'ORIGINAL TITLE', 'CHARACTERS', 'AUTHOR',
|
||||
'LANGUAGE', 'TAGS', 'URL', 'PAGES']
|
||||
|
||||
for i in range(len(fields)):
|
||||
f.write('{}: '.format(fields[i]))
|
||||
if fields[i] in special_fields:
|
||||
f.write(str(table[special_fields.index(fields[i])][1]))
|
||||
f.write('\n')
|
||||
|
||||
f.close()
|
||||
|
||||
|
||||
class DB(object):
|
||||
conn = None
|
||||
cur = None
|
||||
|
25
nhentai/viewer/minimal/index.html
Normal file
25
nhentai/viewer/minimal/index.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes, viewport-fit=cover" />
|
||||
<title>{TITLE}</title>
|
||||
<style>
|
||||
{STYLES}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav id="list" hidden=true>
|
||||
{IMAGES}</nav>
|
||||
|
||||
<div id="image-container">
|
||||
<div id="dest"></div>
|
||||
<span id="page-num"></span>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
{SCRIPTS}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
79
nhentai/viewer/minimal/scripts.js
Normal file
79
nhentai/viewer/minimal/scripts.js
Normal file
@ -0,0 +1,79 @@
|
||||
const pages = Array.from(document.querySelectorAll('img.image-item'));
|
||||
let currentPage = 0;
|
||||
|
||||
function changePage(pageNum) {
|
||||
const previous = pages[currentPage];
|
||||
const current = pages[pageNum];
|
||||
|
||||
if (current == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
previous.classList.remove('current');
|
||||
current.classList.add('current');
|
||||
|
||||
currentPage = pageNum;
|
||||
|
||||
const display = document.getElementById('dest');
|
||||
display.style.backgroundImage = `url("${current.src}")`;
|
||||
|
||||
scroll(0,0)
|
||||
|
||||
document.getElementById('page-num')
|
||||
.innerText = [
|
||||
(pageNum + 1).toLocaleString(),
|
||||
pages.length.toLocaleString()
|
||||
].join('\u200a/\u200a');
|
||||
}
|
||||
|
||||
changePage(0);
|
||||
|
||||
document.getElementById('image-container').onclick = event => {
|
||||
const width = document.getElementById('image-container').clientWidth;
|
||||
const clickPos = event.clientX / width;
|
||||
|
||||
if (clickPos < 0.5) {
|
||||
changePage(currentPage - 1);
|
||||
} else {
|
||||
changePage(currentPage + 1);
|
||||
}
|
||||
};
|
||||
|
||||
document.onkeypress = event => {
|
||||
switch (event.key.toLowerCase()) {
|
||||
// Previous Image
|
||||
case 'w':
|
||||
scrollBy(0, -40);
|
||||
break;
|
||||
case 'a':
|
||||
changePage(currentPage - 1);
|
||||
break;
|
||||
// Return to previous page
|
||||
case 'q':
|
||||
window.history.go(-1);
|
||||
break;
|
||||
// Next Image
|
||||
case ' ':
|
||||
case 's':
|
||||
scrollBy(0, 40);
|
||||
break;
|
||||
case 'd':
|
||||
changePage(currentPage + 1);
|
||||
break;
|
||||
}// remove arrow cause it won't work
|
||||
};
|
||||
|
||||
document.onkeydown = event =>{
|
||||
switch (event.keyCode) {
|
||||
case 37: //left
|
||||
changePage(currentPage - 1);
|
||||
break;
|
||||
case 38: //up
|
||||
break;
|
||||
case 39: //right
|
||||
changePage(currentPage + 1);
|
||||
break;
|
||||
case 40: //down
|
||||
break;
|
||||
}
|
||||
};
|
75
nhentai/viewer/minimal/styles.css
Normal file
75
nhentai/viewer/minimal/styles.css
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
*, *::after, *::before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
html, body {
|
||||
display: flex;
|
||||
background-color: #e8e6e6;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
#list {
|
||||
height: 2000px;
|
||||
overflow: scroll;
|
||||
width: 260px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#list img {
|
||||
width: 200px;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
margin: 15px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#list img.current {
|
||||
background: #0003;
|
||||
}
|
||||
|
||||
#image-container {
|
||||
flex: auto;
|
||||
height: 100%;
|
||||
background: rgb(0, 0, 0);
|
||||
color: rgb(100, 100, 100);
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#image-container #dest {
|
||||
height: 2000px;
|
||||
width: 100%;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
background-position: top;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 100%;
|
||||
max-height: 100vh;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#image-container #page-num {
|
||||
position: static;
|
||||
font-size: 9pt;
|
||||
left: 10px;
|
||||
bottom: 5px;
|
||||
font-weight: bold;
|
||||
opacity: 0.9;
|
||||
text-shadow: /* Duplicate the same shadow to make it very strong */
|
||||
0 0 2px #222,
|
||||
0 0 2px #222,
|
||||
0 0 2px #222;
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
requests>=2.5.0
|
||||
soupsieve<2.0
|
||||
soupsieve
|
||||
BeautifulSoup4>=4.0.0
|
||||
threadpool>=1.2.7
|
||||
tabulate>=0.7.5
|
||||
future>=0.15.2
|
||||
iso8601 >= 0.1
|
||||
|
Reference in New Issue
Block a user