Skip to content

Commit

Permalink
[FicbookBridge] Add getName implementation (RSS-Bridge#1771)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ololbu authored Oct 9, 2020
1 parent 712f60e commit 84d5daa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bridges/FicbookBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class FicbookBridge extends BridgeAbstract {
),
);

protected $titleName;

public function getURI() {
switch($this->queriedContext) {
case 'Site News': {
Expand All @@ -56,6 +58,21 @@ public function getURI() {
}
}

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');
Expand All @@ -65,6 +82,10 @@ public function collectData() {

$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);
Expand Down

0 comments on commit 84d5daa

Please sign in to comment.