开发者

Google Reader API not showing all results

开发者 https://www.devze.com 2023-03-22 21:40 出处:网络
I\'m using Google reader API to get all available items for any RSS feed. I use it as follows: http://www.google.com/reader/atom/feed/[RSS FEED LINK]?n=[NUMBER OF ITEMS TO SHOW]&r=o&ot=[UNIX

I'm using Google reader API to get all available items for any RSS feed. I use it as follows:

http://www.google.com/reader/atom/feed/[RSS FEED LINK]?n=[NUMBER OF ITEMS TO SHOW]&r=o&ot=[UNIX TIME STAMP FOR START DATE]

As I understand, this should return all items starting with the date specified by the time stamp (start date should not be older than one month ago). It works great for some feeds, but in most feeds, it doesn't show all available items (although they are available when using Google Reader).

开发者_StackOverflow中文版

For Example:

http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/Greece.rss?n=1000&r=o&ot=1306959543

this link only shows items starting with 24-07-2011 to current date although it should show items starting with 26-06-2011. If the same link (http://www.360cities.net/rss/area/Greece.rss) is read by Google Reader, it'll show much more results.

Have any solutions?


Fortunately, I found the solution to my problem after a lot of research:

  • A url in this form returns the most recent N items of the RSS Feed

    http://www.google.com/reader/atom/feed/[RSS]?n=[N]

    [N] = Number of items to be displayed (max: 1000).

    [RSS] = The url for the rss feed.

  • To get the next N older items, another parameter called Continuation String should be used. It can be found inside gr:continuation tag in each results' page. So, To get the N older items, a url in this form should be used:

    http://www.google.com/reader/atom/feed/[RSS]?n=[N]&c=[C]

    [N] = Number of items to be displayed (max: 1000).

    [RSS] = The url for the rss feed.

    [C] = Continuation string

Example:

  • Let's say we are interested to get results from http://www.360cities.net/rss/area/north-america.rss

  • To get newest 1000 item of this rss feed, The url to be used should look like:

    http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/north-america.rss?n=1000

  • To get the next older 1000 items, We should first search in the first result page and find the Continuation String. In this case the Continuation String is COnu-r7znpsC (it may be different when you view this post). Then, the url to be used should look like:

    http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/north-america.rss?n=1000&c=COnu-r7znpsC

  • To get the next older 1000 items, repeat the same process by finding the new Continuation String, etc...

  • If no Continuation String was found, this means that no more items are available.

I hope this would help someone.

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消