-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use updated ao3 (limit scraping) and priviblur (favicon) bridges
- Loading branch information
Showing
4 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
diff --git a/bridges/AO3Bridge.php b/bridges/AO3Bridge.php | ||
index 970ed414c50..7e18b657f58 100644 | ||
--- a/bridges/AO3Bridge.php | ||
+++ b/bridges/AO3Bridge.php | ||
@@ -27,6 +27,7 @@ class AO3Bridge extends BridgeAbstract | ||
'Entire work' => 'all', | ||
], | ||
], | ||
+ 'limit' => self::LIMIT, | ||
], | ||
'Bookmarks' => [ | ||
'user' => [ | ||
@@ -84,6 +85,8 @@ private function collectList($url) | ||
} | ||
$this->title = $heading->plaintext; | ||
|
||
+ $limit = $this->getInput('limit') ?? 3; | ||
+ $count = 0; | ||
foreach ($html->find('.index.group > li') as $element) { | ||
$item = []; | ||
|
||
@@ -118,7 +121,7 @@ private function collectList($url) | ||
$item['uid'] = $item['uri'] . "/$strdate/$chapters"; | ||
|
||
// Fetch workskin of desired chapter(s) in list | ||
- if ($this->getInput('range')) { | ||
+ if ($this->getInput('range') && ($limit == 0 || $count++ < $limit)) { | ||
$url = $item['uri']; | ||
switch ($this->getInput('range')) { | ||
case ('all'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
diff --git a/bridges/PriviblurBridge.php b/bridges/PriviblurBridge.php | ||
index 198c38bc6c3..6b442e75034 100644 | ||
--- a/bridges/PriviblurBridge.php | ||
+++ b/bridges/PriviblurBridge.php | ||
@@ -17,6 +17,7 @@ class PriviblurBridge extends BridgeAbstract | ||
]; | ||
|
||
private $title; | ||
+ private $favicon = 'https://www.tumblr.com/favicon.ico'; | ||
|
||
public function collectData() | ||
{ | ||
@@ -25,6 +26,11 @@ public function collectData() | ||
$html = defaultLinkTo($html, $url); | ||
$this->title = $html->find('head title', 0)->innertext; | ||
|
||
+ if ($html->find('#blog-header img.avatar', 0)) { | ||
+ $icon = $html->find('#blog-header img.avatar', 0)->src; | ||
+ $this->favicon = str_replace('pnj', 'png', $icon); | ||
+ } | ||
+ | ||
$elements = $html->find('.post'); | ||
foreach ($elements as $element) { | ||
$item = []; | ||
@@ -64,6 +70,11 @@ public function getName() | ||
|
||
public function getURI() | ||
{ | ||
- return $this->getInput('url') ? $this->getInput('url') : parent::getURI(); | ||
+ return $this->getInput('url') ?? parent::getURI(); | ||
+ } | ||
+ | ||
+ public function getIcon() | ||
+ { | ||
+ return $this->favicon; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters