a gemini mirror of hltv.org, live at gemini://illegaldrugs.net/cgi-bin/gemhltv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.3 KiB

#!/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();