Tasker: Read you News/Pick Headlines to Display

STtaskerI’ll start off by saying that you’ll have to excuse my potentially sloppy programming. But it seems to work and I’m open to hearing suggestions as to how to make it cleaner!

What does it do?:

This task is set up to pull the headlines from Google News and read them to you. It prefaces every headline with a number. You can then ask it to pull up ‘article #x’ and it will load the URL on your phone.

How does it work?:

This task uses the ‘Variable Split’ feature together with the ‘HTTP Get’ feature. HTTP Get lets you get the source from any URL. Variable Split allows you to parse this data. Pocketables.com did a great tutorial of this. You can find it here

The nitty gritty:

I split the work up into two separate tasks, ‘Headline Reader’ and ‘Article Display’.
Headline Reader:

1. Set Variable %NewsPiece to 4 <— I’ll get back to this later
2. Set Variable %HeadlineNumber to the value of %NewsPiece – 3
3. HTTP Get (URL of your customized Google News RSS feed, which you can get by going to news.google.com, customizing your news page and pressing the orange RSS logo at the bottom of the page). This command takes the contents of that page and puts it into a variable called %HTTPD
4. Set Variable %News to %HTTPD – This takes whatever is in %HTTPD and pastes it to a new variable called %News. This is not strictly necessary, but I like to do it anyway.
5. Variable Split
– Variable to be split – %News
– Variable splitter – <title>

That’s where it gets interesting. It just splits up the $News variable into a number of variables, wherever the text <title> appears. For example, if the data in $News said:

Hello, <title> welcome to signaltheorist </title> <link> url=http://1.com</link> this is some <title> shameless self promotion </title><link> url=http://2.com </link> <title> the narwhal bacons </title> <link> url=http://3.com </link><title> at midnight </title>

it would split it up into 5 variables (identified by adding a number at the end). In this case the result would be the creation of the following variables:

%News1 – Hello,
%News2 – welcome to signaltheorist </title> <link> url=http://1.com</link> this is some
%News3 – shameless self promotion </title><link> url=http://2.com </link>
%News4 – the narwhal bacons </title><link> url=http://3.com </link>
%News5 – at midnight </title>

Notice that the text <title> disappears. This was the point at which the text was split and it is deleted when a split occurs.
6. Set Variable %NewsSplit to %News(%NewsPiece)

%News(%NewsPiece) will basically be decyphered as %News(the value of %NewsPiece goes here). At the beginning of the task (step 1) we set the value of %NewsPiece to the number 4, so %News(%NewsPiece) will read as %News4.

Therefore, ‘Set Variable %NewsSplit to %News(%NewsPiece)’ in this case will put the contents of %News4 into %NewsSplit. So now %NewsSplit contains the text ‘the narwhal bacons </title><link> url=http://3.com </link>’
So we want to get the pieces of text ‘the narwhal bacons’ and the link ‘http://3.com’ out of this chunk and get rid of the rest of the garbage text.

7. Set Variable %NewsLink to %NewsSplit – as you should know by now, this copies the contents of %NewsSplit to %NewsLink

8. Split Variable %NewsLink at ‘url=’

This creates:

%NewsLink1 – ‘the narwhal bacons </title><link> url=’
%NewsLink2 – ‘http://3.com </link>’

So we’ve almost isolated ‘http://3.com’, just one more split to make it work

9. Split Variable %NewsLink2 at ‘</link>’

This creates:

%NewsLink21 – ‘http://3.com’
%NewsLink22 –

We now have the link isolated and need to save it as it’s own variable

10. Set Variable %NewsLink21 to %Headline(%HeadlineNumber)

If you remember, in step 2 we set %HeadlineNumber to whatever %NewsPiece is minus 3. In this case, that makes this 1. So %Headline1 now contains the text ‘http://3.com’

Now we want to isolate the text we needed. If you remember, before we went on the tangent of finding the link data, we put the data ‘the narwhal bacons </title><link> url=http://3.com </link>’ into %NewsSplit, so let’s use that to isolate the headline text we need.

11. Variable Split %NewsSplit at ‘</title>’

This creates:

%NewsSplit1 – ‘the narwhal bacons’
%NewsSplit2 – ‘<link> url=http://3.com </link>
So the data we need is in %NewsSplit1. Let’s save that seperately

12. Set Variable %NewsProcessed(%NewsPiece) to %NewsSplit1

13. Say ‘%HeadlineNumber: %NewsProcessed(%NewsPiece)

In this case that will say aloud ‘1: the narwhal bacons’

14. Set Variable %NewsPiece to %NewsPiece + 1 (you will want to check the ‘do maths’ box)

This increases the value of %NewsPiece by 1, in this case making it ‘5’

15. Go to action #2

This basically restarts the program, but instead grabs the next headline.


Next, we create a program that allows us to make the phone display a certain headline, assigned by number.

Article Display

1. Say ‘Which headline number did you want?’

2. Run ‘Get Voice’ – This opens up a little prompt that awaits you voice. Say the number of the headline you want now. Let’s assume you said 1. When you use ‘Get Voice’ it stores what it deciphers you saying as %VOICE.

3. IF %VOICE is a number greater than 0

4. Browse to the URL ‘%Headline(%VOICE)’ – in this case, %Headline1

In the last program, we had the URL attached to the first headline assigned to the variable %Headline1, so it will now pull it up and put it into your browser and pop up the resulting page

5. ELSE IF %VOICE = Cancel

(if the result of getting your voice was not a number greater than zero, it will now check if it was ‘Cancel’)

6. STOP – Pretty self explanatory


(if the result is neither a number nor ‘Cancel’)
8. Say ‘Please say the number only’

9. Go to action #2
I’m sure I missed explaining something, feel free to ask!

  • Trackback are closed
  • Comments (16)
    • Michael Whitaker
    • 09/16. 2013 6:29am

    Hi there,
    this is a fantastic setup – I have both parts working perfectly. I’m interested to know how you use this set up in practice. Do you have it set to trigger at specific time with the Article Display running as the exit task?

  1. Hey Michael, glad you enjoyed it! I have it triggered to go when I get in the car in the morning (Power and between a certain time). I also have it work when I trigger it by saying news. Article display is only if I ask to see a headline.

    • Vishal
    • 09/20. 2013 2:47am

    I tried replicating this. However, when I see the RSS page of google news, it does not have ‘url=’ and hence the step 8 in headline reader does not execute.
    The google news url simply has:
    Top Stories – Google News
    Please guide.

    • Michael Whitaker
    • 09/23. 2013 6:20am

    I’ve set it to trigger at a certain time each morning (my commute is in public and mostly underground!) – I take it your car mode has volume adjusts in it elsewhere as I think I’ll need to add some steps to have it override silent/vibrate. Great idea about having a separate voice trigger for anytime you want a news update, I’ll have to make myself one of those too!

    • Matt Henrich
    • 11/03. 2013 5:23pm

    For some reason, I can only get Tasker to read the first headline. Then I get an I/O error from Tasker for the next headline. Any ideas?

    • Dwight
    • 02/02. 2014 2:10am

    It would be better to move the HTTP Get to the first step. As its written it accesses the page repeatedly for each article.

    • Johnd548
    • 05/11. 2014 5:56am

    Hi there, I found your web site by the use of Google while searching for a similar matter, your site came up, it seems to be good. I’ve bookmarked it in my google bookmarks. fffeckbkkbdd

  2. How do you get rid of the &apos in the Headline. I know it means apostrophe but can you get rid of it?

  3. Use Variable Search and Replace, and replace all instances of ‘&apos’ with the apostrophe sign

    • sameer
    • 06/17. 2015 4:36am



    iam a big fan of tasker , while i was configuring the above steps and executing i got error at step 9, please guide

    • bevlar
    • 02/15. 2016 7:47am

    Variable convert > html to text

    This converts all html codes to text & becomes &

    This saves making a lot of search and replaces. Run this at the the end, if you don’t you won’t have the tags to split on.

  4. good If you like the iphone app or the details in the content, talk about it with your good friends with one mouse click on your left out.nice.

  5. So we want to get the pieces of text ‘the narwhal bacons’ and the link ‘http://3.com’ out of this chunk and get rid of the rest of the garbage text.

  6. Thanks Dennis for such an incredible upgrade. I’m still learning your wonderfull software, but congratulations on it

  7. goodOnce you include set up this repository, you can carry on with this article to setup Phoenix Kodi addon. better.

  8. Its great pleasure to discover this site, I couldn’t”t discover any learning on this matter earlier to.Also work a website and in the event that you are ever keen on doing some guest composing for me if conceivable don”t hesitate to tell me.

return top