#coding: utf-8
+from __future__ import print_function
from optparse import OptionParser
-from itertools import ifilter
from logger import logger
+try:
+ from itertools import ifilter as filter
+except ImportError:
+ pass
def banner():
- print ''' _ _ _ _
+ print(''' _ _ _ _
_ __ | | | | ___ _ __ | |_ __ _(_)
| '_ \| |_| |/ _ \ '_ \| __/ _` | |
| | | | _ | __/ | | | || (_| | |
|_| |_|_| |_|\___|_| |_|\__\__,_|_|
-'''
+''')
def cmd_parser():
if args.ids:
_ = map(lambda id: id.strip(), args.ids.split(','))
- args.ids = set(map(int, ifilter(lambda id: id.isdigit(), _)))
+ args.ids = set(map(int, filter(lambda id: id.isdigit(), _)))
if args.is_download and not args.id and not args.ids and not args.keyword:
logger.critical('Dojinshi id/ids is required for downloading')
+from __future__ import print_function
from constant import DETAIL_URL, IMAGE_URL
from logger import logger
def show(self):
logger.info('Print dojinshi information')
- print 'Dojinshi: %s' % self.name
- print 'Subtitle: %s' % self.subtitle
- print 'URL: %s' % self.url
- print 'Pages: %d' % self.pages
+ print('Dojinshi: %s' % self.name)
+ print('Subtitle: %s' % self.subtitle)
+ print('URL: %s' % self.url)
+ print('Pages: %d' % self.pages)
def download(self):
logger.info('Start download dojinshi: %s' % self.name)
if __name__ == '__main__':
test = Dojinshi(name='test nhentai dojinshi', id=1)
- print test
+ print(test)
test.show()
try:
test.download()
except Exception as e:
- print 'Exception: %s' % str(e)
\ No newline at end of file
+ print('Exception: %s' % str(e))
+from __future__ import print_function
import sys
import re
import requests
if not dojinshi_list:
return
logger.log(15, 'Print dojinshi list')
- print '-' * 60
+ print('-' * 60)
for dojinshi in dojinshi_list:
- print dojinshi['id'], '-', dojinshi['title']
- print '-' * 60
+ print(dojinshi['id'], '-', dojinshi['title'])
+ print('-' * 60)
if __name__ == '__main__':
- print dojinshi_parser(32271)
\ No newline at end of file
+ print(dojinshi_parser(32271))