mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-31 13:55:07 +03:00
[ScribbleHubBridge] Add list page feed creation (#4012)
* [ScribbleHubBridge] Add list page feed creation * [ScribbleHubBridge] Add list title handling * [ScribbleHubBridge] Don't include timestamp in List GUIDs * [ScribbleHubBridge] Fix usage of dynamic property
This commit is contained in:
parent
4602f4f475
commit
7d6881732d
1 changed files with 59 additions and 1 deletions
|
@ -23,6 +23,14 @@ class ScribbleHubBridge extends FeedExpander
|
||||||
// Example: latest chapters from Uskweirs
|
// Example: latest chapters from Uskweirs
|
||||||
'exampleValue' => '965299',
|
'exampleValue' => '965299',
|
||||||
],
|
],
|
||||||
|
],
|
||||||
|
'List' => [
|
||||||
|
'url' => [
|
||||||
|
'name' => 'url',
|
||||||
|
'required' => true,
|
||||||
|
// Example: latest stories with the 'Transgender' tag
|
||||||
|
'exampleValue' => 'https://www.scribblehub.com/series-finder/?sf=1&gi=6&tgi=1088&sort=dateadded',
|
||||||
|
],
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -34,6 +42,10 @@ class ScribbleHubBridge extends FeedExpander
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$url = 'https://rssscribblehub.com/rssfeed.php?type=';
|
$url = 'https://rssscribblehub.com/rssfeed.php?type=';
|
||||||
|
if ($this->queriedContext === 'List') {
|
||||||
|
$this->collectList($this->getURI());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($this->queriedContext === 'Author') {
|
if ($this->queriedContext === 'Author') {
|
||||||
$url = $url . 'author&uid=' . $this->getInput('uid');
|
$url = $url . 'author&uid=' . $this->getInput('uid');
|
||||||
} else { //All and Series use the same source feed
|
} else { //All and Series use the same source feed
|
||||||
|
@ -42,6 +54,44 @@ class ScribbleHubBridge extends FeedExpander
|
||||||
$this->collectExpandableDatas($url);
|
$this->collectExpandableDatas($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected $author = '';
|
||||||
|
|
||||||
|
private function collectList($url)
|
||||||
|
{
|
||||||
|
$html = getSimpleHTMLDOMCached($url);
|
||||||
|
foreach ($html->find('.search_main_box') as $element) {
|
||||||
|
$item = [];
|
||||||
|
|
||||||
|
$title = $element->find('.search_title a', 0);
|
||||||
|
$item['title'] = $title->plaintext;
|
||||||
|
$item['uri'] = $title->href;
|
||||||
|
|
||||||
|
$strdate = $element->find('[title="Last Updated"]', 0)->plaintext;
|
||||||
|
$item['timestamp'] = strtotime($strdate);
|
||||||
|
$item['uid'] = $item['uri'];
|
||||||
|
|
||||||
|
$details = getSimpleHTMLDOMCached($item['uri']);
|
||||||
|
$item['enclosures'][] = $details->find('.fic_image img', 0)->src;
|
||||||
|
$item['content'] = $details->find('.wi_fic_desc', 0);
|
||||||
|
|
||||||
|
foreach ($details->find('.fic_genre') as $tag) {
|
||||||
|
$item['categories'][] = $tag->plaintext;
|
||||||
|
}
|
||||||
|
foreach ($details->find('.stag') as $tag) {
|
||||||
|
$item['categories'][] = $tag->plaintext;
|
||||||
|
}
|
||||||
|
|
||||||
|
$read_url = $details->find('.read_buttons a', 0)->href;
|
||||||
|
$read_html = getSimpleHTMLDOMCached($read_url);
|
||||||
|
$item['content'] .= '<hr><h3>';
|
||||||
|
$item['content'] .= $read_html->find('.chapter-title', 0);
|
||||||
|
$item['content'] .= '</h3>';
|
||||||
|
$item['content'] .= $read_html->find('#chp_raw', 0);
|
||||||
|
|
||||||
|
$this->items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function parseItem(array $item)
|
protected function parseItem(array $item)
|
||||||
{
|
{
|
||||||
//For series, filter out other series from 'All' feed
|
//For series, filter out other series from 'All' feed
|
||||||
|
@ -102,12 +152,17 @@ class ScribbleHubBridge extends FeedExpander
|
||||||
} catch (HttpException $e) {
|
} catch (HttpException $e) {
|
||||||
// 403 Forbidden, This means we got anti-bot response
|
// 403 Forbidden, This means we got anti-bot response
|
||||||
if ($e->getCode() === 403) {
|
if ($e->getCode() === 403) {
|
||||||
return $item;
|
return $name;
|
||||||
}
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
$title = html_entity_decode($page->find('.fic_title', 0)->plaintext);
|
$title = html_entity_decode($page->find('.fic_title', 0)->plaintext);
|
||||||
break;
|
break;
|
||||||
|
case 'List':
|
||||||
|
$page = getSimpleHTMLDOMCached($this->getURI());
|
||||||
|
$title = $page->find('head > title', 0)->plaintext;
|
||||||
|
$title = explode(' |', $title)[0];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (isset($title)) {
|
if (isset($title)) {
|
||||||
$name .= " - $title";
|
$name .= " - $title";
|
||||||
|
@ -125,6 +180,9 @@ class ScribbleHubBridge extends FeedExpander
|
||||||
case 'Series':
|
case 'Series':
|
||||||
$uri = self::URI . 'series/' . $this->getInput('sid') . '/a';
|
$uri = self::URI . 'series/' . $this->getInput('sid') . '/a';
|
||||||
break;
|
break;
|
||||||
|
case 'List':
|
||||||
|
$uri = $this->getInput('url');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue