Skip to content

Commit

Permalink
[ScribbleHubBridge] Get author feed title regardless of CloudFlare (R…
Browse files Browse the repository at this point in the history
  • Loading branch information
Phantop authored Jan 11, 2024
1 parent d9ac019 commit d5175ae
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions bridges/ScribbleHubBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ class ScribbleHubBridge extends FeedExpander
'uid' => [
'name' => 'uid',
'required' => true,
// Example: Alyson Greaves's stories
'exampleValue' => '76208',
// Example: miriamrobern's stories
'exampleValue' => '149271',
],
],
'Series' => [
'sid' => [
'name' => 'sid',
'required' => true,
// Example: latest chapters from The Sisters of Dorley by Alyson Greaves
'exampleValue' => '421879',
// Example: latest chapters from Uskweirs
'exampleValue' => '965299',
],
]
];
Expand Down Expand Up @@ -52,6 +52,10 @@ protected function parseItem(array $item)
return [];
}

if ($this->queriedContext === 'Author') {
$this->author = $item['author'];
}

$item['comments'] = $item['uri'] . '#comments';

try {
Expand Down Expand Up @@ -90,16 +94,7 @@ public function getName()
$name = parent::getName() . " $this->queriedContext";
switch ($this->queriedContext) {
case 'Author':
try {
$page = getSimpleHTMLDOMCached(self::URI . 'profile/' . $this->getInput('uid'));
} catch (HttpException $e) {
// 403 Forbidden, This means we got anti-bot response
if ($e->getCode() === 403) {
return $name;
}
throw $e;
}
$title = html_entity_decode($page->find('.p_m_username.fp_authorname', 0)->plaintext);
$title = $this->author;
break;
case 'Series':
try {
Expand Down

0 comments on commit d5175ae

Please sign in to comment.