UQComputingSociety / uqcsbot-slack

:mortar_board: UQCSbot: our friendly little Slack bot
https://slack.uqcs.org.au
MIT License
55 stars 44 forks source link

xkcd RSS feed contains things that aren't comics. #482

Closed CameronAavik closed 4 years ago

CameronAavik commented 5 years ago

Today the bot posted this as the daily xkcd.

image

The reason is that xkcd included a link to their blog post in the RSS feed, and that appeared as the latest instead of a comic. I've put the content of the RSS feed at the bottom.

I think the solution is to filter out any items where the URL is not of the form https://xkcd.com/<digits>/

RSS Feed URL: https://xkcd.com/rss.xml

<rss version="2.0">
<channel>
<title>xkcd.com</title>
<link>https://xkcd.com/</link>
<description>xkcd.com: A webcomic of romance and math humor.</description>
<language>en</language>
<item>
<title>Book tour wrap-up</title>
<link>
https://blog.xkcd.com/2019/09/25/book-tour-wrap-up/
</link>
<description>
Thank you to everyone who came to events on my <a href="https://blog.xkcd.com/2019/09/25/book-tour-wrap-up/">book tour</a>! If you weren't able to make it to any of my tour events, <em>How To</em> is now available everywhere, including at <a href="http://links.penguinrandomhouse.com/type/affiliate/isbn/9780525537090/siteID/8001/retailerid/2/trackingcode/PRH3346ECA0FC">Barnes and Noble</a>, <a href="http://links.penguinrandomhouse.com/type/affiliate/isbn/9780525537090/siteID/8001/retailerid/23/trackingcode/PRH3346ECA0FC">Target</a>, <a href="http://links.penguinrandomhouse.com/type/affiliate/isbn/9780525537090/siteID/8001/retailerid/7/trackingcode/randohouseinc34730-20">Amazon</a>, local independents, and more. Some <a href="https://www.barnesandnoble.com/w/how-to-randall-munroe/1130494832?ean=9780525686934#/">Barnes and Noble</a> locations and indies have special signed copies, so you can check with your bookseller to see if those are available.
</description>
<pubDate>Wed, 25 Sep 2019 00:00:00 -0000</pubDate>
<guid>86856c86cea81883346b7463b442c1e94b2b7ed8</guid>
</item>
<item>
<title>Drone Fishing</title>
<link>https://xkcd.com/2208/</link>
<description>
<img src="https://imgs.xkcd.com/comics/drone_fishing.png" title="Today's consumers who order their drones off the internet don't know the joy of going out in nature and returning with a drone that you caught yourself, whose angry owners you fought off with your own two hands." alt="Today's consumers who order their drones off the internet don't know the joy of going out in nature and returning with a drone that you caught yourself, whose angry owners you fought off with your own two hands." />
</description>
<pubDate>Fri, 27 Sep 2019 00:00:00 -0000</pubDate>
<guid>https://xkcd.com/2208/</guid>
</item>
<item>
<title>Math Work</title>
<link>https://xkcd.com/2207/</link>
<description>
<img src="https://imgs.xkcd.com/comics/math_work.png" title="I could type this into a solver, which MIGHT help, but would also mean I have to get a lot of parentheses right..." alt="I could type this into a solver, which MIGHT help, but would also mean I have to get a lot of parentheses right..." />
</description>
<pubDate>Wed, 25 Sep 2019 00:00:00 -0000</pubDate>
<guid>https://xkcd.com/2207/</guid>
</item>
<item>
<title>Mavis Beacon</title>
<link>https://xkcd.com/2206/</link>
<description>
<img src="https://imgs.xkcd.com/comics/mavis_beacon.png" title="There are actually lowercase-like 'oldstyle' forms of normal numbers with more pronounced ascenders and descenders, which is why some numbers like '5' in books sometimes dangle below the line. But the true capital numbers remain the domain of number maven Mavis Beacon." alt="There are actually lowercase-like 'oldstyle' forms of normal numbers with more pronounced ascenders and descenders, which is why some numbers like '5' in books sometimes dangle below the line. But the true capital numbers remain the domain of number maven Mavis Beacon." />
</description>
<pubDate>Mon, 23 Sep 2019 00:00:00 -0000</pubDate>
<guid>https://xkcd.com/2206/</guid>
</item>
<item>
<title>Types of Approximation</title>
<link>https://xkcd.com/2205/</link>
<description>
<img src="https://imgs.xkcd.com/comics/types_of_approximation.png" title="It's not my fault I haven't had a chance to measure the curvature of this particular universe." alt="It's not my fault I haven't had a chance to measure the curvature of this particular universe." />
</description>
<pubDate>Fri, 20 Sep 2019 00:00:00 -0000</pubDate>
<guid>https://xkcd.com/2205/</guid>
</item>
</channel>
</rss>