How to get YQL to only return new content (based on a given date)
Need to know how to get YQL to return only data that's newer tha开发者_如何学Gon a date that I specify.
Thanks
It depends on the Data Table you are querying and the web service that's behind it.
For example, facebook graph allows you to set a since
query parameter, and you can map a key
on it on your Data Table.
http://graph.facebook.com/search?q=watermelon&since=yesterday
If not, filter on the date
element in you results
SELECT * from foo.table WHERE date > "2011-03-11T14:00"
<results>
<post>
<title>My title</title>
<link>my link</link>
<author>fooman</author>
<date>2011-03-11T14:09</date>
<content>lorem ipsum</content>
</post>
<post>
<title>My title</title>
<link>my link</link>
<author>fooman</author>
<date>2011-03-11T15:09</date>
<content>lorem ipsum</content>
</post>
</results>
This should work, provided that your dates are formatted in a way that makes alphabetical ordering equivalent to temporal order.
If your query is something like
select title,source,description,date from rss where url in ('somerssfeed.com';, 'somerssfeed.com';) | unique(field="title") | sort(field="date", descending="true")
put the filter before the pipes:
select title,source,description,date from rss where url in ('somerssfeed.com';, 'somerssfeed.com';) and date > "2010-01-01T00:00" | unique(... [snip!]
精彩评论