diff --git a/README.md b/README.md index 44322704..51d967c5 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,6 @@ class AppPixivAPI(BasePixivAPI): ~~~python aapi = AppPixivAPI() -aapi.login(_USERNAME, _PASSWORD) # 作品推荐 json_result = aapi.illust_recommended() @@ -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'])) diff --git a/pixivpy3/api.py b/pixivpy3/api.py index e41a278c..e1cc2059 100644 --- a/pixivpy3/api.py +++ b/pixivpy3/api.py @@ -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'