Pocket is a fantastic service that allows you to gather and share material that we find on the web and we are interested to read it later. We may collect items by most websites and from any device and then Get it back into a more suitable format for reading.
Let's see how to use the APIs provided by the site to gain access to our archive and create a simple web page to summarize our latest readings.
You can see an example of the result under the title of my blog ↑
To begin, go on the website of Pocket for developers and look at the steps that create a new app and get the keys that we need to use the API.
This makes you immediately understand that only you can access your list of saved articles and that for the moment there is no way to share this information with the world in a simple way. Maybe coming soon Facebook applications or plugins for blogs and sites which allow to integrate our reading list on our profile, but for now we can see how to do it yourself.
Since this is a simple web application, you'll obviously need a server that host it, and since I have chosen to implement it with Python and PHP, you'll have to look for some free service that provides such technologies.
To understand something as OpenShift and not Altervista
Link to download: script e page
The code is quite simple and is also commented. So just add a brief description.
This is the frame I used to put the list in my blog
<iframe name="Articles_that_i_have_read" id="InlineFrame1" style="width:1050px;height:150px;z-index:0;" src="http://my server/glo.php?count=5" scrolling="no" frameborder="0"></iframe>
Simply call the php page on my server and ask to let me have the last 5 articles I read.
The php page asks this information to the python script and then turns to me.
The script basically initializes with access keys of our application and then making the request with the parameters that we prefer. In my case
'consumer_key': 'your consumer key',
'access_token' : 'your access token' ,
'state' : 'archive',
'sort' : 'newest',
'contentTye' : 'article',
'detailType' : 'simple'
That is, here are my data, hand me the material in archives, sorted by date recently, in article form, with only essential details
The only note to make is that initially I thought that pocket API do not consider the parameter 'state' during the 'sort', so even if you ask only archived articles, you had them anyway in order of added to the pocket account, and not to the archive section. So I had to reorder the list based on the parameter time_read.
After a consultation with the team responsible for the API, I realized that it is not an error, but only a choice of implementation. The objects are sent in an order them, but can be ordered according to parameter time_read or simply sord_id.
Once obtained articles with title and link compose a simple web page to simplify navigation.
Posta un commento