I follow Noticias3d news since the early 2000s and I was always wanting to have a RSS feed, given there is no official support. Now finally in 2024 I got some inspiration from this old post https://foro.noticias3d.com/vbulletin/showthread.php?t=358685 and decided to just write my own using Scala 3. To execute this example you have to first install Scala CLI and you are good to go with Rss.sc:
scala-cli --watch Rss.sc
Then in a tab or from your smartphone using your machine IP (e.g. http://192.168.2.58:8080/feed
):
curl http://localhost:8080/feed
Or slightly better IO program RssIO.sc:
scala-cli --watch RssIO.sc
Or even a direct-style using Context Functions one RssContext.sc:
scala-cli --watch RssContext.sc
You can try the JSoup or Rome APIs using the powerful Ammonite RPEL:
scala-cli --power repl --amm -S 3.3.3 --dep com.rometools:rome:2.1.0 --dep org.jsoup:jsoup:1.17.2
@ import org.jsoup._
@ val urlNoticia = "https://www.noticias3d.com/noticia/95206/samsung-galaxy-s25-ultra-cambio-importante.html"
@ val docNoticia = Jsoup.connect(urlNoticia).get()
@ val author = docNoticia.select("#content-data:has(i.fa-user) a[href~=^mailto: .+]").first
Here are some useful resources related to how to read/write RSS feeds in Scala:
- https://alvinalexander.com/scala/how-to-read-atom-rss-feeds-in-scala-rome-library/
- https://www.scrapingbee.com/blog/web-scraping-scala/
- https://github.com/CatalystCode/streaming-rss-html
- https://github.com/swaldman/audiofluidity-rss
Some links from the official documentation:
- https://jsoup.org/cookbook/extracting-data/selector-syntax
- https://rometools.github.io/rome/RssAndAtOMUtilitiEsROMEV0.5AndAboveTutorialsAndArticles/RssAndAtOMUtilitiEsROMEV0.5TutorialUsingROMEWithinAServletToCreateAndReturnAFeed.html
- https://rometools.github.io/rome/RssAndAtOMUtilitiEsROMEV0.5AndAboveTutorialsAndArticles/RssAndAtOMUtilitiEsROMEV0.5TutorialUsingROMEToCreateAndWriteASyndicationFeed.html