Pocket offline reading software has recently been installed.
To bookmark the desired URL, open the browser every time. Then press pocket+ on the Google toolbar.
This process is very slow when there are many pages.
Based on the API introduction of the Pocket website, I can create a new app to manipulate my favorites directly.
I wrote a python script that you might be able to look at. Https://github.com/febwave/python-script
1. Create an App
First you have to create a pocket account.
Then create a new app from http://getpocket.com/developer/apps/that belongs to you.
Record the consumer KEY.
For follow-up instructions, my app name: Pybatchurl. CONSUMER key:36822-6df058ece34310d6dceda601
2. Preparatory work
Read API Notes
Http://getpocket.com/developer/docs/v3/preferences-api
I believe everyone can understand, I will not translate. Just remember to use the HTTPS and post methods.
Test tool: Fiddler2.
3. Get Request Token
Website: https://getpocket.com/v3/oauth/request
Request-header:
Content-type:application/json; Charset=utf-8
X-accept:application/json
Host:getpocket.com
Request-body:
{"Consumer_key": "36822-6df058ece34310d6dceda601", "Redirect_uri": "Pybatchurl:authorizationfinished"}
Note: Pybatchurl is the name of my app.
Response
{"Code": "1F183197-A099-1C67-4E59-3345DC", "state": null}
Code is the request token.
4. The user authorization, the manual execution browser, should only need once, the successful landing can. If this step is not done, obtaining an access token will fail.
HTTPS://GETPOCKET.COM/AUTH/AUTHORIZE?REQUEST_TOKEN=1F183197-A099-1C67-4E59-3345DC&REDIRECT_URI=PYBATCHURL: Authorizationfinished
5. Accessing tokens access token
Website: https://getpocket.com/v3/oauth/authorize
Request-header
Content-type:application/json; Charset=utf-8
X-accept:application/json
Request-body
{"Consumer_key": "36822-6df058ece34310d6dceda601", "Code": "1F183197-A099-1C67-4E59-3345DC"}
Response
{"Access_token": "8f608123-0000-0000-0000-26c49e", "username":[email protected]}
Access_token is an access token, and subsequent applications rely on it to access your favorites.
Username is a user registered account.
6. Add a new page
Website: https://getpocket.com/v3/add
Request-header
Host:getpocket.com
Content-type:application/json; Charset=utf-8
X-accept:application/json
Request-body: I want to add Sina, for example.
{"url": "http:\/\/www.sina.com.cn", "title": "Sina", "Consumer_key": "36822-6df058ece34310d6dceda601", "Access_token ":" 8f608123-0000-0000-0000-26c49e "}
Response
{
' Item ': {
"item_id": "173403",
"Normal_url": "http://sina.com.cn",
"resolved_id": "173403",
"extended_item_id": "173403",
"Resolved_url": "http://www.sina.com.cn/",
"domain_id": "663938",
"origin_domain_id": "663938",
"Response_code": "200",
"Mime_type": "",
"Content_length": "117286",
"Encoding": "gb2312",
"Date_resolved": "2014-12-13 02:58:17",
"date_published": "0000-00-00 00:00:00",
"title": "Sina homepage",
"Excerpt": "Sina News"}
"Status": 1
}
}
7. Get the checklist
Website: https://getpocket.com/v3/get
Request-header
Host:getpocket.com
Content-type:application/json
Request-body I'll just get one, count is optional
{"Consumer_key": "36822-6df058ece34310d6dceda601", "Access_token": "8f608123-0000-0000-0000-26c49e", "Count": "1", " Detailtype ":" Simple "}
Response
{
"Status": 1,
"Complete": 1,
"List": {
"173403": {
"item_id": "173403",
"resolved_id": "173403",
"Given_url": "http://www.sina.com.cn",
"Given_title": "Sina",
"Favorite": "0",
"Status": "0",
"time_added": "1421909498",
"time_updated": "1421909498",
"Time_read": "0",
"time_favorited": "0",
"sort_id": 0,
"Resolved_title": "Sina homepage",
"Resolved_url": "http://www.sina.com.cn/",
"Excerpt": "Sina News",
"Is_article": "0",
"Is_index": "1",
"Has_video": "0",
"Has_image": "1",
"Word_count": "0"
}
},
"Error": null,
"Search_meta": {
"Search_type": "Normal"
},
"Since": 1421909572
}
Pocket API Learning Notes