Прямой парсинг Квестбука - интерфейс
This commit is contained in:
parent
5ce89f3265
commit
05f4e3267f
|
@ -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;
|
||||
|
|
Reference in New Issue