oreolek
/
news-script
Archived
1
0
Fork 0

Прямой парсинг Квестбука - интерфейс

This commit is contained in:
Alexander Yakovlev 2019-08-08 16:26:50 +07:00
parent 5ce89f3265
commit 05f4e3267f
Signed by: oreolek
GPG Key ID: 1CDC4B7820C93BD3
1 changed files with 13 additions and 2 deletions

View File

@ -23,10 +23,19 @@ use \Oreolek\Source;
class Questbook extends Source {
public $title = "Сторигеймы";
protected function parse() {
$this->parseFeed('https://quest-book.ru/directory/rss/');
$this->parseFeed('https://quest-book.ru/online/rss.xml');
global $argv;
if (isset($argv[2])) {
$game_page = $this->get_text($argv[2]);
$this->loadStr($game_page, []);
$this->output .= $this->page($argv[2])->print();
} else {
$this->parseFeed('https://quest-book.ru/directory/rss/');
$this->parseFeed('https://quest-book.ru/online/rss.xml');
}
}
protected function parseFeed($feedUrl) {
$string = $this->get_text($feedUrl);
$string = mb_convert_encoding($string, 'UTF-8', 'auto');
@ -59,9 +68,11 @@ class Questbook extends Source {
$this->output .= $game->print();
}
}
public function checkPage($url) {
return (strpos($url,'https://quest-book.ru/') !== FALSE);
}
public function page($url) {
$game = new Game;
$game->url = $url;