feat: add limit options to the slowest bridges

This commit is contained in:
dag 2022-04-10 18:56:24 +02:00 committed by GitHub
parent 0b40f51c01
commit 5a733b3d82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 80 additions and 20 deletions

View file

@ -26,7 +26,8 @@ class FindACrewBridge extends BridgeAbstract {
'distance' => array(
'name' => 'Limit boundary of search in KM',
'title' => 'Boundary of the search in kilometers when using longitude and latitude'
)
),
'limit' => self::LIMIT,
)
);
@ -59,7 +60,8 @@ class FindACrewBridge extends BridgeAbstract {
$html = getSimpleHTMLDOM($url, $header, $opts) or returnClientError('No results for this query.');
$annonces = $html->find('.css_SrhRst');
foreach ($annonces as $annonce) {
$limit = $this->getInput('limit') ?? 10;
foreach (array_slice($annonces, 0, $limit) as $annonce) {
$item = array();
$link = parent::getURI() . $annonce->find('.lstsum-btn-con a', 0)->href;