Skip to content

Commit

Permalink
Add new illust_ranking() for AppAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
upbit committed Aug 5, 2016
1 parent 74831e9 commit 42c133e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class AppPixivAPI(BasePixivAPI):

~~~python
aapi = AppPixivAPI()
aapi.login(_USERNAME, _PASSWORD)

# 作品推荐
json_result = aapi.illust_recommended()
Expand Down Expand Up @@ -153,8 +152,8 @@ print(json_result)
illust = json_result.illusts[0]
print(">>> %s, origin url: %s" % (illust.title, illust.image_urls['large']))

# 关注用户的新作
json_result = aapi.illust_follow()
# 关注用户的新作 (需要login)
json_result = aapi.illust_follow(req_auth=True)
print(json_result)
illust = json_result.illusts[0]
print(">>> %s, origin url: %s" % (illust.title, illust.image_urls['large']))
Expand Down
18 changes: 18 additions & 0 deletions pixivpy3/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,24 @@ def illust_recommended(self, content_type='illust', include_ranking_label=True,
r = self.no_auth_requests_call('GET', url, params=params, req_auth=req_auth)
return self.parse_result(r)

# 作品排行
# mode: [day, week, month, day_male, day_female, week_original, week_rookie, day_manga]
# date: '2016-08-01'
# mode (Past): [day, week, month, day_male, day_female, week_original, week_rookie,
# day_r18, day_male_r18, day_female_r18, week_r18, week_r18g]
def illust_ranking(self, mode='day', filter='for_ios', date=None, offset=None, req_auth=False):
url = 'https://app-api.pixiv.net/v1/illust/ranking'
params = {
'mode': mode,
'filter': filter,
}
if (date):
params['date'] = date
if (offset):
params['offset'] = offset
r = self.no_auth_requests_call('GET', url, params=params, req_auth=req_auth)
return self.parse_result(r)

# 趋势标签 (Search - tags) (无需登录)
def trending_tags_illust(self, filter='for_ios', req_auth=False):
url = 'https://app-api.pixiv.net/v1/trending-tags/illust'
Expand Down

0 comments on commit 42c133e

Please sign in to comment.