The first step towards grabbing the top 10 diggs over the past 12 hours is working with the Digg API. Digg has set up their API to make the information on Digg.com easily available to everyone. If you take a look at the "List Stories" link on the far right, you will see some documentation on how to use the api to grab a list of stories -- which is exactly what we want.
Since we know that we want a list of stories for our end goal, the url that we are going to use for the api is going to start like this:
- http://services.digg.com/stories
- count=100
- min_promote_date=[current time - 12 hours]
- appkey = [the url making the request, or something similar]
http://services.digg.com/stories/popular?count=100&min_promote_
date=1185219546&appkey=http://red-top10.blogspot.com
Here is the explanation: We set count to 100 because we want the most results possible, and Digg sets a limit of 100 on the number of stories returned. In case you are curious, the default for count is 10 if you decide not to specify a number for it. The min_promote_date is required to be in the number of seconds since the unix epoch time format. The time I just put into that link was at Monday, July 23rd 2007, 8:12:27 (GMT). This is because at the moment I wrote the link, Monday, July 23rd 2007, 8:12:27 (GMT) was exactly 12 hours ago. Last, appkey always needs to be set in order to use the api, and it needs to be set to the url making the request or a few other options. Here is how Digg describes what it needs to be:
- The application itself, if it's a web application.
- A web page describing the application.
- A web page offering the application for download.
- The author's web site.
No comments:
Post a Comment