Page 2 of 2
Re: RSS
Posted: Wed Feb 03, 2021 11:21 am
by dzbanek
You're posting rss link of specific mod. My intension was to have a list of mods that were recenly updated. So
https://mods.factorio.com/
Re: RSS
Posted: Wed Feb 03, 2021 11:41 am
by Thunder2k
dzbanek wrote: ↑Wed Feb 03, 2021 11:21 am
You're posting rss link of specific mod. My intension was to have a list of mods that were recenly updated. So
https://mods.factorio.com/
I did understand that, but I didn't want to open a new thread because yours is already named "RSS".
But they can mybe add both, if they are implementing the RSS feature.
I also mentioned this thread in the sticky thread "One line suggestions".
Re: RSS
Posted: Wed Feb 03, 2021 12:16 pm
by bormand
Re: Feature Request - RSS Data on Mod Portal
Posted: Wed Feb 03, 2021 1:19 pm
by Koub
[Koub] Thanks for the pointer. Merged both topics.
Re: Feature Request - RSS Data on Mod Portal
Posted: Wed Feb 03, 2021 2:28 pm
by Thunder2k
Hi. I created a workaround to monitor changes in mod updates via the API. It's a little PHP file located on my own server. It is subscribed by my TT-RSS instance which has the option "mark updated feeds unread".
Maybe some of you can use parts of this. I'm not a programmer, but I'm to lazy to check the mods manually.
Code: Select all
<?php
header("Content-Type: application/rss+xml; charset=UTF-8");
$rssfeed = '<?xml version="1.0" encoding="UTF-8"?>'. "\n";
$rssfeed .= '<rss version="2.0">'. "\n";
$rssfeed .= '<channel>'. "\n";
$rssfeed .= '<title>Factorio Mods</title>'. "\n";
$rssfeed .= '<link>https://mods.factorio.com/</link>'. "\n";
$rssfeed .= '<description>Custom Feed</description>'. "\n";
$arr = array("IndustrialRevolution","nullius","warptorio2","Krastorio2");
foreach ($arr as &$mod) {
$url = "https://mods.factorio.com/api/mods/".$mod."/full";
$content = file_get_contents($url);
$json = json_decode($content, true);
$item = $json;
$rssfeed .= '<item>'. "\n";
$rssfeed .= '<title>'.$item['title'].'</title>'. "\n";
$rssfeed .= '<link>https://mods.factorio.com/mod/'.$mod.'</link>'. "\n"; // adding domain to get the full url
$intro = html_entity_decode($item['summary']);
$intro = str_replace(' ', '', $intro);
$intro = strip_tags($intro);
$rssfeed .= '<description>' . $intro . "</p> <p>" .'Last updated: ' .$item['updated_at'] . '</description>'. "\n";
$date = new DateTime($item['updated_at']);
$date->modify('+2 hours');
$rssfeed .= '<pubDate>' . $date->format("D, d M Y H:i:s +0200") . '</pubDate>'. "\n";
$rssfeed .= '</item>'. "\n";
}
$rssfeed .= '</channel>'. "\n";
$rssfeed .= '</rss>';
echo $rssfeed;
?>