46 lines
1.3 KiB
PHP
Executable File
46 lines
1.3 KiB
PHP
Executable File
#!/usr/bin/php
|
|
<?php
|
|
# its in php because I got lazy and just stripped down news.php
|
|
# cool language tho it gets too much hate
|
|
|
|
$LOGO_FILE = "/var/gemini-data/logos/gemhltv_news";
|
|
# ^^^^^^^^ path to file containing the text to be displayed at the top of the
|
|
# page
|
|
|
|
$READER_LINK = dirname(__PATH__) . "/reader";
|
|
# ^^^^^^^^^^ uri path to an instance of reader.php
|
|
# the default is relative, and assumes you have one in the same directory as
|
|
# this script
|
|
|
|
$feed_title = "";
|
|
$node_description = "";
|
|
$feed = new XMLReader;
|
|
$feed->open("https://hltv.org/news.rss.php");
|
|
$feed->read();
|
|
|
|
echo "```\n";
|
|
echo file_get_contents($LOGO_FILE);
|
|
echo "```\n";
|
|
while ($feed->read()) {
|
|
if ( $feed->name === "item") {
|
|
$children = $feed->expand();
|
|
foreach ($children->childNodes as $child) {
|
|
if ( $child->nodeType === XML_TEXT_NODE ) { continue; }
|
|
if ( $child->tagName === "title" ) {
|
|
echo "\n## " . $child->nodeValue . "\n";
|
|
}
|
|
|
|
if ($child->tagName === "description") {
|
|
$story_description = $child->nodeValue;
|
|
}
|
|
|
|
if ($child->tagName === "link") {
|
|
$link = $READER_LINK . "?" . urlencode($child->nodeValue);
|
|
echo "=> " . $link . " " . $story_description . "\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$feed->close();
|