diff options
author | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-04-29 13:51:54 +0200 |
---|---|---|
committer | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-04-29 13:51:54 +0200 |
commit | df90c7bf6e42f2b24720a9b58de96c79ee3b04a1 (patch) | |
tree | e70a3c7032030a5defbb7edf0f5f7c788b4f83db | |
parent | post flair update (diff) | |
download | oldredditclient-df90c7bf6e42f2b24720a9b58de96c79ee3b04a1.tar oldredditclient-df90c7bf6e42f2b24720a9b58de96c79ee3b04a1.tar.gz oldredditclient-df90c7bf6e42f2b24720a9b58de96c79ee3b04a1.tar.bz2 oldredditclient-df90c7bf6e42f2b24720a9b58de96c79ee3b04a1.tar.lz oldredditclient-df90c7bf6e42f2b24720a9b58de96c79ee3b04a1.tar.xz oldredditclient-df90c7bf6e42f2b24720a9b58de96c79ee3b04a1.tar.zst oldredditclient-df90c7bf6e42f2b24720a9b58de96c79ee3b04a1.zip |
-rwxr-xr-x | bettereveryloop.php | 2 | ||||
-rw-r--r-- | main.php | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/bettereveryloop.php b/bettereveryloop.php index 90dac79..9dbb0eb 100755 --- a/bettereveryloop.php +++ b/bettereveryloop.php @@ -11,7 +11,7 @@ $o-> setflair ($argv[3] ); if ($argc == 5 ) $o-> setflair ($argv[3], null, null, $argv[4] ); - sleep (8 ); + sleep (60 ); } // reddit is max 30 requests per minute tho ?> @@ -137,7 +137,20 @@ Errors: $ch = $this->ch; if($flair == null) { $dnevi = array("drekek", "ponedeljek", "torek", "sreda", "cetrtek", "petek", "sobota", "nedelja"); - $flair = $dnevi[date("N")].", ".date("j.n.Y H:i:s"); + $wiki = file_get_contents("https://en.wikipedia.org/wiki/Template:2019%E2%80%9320_coronavirus_pandemic_data"); + $xmlDoc = new DOMDocument($wiki); + $xmlDoc->loadHTML( $wiki ); + $searchNode = $xmlDoc->getElementById( "thetable" )->getElementsByTagName("tr"); + foreach( $searchNode as $sn ) { + if (strpos(DOMinnerHTML($sn), 'Slovenia') !== false) { + $ok = trim(str_replace(",", "", DOMinnerHTML($sn->getElementsByTagName("td")[0]))); + $um = trim(str_replace(",", "", DOMinnerHTML($sn->getElementsByTagName("td")[1]))); + $oz = trim(str_replace(",", "", DOMinnerHTML($sn->getElementsByTagName("td")[2]))); + echo 'true'; + break; + } + } + $flair = $dnevi[date("N")].", ".date("j.n.Y H:i")." | okuž.: ".$ok." umr.: ".$um." ozd.: ".$oz; } if($magic == null) { if($post) { |