I'm sure many users here have heard of or currently use Reddit, the link aggregation website. If you use the website for news, to find funny jokes, to find awesome tips, etc. then you'll be happy to know that Reddit offers the ability to read data from its subreddits in the form of a JSON feed, and using Tasker we can process this feed to get the data that we want, in this case the titles of each thread. In my setup, I'm taking a random title among the top 3 posts of the day from /r/quotes.
- Variables --> Variable Set. Name %subreddit to the name of a subreddit you would like to pull from.
- Variables --> Variable Set. Name %numposts to whatever number of posts you want to pull before randomizing which one is picked.
- Net --> HTTP Get. The Serverort you'll be grabbing is:
var arr = JSON.parse(global("HTTPD")); var randomnumber = Math.floor((Math.random()*numposts)+1); var selftext = arr.data.children[randomnumber].data.selftext var title = arr.data.children[randomnumber].data.title
- Variables --> Variable Clear. Set Name to %HTTPD* and check Pattern Matching.
- Alert --> Say. For the text, you can say anything to preface what Tasker is about to put out. For instance, I've said it to "Your quote of the day is: %title." This should change depending on which subreddit you pull from.