[FicbookBridge] Add getName implementation (#1771)

This commit is contained in:
Ololbu 2020-10-10 00:39:35 +05:00 committed by GitHub
parent 712f60e910
commit 84d5daaa03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);