mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-12 01:48:48 +00:00
[AO3Bridge] Add fetch limit to reduce requests (#4328)
This commit is contained in:
parent
6c86e2c1f7
commit
2294dac3f1
@ -27,6 +27,7 @@ class AO3Bridge extends BridgeAbstract
|
|||||||
'Entire work' => 'all',
|
'Entire work' => 'all',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'limit' => self::LIMIT,
|
||||||
],
|
],
|
||||||
'Bookmarks' => [
|
'Bookmarks' => [
|
||||||
'user' => [
|
'user' => [
|
||||||
@ -84,6 +85,8 @@ class AO3Bridge extends BridgeAbstract
|
|||||||
}
|
}
|
||||||
$this->title = $heading->plaintext;
|
$this->title = $heading->plaintext;
|
||||||
|
|
||||||
|
$limit = $this->getInput('limit') ?? 3;
|
||||||
|
$count = 0;
|
||||||
foreach ($html->find('.index.group > li') as $element) {
|
foreach ($html->find('.index.group > li') as $element) {
|
||||||
$item = [];
|
$item = [];
|
||||||
|
|
||||||
@ -118,7 +121,7 @@ class AO3Bridge extends BridgeAbstract
|
|||||||
$item['uid'] = $item['uri'] . "/$strdate/$chapters";
|
$item['uid'] = $item['uri'] . "/$strdate/$chapters";
|
||||||
|
|
||||||
// Fetch workskin of desired chapter(s) in list
|
// Fetch workskin of desired chapter(s) in list
|
||||||
if ($this->getInput('range')) {
|
if ($this->getInput('range') && ($limit == 0 || $count++ < $limit)) {
|
||||||
$url = $item['uri'];
|
$url = $item['uri'];
|
||||||
switch ($this->getInput('range')) {
|
switch ($this->getInput('range')) {
|
||||||
case ('all'):
|
case ('all'):
|
||||||
|
Loading…
Reference in New Issue
Block a user