diff --git a/build/lib/pikax/api/androidclient.py b/build/lib/pikax/api/androidclient.py index b7e07d8..b96d55d 100644 --- a/build/lib/pikax/api/androidclient.py +++ b/build/lib/pikax/api/androidclient.py @@ -148,20 +148,14 @@ def _get_search_start_url(cls, keyword, search_type, match, sort, search_range): cls._check_params(match=match, sort=sort, search_range=search_range) if search_type and not params.SearchType.is_valid(search_type): raise BaseClientException(f'search type must be type of {params.SearchType}') - param = { - 'word': str(keyword) - } - - if search_type is not params.SearchType.USER: - param['search_target'] = match.value - param['sort'] = sort.value - - if search_range: - if params.Range.is_valid(search_range): - search_range = search_range.value - today = datetime.date.today() - param['start_date'] = str(today) - param['end_date'] = str(today - search_range) + param = {'word': str(keyword), 'search_target': match.value, 'sort': sort.value} + + if search_range: + if params.Range.is_valid(search_range): + search_range = search_range.value + today = datetime.date.today() + param['start_date'] = str(today) + param['end_date'] = str(today - search_range) encoded_params = urllib.parse.urlencode(param) return cls._search_url.format(type=search_type.value) + encoded_params diff --git a/build/lib/pikax/models.py b/build/lib/pikax/models.py index 757e71a..9c36a11 100644 --- a/build/lib/pikax/models.py +++ b/build/lib/pikax/models.py @@ -363,7 +363,6 @@ def download(self, pikax_result: PikaxResult, folder: str = ''): download_function = self.download_type_to_function[pikax_result.download_type] download_function = functools.partial(download_function, folder=folder) - # artworks = self.config_artworks(pikax_result.artworks) artworks = pikax_result.artworks successes = [] fails = [] @@ -380,6 +379,8 @@ def download(self, pikax_result: PikaxResult, folder: str = ''): curr_artwork += 1 for download_detail in download_details: curr_page += 1 + if curr_page > settings.MAX_PAGES_PER_ARTWORK: + break status, msg = download_detail info = str(msg) + ' ' + str(status.value) if status is Artwork.DownloadStatus.OK: diff --git a/build/lib/pikax/settings.py b/build/lib/pikax/settings.py index 02aecfb..c01fd14 100644 --- a/build/lib/pikax/settings.py +++ b/build/lib/pikax/settings.py @@ -19,9 +19,9 @@ MAX_RETRIES_FOR_REQUEST = 3 """ -Minimum waiting time between two successive requests, -Please set this number to a suitable amount to reduce -pressure of Pixiv server +Minimum waiting time in seconds between two successive requests, +Set this number to a suitable amount to reduce +chances of getting block """ DELAY_PER_REQUEST = None @@ -40,12 +40,8 @@ """ LOG_TYPE 'inform': print successive stage and error only -'std': allow normal printings +'std': allow debug printings 'save': save error to LOG_FILE only -'inform save': will do both inform and save etc .. -'': log nothing - -'inform', 'std' and 'warn' are different outputs """ LOG_STD = False LOG_INFORM = True @@ -73,16 +69,6 @@ """ CLEAR_LINE = '\r' + ' ' * 100 + '\r' -""" -Maximum number of threads to used per process -""" -MAX_THREAD_PER_PROCESS = 4 - -""" -Minimum items per process, if more than is given -""" -MIN_ITEMS_PER_THREAD = 10 - """ Indicate a failure when there's too much exceptions occurred during requesting in the same loop """ @@ -99,7 +85,7 @@ sometimes is not desire to download all of them, None means download all pages """ -MAX_PAGES_PER_ARTWORK = 3 +MAX_PAGES_PER_ARTWORK = None """ file for saving cookies diff --git a/dist/pikax-2.0.2-py3-none-any.whl b/dist/pikax-2.0.2-py3-none-any.whl new file mode 100644 index 0000000..fb0cf97 Binary files /dev/null and b/dist/pikax-2.0.2-py3-none-any.whl differ diff --git a/dist/pikax-2.0.2.tar.gz b/dist/pikax-2.0.2.tar.gz new file mode 100644 index 0000000..883d516 Binary files /dev/null and b/dist/pikax-2.0.2.tar.gz differ diff --git a/pikax.egg-info/PKG-INFO b/pikax.egg-info/PKG-INFO index 69cfdd8..52fa41c 100644 --- a/pikax.egg-info/PKG-INFO +++ b/pikax.egg-info/PKG-INFO @@ -1,13 +1,13 @@ Metadata-Version: 2.1 Name: pikax -Version: 2.0.1 +Version: 2.0.2 Summary: A Pixiv Mass Downloading Tool Home-page: https://github.com/Redcxx/Pikax Author: Redcxx Author-email: weilue.luo@student.manchester.ac.uk License: UNKNOWN Description: # Pikax:unicorn: - ![GitHub stars](https://img.shields.io/github/stars/Redcxx/pikax?color=000&style=flat-square) ![PyPI](https://img.shields.io/pypi/v/pikax?color=000&style=flat-square) ![PyPI - License](https://img.shields.io/pypi/l/pikax?color=000&style=flat-square) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Redcxx/pikax?color=000&style=flat-square) ![GitHub last commit](https://img.shields.io/github/last-commit/Redcxx/pikax?color=000&style=flat-square) ![PyPI - Downloads](https://img.shields.io/pypi/dw/pikax?color=000&style=flat-square) + ![GitHub stars](https://img.shields.io/github/stars/Redcxx/pikax?color=000&style=flat-square) ![PyPI](https://img.shields.io/pypi/v/pikax?color=000&style=flat-square) ![PyPI - License](https://img.shields.io/pypi/l/pikax?color=000&style=flat-square) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Redcxx/pikax?color=000&style=flat-square) ![GitHub last commit](https://img.shields.io/github/last-commit/Redcxx/pikax?color=000&style=flat-square) ![PyPI - Downloads](https://img.shields.io/pypi/dw/pikax?color=000&style=flat-square)
Pikax的目的是提供一个使用简单且强大的[Pixiv](https://www.pixiv.net/)\[P站\]批量下载工具。 #### [English ver](https://github.com/Redcxx/Pixiv-Crawler/blob/master/README.en.md) @@ -15,6 +15,7 @@ Description: # Pikax:unicorn: # 当前的v2跟v1不兼容,v1用户谨慎更新,deprecated文件夹有v1的源码 pip install Pikax # 当前的发布 ```` + ![demo-gif](https://github.com/Redcxx/Pikax/blob/master/demo.gif) --- ## 需要 - [Python3](https://www.python.org/downloads/) @@ -25,7 +26,7 @@ Description: # Pikax:unicorn: ``` ### 目前支持的下载功能 - 搜索 - - 关键字/标签,数量,类别,尺寸,模式,受欢迎程度 + - 关键字/标签,数量,类别,模式,受欢迎程度 - 排行榜 - 日期,数量,模式,内容种类 - 你的或者别人的 @@ -37,9 +38,6 @@ Description: # Pikax:unicorn: - 作品/画师 过滤 - 。。。 - 有人再做吧,我自己够用了owo - --- - ### 个性化设置请前往[settings.py](https://github.com/Redcxx/Pixiv-Crawler/blob/master/pikax/settings.py) - --- ## 试用 [demo.py](https://github.com/Redcxx/Pixiv-Crawler/blob/master/demo.py) #### 下载当日排行榜前20的插画 ```` @@ -49,7 +47,7 @@ Description: # Pikax:unicorn: results = pixiv.rank(limit=50) pixiv.download(results) ```` - #### 搜索并下载arknights相关,赞数约10000的10张插画 + #### 搜索并下载arknights相关,赞数约1000的50张插画 ```` from pikax.pikax import Pikax, settings, params @@ -115,12 +113,15 @@ Description: # Pikax:unicorn: pixiv.download(new_results) # 下载 ```` #### 更多操作请参考[models.py](https://github.com/Redcxx/Pikax/blob/master/pikax/models.py) + ### 个性化设置请前往[settings.py](https://github.com/Redcxx/Pixiv-Crawler/blob/master/pikax/settings.py) + --- ### 致v1用户 - 我移除了一部分功能比如自动设置r18和尺寸搜索设置,这是因为为了解决登录问题我模拟了他们在安卓应用上的登录,但是手机应用有些设定是不支持的,比如我刚刚说的那两个,为了有一个统一的接口我决定移除他们。虽然我已经找到了解决的办法但是这个办法需要我大量的精力和时间去实现并且要求额外的依赖,而我只是一个可怜的学生因此只可能在以后有空的时候做一下,不过不能保证真的会做。。。 - 现在基本上所有输入的参数都可以在params.py的找到,里面几乎涵盖了所有参数的枚举 - 更棒的打印,现在跳过的画作只会在下载后显示,而且加入了剩余时间的估算 - #### 联系我可发邮件只到[这里](mailto:weilue.luo@student.manchester.ac.uk) + #### 联系我可发邮件到[这里](mailto:weilue.luo@student.manchester.ac.uk) + Platform: UNKNOWN Classifier: Programming Language :: Python :: 3 Classifier: License :: OSI Approved :: MIT License diff --git a/setup.py b/setup.py index 16966d9..4017e09 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setuptools.setup( name="pikax", - version="2.0.1", + version="2.0.2", author="Redcxx", author_email="weilue.luo@student.manchester.ac.uk", description="A Pixiv Mass Downloading Tool",