Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Commit

Permalink
v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Redcxx committed Aug 13, 2019
1 parent 70f9a2b commit 3a75537
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 43 deletions.
22 changes: 8 additions & 14 deletions build/lib/pikax/api/androidclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion build/lib/pikax/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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:
Expand Down
24 changes: 5 additions & 19 deletions build/lib/pikax/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
"""
Expand All @@ -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
Expand Down
Binary file added dist/pikax-2.0.2-py3-none-any.whl
Binary file not shown.
Binary file added dist/pikax-2.0.2.tar.gz
Binary file not shown.
17 changes: 9 additions & 8 deletions pikax.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
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: [email protected]
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) <br>
Pikax的目的是提供一个使用简单且强大的[Pixiv](https://www.pixiv.net/)\[P站\]批量下载工具。
#### [English ver](https://github.com/Redcxx/Pixiv-Crawler/blob/master/README.en.md)

````
# 当前的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/)
Expand All @@ -25,7 +26,7 @@ Description: # Pikax:unicorn:
```
### 目前支持的下载功能
- 搜索
- 关键字/标签,数量,类别,尺寸,模式,受欢迎程度
- 关键字/标签,数量,类别,模式,受欢迎程度
- 排行榜
- 日期,数量,模式,内容种类
- 你的或者别人的
Expand All @@ -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的插画
````
Expand All @@ -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

Expand Down Expand Up @@ -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:[email protected])
#### 联系我可发邮件到[这里](mailto:[email protected])

Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="pikax",
version="2.0.1",
version="2.0.2",
author="Redcxx",
author_email="[email protected]",
description="A Pixiv Mass Downloading Tool",
Expand Down

0 comments on commit 3a75537

Please sign in to comment.