mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-07 08:35:57 +03:00
[AO3Bridge] Add fetch limit to reduce requests (#4328)
This commit is contained in:
parent
6c86e2c1f7
commit
2294dac3f1
1 changed files with 4 additions and 1 deletions
|
@ -27,6 +27,7 @@ class AO3Bridge extends BridgeAbstract
|
|||
'Entire work' => 'all',
|
||||
],
|
||||
],
|
||||
'limit' => self::LIMIT,
|
||||
],
|
||||
'Bookmarks' => [
|
||||
'user' => [
|
||||
|
@ -84,6 +85,8 @@ class AO3Bridge extends BridgeAbstract
|
|||
}
|
||||
$this->title = $heading->plaintext;
|
||||
|
||||
$limit = $this->getInput('limit') ?? 3;
|
||||
$count = 0;
|
||||
foreach ($html->find('.index.group > li') as $element) {
|
||||
$item = [];
|
||||
|
||||
|
@ -118,7 +121,7 @@ class AO3Bridge extends BridgeAbstract
|
|||
$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'):
|
||||
|
|
Loading…
Add table
Reference in a new issue