Skip to content

Commit 5f43145

Browse files
committed
Change example from PAPI to App-API
1 parent 15c6485 commit 5f43145

File tree

1 file changed

+58
-23
lines changed

1 file changed

+58
-23
lines changed

README.md

+58-23
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ PixivPy [![Build Status](https://travis-ci.org/upbit/pixivpy.svg)](https://travi
22
======
33
_Pixiv API for Python (with Auth supported)_
44

5+
* [2017/01/05] Add `AppPixivAPI().illust_detail()` to like `PixivAPI().works()` (thanks [Mapaler](https://github.com/Mapaler)), release v3.3
56
* [2016/12/17] Fixed encoding BUG for Public-API, see #26 (thanks [Xdynix](https://github.com/Xdynix))
67
* [2016/07/27] Now `AppPixivAPI()` can call **without auth** (thanks [zzycami](https://github.com/zzycami)), check [demo.py](https://github.com/upbit/pixivpy/blob/b83578e066ddcba86295676d931ff3313d138b22/demo.py#L268)
78
* [2016/07/20] New **App-API** (Experimental) for `PixivIOSApp/6.0.9`
@@ -22,25 +23,29 @@ Requirements: [requests](https://pypi.python.org/pypi/requests)
2223
### Example:
2324

2425
~~~python
25-
from pixivpy3 import *
26-
27-
api = PixivAPI()
28-
api.login("username", "password")
26+
api = AppPixivAPI()
27+
# api.login("username", "password") # Not required
2928

3029
# get origin url
31-
json_result = api.works(45455208)
32-
illust = json_result.response[0]
33-
print("origin url: %s" % illust.image_urls['large'])
34-
35-
# get ranking (page1)
36-
json_result = api.ranking_all('daily')
37-
ranking = json_result.response[0]
38-
for illust in ranking.works:
39-
print("[%s] %s" % (illust.work.title, illust.work.image_urls.px_480mw))
30+
json_result = api.illust_detail(59580629)
31+
illust = json_result.illust
32+
print(">>> origin url: %s" % illust.image_urls['large'])
33+
34+
# get ranking: 1-30
35+
# mode: [day, week, month, day_male, day_female, week_original, week_rookie, day_manga]
36+
json_result = api.illust_ranking('day')
37+
for illust in json_result.illusts:
38+
print(" p1 [%s] %s" % (illust.title, illust.image_urls.medium))
39+
40+
# next page: 31-60
41+
next_qs = api.parse_qs(json_result.next_url)
42+
json_result = api.illust_ranking(**next_qs)
43+
for illust in json_result.illusts:
44+
print(" p2 [%s] %s" % (illust.title, illust.image_urls.medium))
4045
~~~
4146

42-
### [Sniffer - Public API](https://github.com/upbit/pixivpy/wiki/sniffer)
4347
### [Sniffer - App API](https://github.com/upbit/pixivpy/wiki#6x-api)
48+
### [Sniffer - Public API](https://github.com/upbit/pixivpy/wiki/sniffer)
4449

4550
### [Using AppPixivAPI() to download illusts (without auth)](https://github.com/upbit/pixivpy/blob/master/download_illusts.py#L24)
4651

@@ -86,9 +91,9 @@ Find Pixiv API in **Objective-C**? You might also like [**PixivAPI_iOS**](https:
8691

8792
~~~python
8893
class AppPixivAPI(BasePixivAPI):
89-
"""
90-
Warning: The AppPixivAPI backend is experimental !!!
91-
"""
94+
95+
# 返回翻页用参数
96+
def parse_qs(self, next_url):
9297

9398
# 用户详情 (无需登录)
9499
def user_detail(self, user_id):
@@ -99,23 +104,26 @@ class AppPixivAPI(BasePixivAPI):
99104
# 用户收藏作品列表 (无需登录)
100105
def user_bookmarks_illust(self, user_id, restrict='public'):
101106

102-
# 作品排行
103-
# mode: [day, week, month, day_male, day_female, week_original, week_rookie, day_manga]
104-
# date: '2016-08-01'
105-
# mode(r18榜单需登录): [day_r18, day_male_r18, day_female_r18, week_r18, week_r18g]
106-
def illust_ranking(self, mode='day', date=None, offset=None):
107-
108107
# 关注用户的新作
109108
# restrict: [public, private]
110109
def illust_follow(self, restrict='public'):
111110

111+
# 作品详情 (无需登录,同PAPI.works)
112+
def illust_detail(self, illust_id):
113+
112114
# 相关作品列表 (无需登录)
113115
def illust_related(self, illust_id):
114116

115117
# 插画推荐 (Home - Main) (无需登录)
116118
# content_type: [illust, manga]
117119
def illust_recommended(self, content_type='illust'):
118120

121+
# 作品排行
122+
# mode: [day, week, month, day_male, day_female, week_original, week_rookie, day_manga]
123+
# date: '2016-08-01'
124+
# mode(r18榜单需登录): [day_r18, day_male_r18, day_female_r18, week_r18, week_r18g]
125+
def illust_ranking(self, mode='day', date=None, offset=None):
126+
119127
# 趋势标签 (Search - tags) (无需登录)
120128
def trending_tags_illust(self):
121129

@@ -127,6 +135,33 @@ class AppPixivAPI(BasePixivAPI):
127135
# sort: [date_desc, date_asc]
128136
# duration: [within_last_day, within_last_week, within_last_month]
129137
def search_illust(self, word, search_target='partial_match_for_tags', sort='date_desc', duration=None):
138+
139+
# 作品收藏详情 (无需登录)
140+
def illust_bookmark_detail(self, illust_id):
141+
142+
# 新增收藏
143+
def illust_bookmark_add(self, illust_id, restrict='public', tags=None):
144+
145+
# 删除收藏
146+
def illust_bookmark_delete(self, illust_id):
147+
148+
# 用户收藏标签列表
149+
def user_bookmark_tags_illust(self, restrict='public', offset=None):
150+
151+
# Following用户列表 (无需登录)
152+
def user_following(self, user_id, restrict='public', offset=None):
153+
154+
# Followers用户列表 (无需登录)
155+
def user_follower(self, user_id, filter='for_ios', offset=None):
156+
157+
# 好P友 (无需登录)
158+
def user_mypixiv(self, user_id, offset=None):
159+
160+
# 黑名单用户 (无需登录)
161+
def user_list(self, user_id, filter='for_ios', offset=None):
162+
163+
# 获取ugoira信息
164+
def ugoira_metadata(self, illust_id):
130165
~~~
131166

132167
[Usage](https://github.com/upbit/pixivpy/blob/master/demo.py#L42):

0 commit comments

Comments
 (0)