1
0
Fork 0
forked from blallo/rss-bridge

Fix GoComics, website completely changed. Fixes #663

This commit is contained in:
teromene 2018-04-14 18:15:44 +01:00
parent 1bd4a40f71
commit 887fc7b037

View file

@ -3,7 +3,7 @@ class GoComicsBridge extends BridgeAbstract {
const MAINTAINER = 'sky'; const MAINTAINER = 'sky';
const NAME = 'GoComics Unofficial RSS'; const NAME = 'GoComics Unofficial RSS';
const URI = 'http://www.gocomics.com/'; const URI = 'https://www.gocomics.com/';
const CACHE_TIMEOUT = 21600; // 6h const CACHE_TIMEOUT = 21600; // 6h
const DESCRIPTION = 'The Unofficial GoComics RSS'; const DESCRIPTION = 'The Unofficial GoComics RSS';
const PARAMETERS = array( array( const PARAMETERS = array( array(
@ -18,25 +18,27 @@ class GoComicsBridge extends BridgeAbstract {
$html = getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request GoComics: ' . $this->getURI()); or returnServerError('Could not request GoComics: ' . $this->getURI());
foreach($html->find('div.comic__container') as $element) { //Get info from first page
$author = preg_replace('/By /', '', $html->find(".media-subheading", 0)->plaintext);
$img = $element->find('.item-comic-image img', 0); $link = self::URI . $html->find(".gc-deck--cta-0", 0)->find('a', 0)->href;
$link = $element->find('a.js-item-comic-link', 0); for($i = 0; $i < 5; $i++) {
$comic = $img->src;
$title = $link->title;
$url = $html->find('input.js-copy-link', 0)->value;
$date = substr($title, -10);
if (empty($title))
$title = 'GoComics ' . $this->getInput('comicname') . ' on ' . $date;
$date = strtotime($date);
$item = array(); $item = array();
$item['id'] = $url;
$item['uri'] = $url; $page = getSimpleHTMLDOM($link)
$item['title'] = $title; or returnServerError('Could not request GoComics: ' . $link);
$item['author'] = preg_replace('/by /', '', $element->find('a.link-blended small', 0)->plaintext); $imagelink = $page->find(".img-fluid", 1)->src;
$item['timestamp'] = $date; $date = explode("/", $link);
$item['content'] = '<img src="' . $comic . '" alt="' . $title . '" />';
$item['id'] = $imagelink;
$item['uri'] = $link;
$item['author'] = $author;
$item['title'] = 'GoComics ' . $this->getInput('comicname');
$item['timestamp'] = DateTime::createFromFormat("Ymd", $date[5] . $date[6] . $date[7])->getTimestamp();
$item['content'] = '<img src="' . $imagelink . '" />';
$link = self::URI . $page->find(".js-previous-comic", 0)->href;
$this->items[] = $item; $this->items[] = $item;
} }
} }