google news reader

Share and discuss your flows and ideas with other users.

Moderator: Martin

Post Reply
vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

google news reader

Post by vamzicool » 07 Jan 2015 18:35

This single flow reads the google RSS feed and retrieves the news headlines and reads it out aloud.it uses the split function to do the dirty work.I tried using regular expression but it gave me only one single news headline. I'll be grateful if someone could help me with the regular expression part.

Thanks

http://automagic4android.com/flow.php?i ... 51b3a5fa67

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: google news reader

Post by Martin » 07 Jan 2015 21:41

Hi,

You could use XPath to extract the titles from an RSS feed. XPath is quite limited in Automagic, but might work better than regular expressions in this case since there are multiple different elements containing a title element.

Code: Select all

headlines=newList();
count=evaluateXPathAsString(response, "count(//item)");
for (i in [1 to count])
{
  title=evaluateXPathAsString(response, "//item[{i}]/title");
  addElement(headlines, title);
}
The first XPath expression counts the number of item elements. The second XPath expression extracts the n-th title (within an item) and adds the title to a list.

Regards,
Martin

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: google news reader

Post by vamzicool » 08 Jan 2015 06:03

Thanks a lot Martin, xpath works like a charm. I didn't know about this. Now I think its worth that I switched from tasker to automagic.

Post Reply