Skip to content

Commit ec6fd89

Browse files
author
csavelief
committed
Better Scrapfly default parameters
1 parent 916346d commit ec6fd89

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/Helpers/OpenAi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public static function isHyperlink(string $text): bool
1313
return Str::startsWith(Str::lower($text), ["https://", "http://"]);
1414
}
1515

16-
public static function download(string $text): string
16+
public static function download(string $text, string $country = 'fr'): string
1717
{
1818
if (self::isHyperlink($text)) {
1919
if (config('towerify.scrapfly.api_key')) {
20-
$news = Http::get('https://api.scrapfly.io/scrape?render_js=true&key=' . config('towerify.scrapfly.api_key') . '&url=' . $text);
20+
$news = Http::get('https://api.scrapfly.io/scrape?render_js=true&asp=true&cache=true&cache_ttl=86400&key=' . config('towerify.scrapfly.api_key') . "&country={$country}&url={$text}");
2121
return json_decode($news, true)['result']['content'];
2222
}
2323
if (config('towerify.scraperapi.api_key')) {

0 commit comments

Comments
 (0)