diff --git a/CHANGELOG.md b/CHANGELOG.md index e9dec48..81ce38c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Changed - Prevent request storm if no items are cached and the request failed. +- Set default timeout for requests from 5 to 10 seconds. ### Fixed - Fixed background color of icon diff --git a/src/models/Settings.php b/src/models/Settings.php index 63b3b02..074790e 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -26,7 +26,7 @@ class Settings extends Model /** * @var int Timeout in seconds waiting for the Instagram page to load */ - public $timeout = 5; + public $timeout = 10; /** * @var boolean Use Guzzle instead of php's file stream to fetch the Instagram page diff --git a/src/services/InstagramService.php b/src/services/InstagramService.php index 3572e3a..5f499ca 100644 --- a/src/services/InstagramService.php +++ b/src/services/InstagramService.php @@ -296,7 +296,7 @@ private function flattenMediaArray($mediaArray): array $item['timestamp'] = $media['node']['taken_at_timestamp']; $item['caption'] = $media['node']['edge_media_to_caption']['edges'][0]['node']['text'] ?? ''; $item['isVideo'] = (bool)$media['node']['is_video']; - $item['hasAudio'] = (bool)$media['node']['has_audio']; + $item['hasAudio'] = $item['isVideo'] ? (bool)$media['node']['has_audio'] : false; $item['video_view_count'] = $media['node']['video_view_count'] ?? 0; $items[] = $item; }