For some reason I do not understand, Pocket seems to have no support for batch adding articles to the reading list. After looking around quite a bit it doesn’t even seem possible to get a simple add url so you can add them with a little batch script…
Since I still wanted to have my articles added I have written a little script to do so. It requires the Pocket library (pip install pocket) and works out of the box beyond that.
Save as add_to_pocket.py and make sure you replace the consumer_key in the code. You can get the key from http://getpocket.com/developer/apps/new
Usage is quite simple:
Or if you have a list of urls:
If people are interested I can make it into a web-app, but for the time being it solved my issue 🙂
I can’t believe they don’t have this available somewhere in the interface…
I tried your code, but got some error message that I don’t really understand. Can you help please? Thanks.
Here is the error message from the terminal.
Traceback (most recent call last):
File “add_to_pocket.py”, line 23, in
File “/Library/Python/2.7/site-packages/pocket.py”, line 326, in get_access_token
return cls._make_request(url, payload, headers)[‘access_token’]
File “/Library/Python/2.7/site-packages/pocket.py”, line 141, in _make_request
‘%s. %s’ % (error_msg, extra_info)
pocket.RateLimitException: User was authenticated, but access denied due to lack of permission or rate limiting. User rejected code.
Hey Paul. I think you haven’t created a consumer key and a request token. The code doesn’t work directly. You’re supposed to add your credentials, if you haven’t already.
Did you ever get this sorted out, Paul?
@Paul: as the error states, you are being rate limited. Ido not know what the limits are but I assumed there would be some. Just try again after a few hours.
To any other python noobs out there, don’t try to save this as “pocket.py”… oops. That makes it try to import itself.
I’m having the same error as Paul with this code, but the rate limit business makes zero sense to me, as I have added nothing with the script yet!
Hi Ethan, I’ve just tried to create a new application through the developer apps site and added the consumer-key in the code and it works like a charm for me.
Perhaps the difference is in the checkboxes when creating the app. When creating the app (http://getpocket.com/developer/apps/new) I checked the following:
Platforms: Desktop (other)
Let me know if you have more problems, you can also mail me at wolph[at]wol.ph
Hi, I used your code to create my own version of adding new links to my pocket, which I intend to run automatically on a weekly basis. But I wonder – is there a way how to authorize my app automatically without manual confirmation?
If you store the request_token instead of requesting it every time you can skip the authentication