I rewrote the script from my previous post to pull a couple more sources and sort them by publication date.
– Using the Yahoo-generated REST query seems to work better than assembling it myself, but I’m not sure why. When I build it, it returns the results, but it doesn’t sort them — it’s just the feeds stacked on top of each other.
– I borrowed the sub-query code to sort and filter unique entries from this question on Stack Overflow. Again, I haven’t been able to get it to work when generating it in the script. More investigation here is needed.
– It’s hard to tell which feed is which when you get the merged data back. I wrote some quick regexps that test the link URL, but that’s not ideal. It’s not clear if there’s a clean solution. I feel relatively comfortable with it because we’re consuming our own data sources.
– To limit the number of results, use truncate. It may seem obvious, but using limit doesn’t do what you want. “Piping” the result to truncate at the end is right (I think).
– Don’t select *. By grabbing only the fields you need, you reduce the size of response by a lot. The body of the posts are really big, for example.
– jQuery loves trying to make life easier with anonymous callbacks, but it breaks caching. I think. Anyway, if you define you callback function, you’re probably making it easier for Yahoo to cache the query. The WordPress blogs aren’t especially speedy, so in addition to reducing load for Yahoo, it may decrease client load times by caching. I’m not sure about any of that. Maybe Yahoo can cache the same query with different callbacks. I should probably back up these claims with some research and experiments.
Future: I’d like to pull the images from the blog to tease them. This conflicts with the don’t-select-everything idea because the image tags are in the post body. I have two ideas so far to fix this: Get the image URL into a different field (maybe the summary?) or perform a second query on the client to get the post’s body data.