From 03681ae4b4173f7cd78091bb600a48c089403b4b Mon Sep 17 00:00:00 2001 From: peppy6582 Date: Sat, 11 Jan 2025 07:46:08 -0600 Subject: [PATCH] Update CruncyrollBridge.php --- bridges/CruncyrollBridge.php | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/bridges/CruncyrollBridge.php b/bridges/CruncyrollBridge.php index 7cff443a..b5413e4a 100644 --- a/bridges/CruncyrollBridge.php +++ b/bridges/CruncyrollBridge.php @@ -47,28 +47,16 @@ class CrunchyrollBridge extends BridgeAbstract { ); // Define HTTP headers for the API request - $options = [ - 'http' => [ - 'method' => 'GET', - 'header' => [ - 'User-Agent: Mozilla/5.0 (compatible; RSSBridge/2025)', - 'Accept: application/json', - 'Accept-Language: en-US,en;q=0.5', - 'Origin: https://www.crunchyroll.com', - 'Referer: https://www.crunchyroll.com/', - ], - ], + $headers = [ + 'User-Agent: Mozilla/5.0 (compatible; RSSBridge/2025)', + 'Accept: application/json', + 'Accept-Language: en-US,en;q=0.5', + 'Origin: https://www.crunchyroll.com', + 'Referer: https://www.crunchyroll.com/', ]; - // Create a context for the HTTP request - $context = stream_context_create($options); - // Fetch data from the API - $response = file_get_contents($apiUrl, false, $context); - - if ($response === false) { - throw new Exception('Failed to fetch data from the Crunchyroll API.'); - } + $response = getContents($apiUrl, $headers); // Parse the JSON response $data = json_decode($response, true);