YQL returning duplicate results for title and dc:title
I am using YQL to parse multiple rss feeds. I have success getting YQL to return the XML for title,link,date but it also pulls in dc:title which makes for duplicate results. I have tried using dc:title but get a syntax error. Here's the YQL statement.
select title,link,description,date from rss where url in (
'http://somerssfeed.com',
'http://somerssfeed.com'
) | sort(field="date", descending="true")
What would be the correct syntax to use dc:title? Also, is it possible for YQL to rename dc:t开发者_JAVA百科itle in the xml output to just title?
As you have seen, YQL ignores namespaces when you specify the projection (the fields to retrieve). So, the correct syntax is what you already have; you cannot differentiate the title
and dc:title
fields in the manner that you want.
You could however manipulate the data in any way that you like (including removing, renaming, reordering of fields/results) in a bespoke data table.
If that sounds like too much hard work, you could append a unique()
filter to the end of your existing query to return only one result per unique title
/dc:title
, to merge the duplicates that you are getting, like … | unique(field="title")
.
精彩评论