From 84d5daaa032d94e3b9c634a182316148f012c8b1 Mon Sep 17 00:00:00 2001 From: Ololbu Date: Sat, 10 Oct 2020 00:39:35 +0500 Subject: [PATCH] [FicbookBridge] Add getName implementation (#1771) --- bridges/FicbookBridge.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bridges/FicbookBridge.php b/bridges/FicbookBridge.php index 6a3761d5..b79ad257 100644 --- a/bridges/FicbookBridge.php +++ b/bridges/FicbookBridge.php @@ -35,6 +35,8 @@ class FicbookBridge extends BridgeAbstract { ), ); + protected $titleName; + public function getURI() { switch($this->queriedContext) { case 'Site News': { @@ -56,6 +58,21 @@ class FicbookBridge extends BridgeAbstract { } } + public function getName() { + switch($this->queriedContext) { + case 'Site News': { + return $this->queriedContext . ' | ' . self::NAME; + } + case 'Fiction Updates': { + return $this->titleName . ' | ' . self::NAME; + } + case 'Fiction Comments': { + return $this->titleName . ' | Comments | ' . self::NAME; + } + default: return self::NAME; + } + } + public function collectData() { $header = array('Accept-Language: en-US'); @@ -65,6 +82,10 @@ class FicbookBridge extends BridgeAbstract { $html = defaultLinkTo($html, self::URI); + if ($this->queriedContext == 'Fiction Updates' or $this->queriedContext == 'Fiction Comments' ) { + $this->titleName = $html->find('.fanfic-main-info > h1', 0)->innertext; + } + switch($this->queriedContext) { case 'Site News': return $this->collectSiteNews($html); case 'Fiction Updates': return $this->collectUpdatesData($html);