Unread Counts for Certain Time Periods

24 views
Skip to first unread message

Matt James

unread,
Feb 19, 2012, 8:00:10 PM2/19/12
to Friends of the Unofficial Google Reader API
Hi everyone,

Right now, I'm fetching only the past X days of unread articles, but
am finding it difficult to figure out how many unread articles there
are in a stream for that period of time.

I've tried using the /unread-counts/ API call, which accurately gives
me unread counts for all streams, but doesn't appear to take an "ot"
parameter like /stream/items/ids.
I've also tried doing calls to /stream/items/ids with an "xt" to
exclude read items, however, it appears as though newly subscribed
feeds return all items as not having the "read" tag associated with
them even though the web interface shows, say, the most recent 10 as
unread.

Any help is greatly appreciated!

Mihai Parparita

unread,
Feb 21, 2012, 9:16:49 PM2/21/12
to foug...@googlegroups.com
On Sun, Feb 19, 2012 at 5:00 PM, Matt James <matte...@gmail.com> wrote:
I've also tried doing calls to /stream/items/ids with an "xt" to
exclude read items, however, it appears as though newly subscribed
feeds return all items as not having the "read" tag associated with
them even though the web interface shows, say, the most recent 10 as
unread.

You need to pass in each subscription's firstitemmsec value (from http://www.google.com/reader/api/0/subscription/list) as the "ot" parameter to /stream/items/ids, so that you're looking at the same window of items.

Mihai

Matt James

unread,
Feb 22, 2012, 8:36:33 PM2/22/12
to Friends of the Unofficial Google Reader API
On Feb 21, 9:16 pm, Mihai Parparita <mih...@google.com> wrote:
> On Sun, Feb 19, 2012 at 5:00 PM, Matt James <matteja...@gmail.com> wrote:
> > I've also tried doing calls to /stream/items/ids with an "xt" to
> > exclude read items, however, it appears as though newly subscribed
> > feeds return all items as not having the "read" tag associated with
> > them even though the web interface shows, say, the most recent 10 as
> > unread.
>
> You need to pass in each subscription's firstitemmsec value (fromhttp://www.google.com/reader/api/0/subscription/list) as the "ot" parameter
> to /stream/items/ids, so that you're looking at the same window of items.
>
> Mihai

Got it. Thank you very much!!

-Matt

Matt James

unread,
Feb 22, 2012, 9:12:20 PM2/22/12
to Friends of the Unofficial Google Reader API
After looking into my problem a bit more, I noticed that my main issue
is getting the total unread count (within an arbitrary time period)
for category streams rather than individual feeds. Given that a
category may contain many feeds with varying firstitemmsec values,
what's the suggested way to go about dealing with this issue?

Thanks again for your help. It's invaluable as usual!

-Matt

Mihai Parparita

unread,
Feb 22, 2012, 9:53:33 PM2/22/12
to foug...@googlegroups.com
This may be a bug on the Reader side. In the meantime, I think you'll have to do that filtering yourself. If you do a request of the form:


Then you can look at individual item timestamps, see which feed they came from, and exclude those items if they're before the first item timestamp.

Mihai

Mihai Parparita

unread,
Feb 22, 2012, 9:57:04 PM2/22/12
to foug...@googlegroups.com
Actually, I'm not seeing this behavior, if I do a request like:


Where "test" is a folder I just made, with a newly-added subscription in it, I get the expected number of items back (10 if I leave off the "ot" parameter, fewer if I move it up to a more recent interval).

Mihai

Matt James

unread,
Feb 23, 2012, 7:39:19 PM2/23/12
to Friends of the Unofficial Google Reader API
OK, I think I get it now.

* For individual feeds, you have to give an ot value equal to that of
the firstitemmsec when querying /stream/items/ids
* For categories, you can do the request on /stream/items/ids with the
group streamId and no ot constraint.

I think the reason I got confused is that I'm actually creating a
psuedo-category in my application called "Other Feeds" that
essentially wraps up any feed not in a category. So in my case, I've
got a category that can contain many feeds and the only way to get an
unread count for those feeds is to query each feed individually,
getting their unread count with the appropriate ot parameter, and add
them up for the category. Although this is fairly inefficient to do,
I absolutely get that I'm doing something weird here that Google
Reader isn't built for.

I may end up abandoning the idea of an automated "Other Feeds"
category altogether.

Thanks again for your help!

-Matt

On Feb 22, 9:57 pm, Mihai Parparita <mih...@google.com> wrote:
> Actually, I'm not seeing this behavior, if I do a request like:
>
> https://www.google.com/reader/api/0/stream/items/ids?s=user/-/label/t...
>
> Where "test" is a folder I just made, with a newly-added subscription in
> it, I get the expected number of items back (10 if I leave off the "ot"
> parameter, fewer if I move it up to a more recent interval).
>
> Mihai
>
>
>
>
>
>
>
> On Wed, Feb 22, 2012 at 6:53 PM, Mihai Parparita <mih...@google.com> wrote:
> > This may be a bug on the Reader side. In the meantime, I think you'll have
> > to do that filtering yourself. If you do a request of the form:
>
> >https://www.google.com/reader/api/0/stream/items/ids?s=user/-/label/N...
>
> > Then you can look at individual item timestamps, see which feed they came
> > from, and exclude those items if they're before the first item timestamp.
>
> > Mihai
>
Reply all
Reply to author
Forward
0 new messages