jikan-me / jikan

Unofficial MyAnimeList PHP+REST API which provides functions other than the official API
https://jikan.moe
MIT License
875 stars 93 forks source link

[OFFICIAL] Generated Issue: ParserException #521

Closed Neppu-Nep closed 1 year ago

Neppu-Nep commented 1 year ago

Please fill out the details below.

Summary: Weirdly, using php curl fails the request? Tested with python requests, javascript fetch, and just normally pasting in the browser works fine.

Steps to reproduce:

function get($url, $headers) {

    try {

        $ch = curl_init();

        if ($ch === false) {
            throw new Exception('failed to initialize');
        }

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;

    }
    catch(Exception $e) {

        $error = $e->getCode()."\n".$e->getMessage();
        $error_message = "Error : ".$error;
        return $error_message;

    }
}
$url = "https://api.jikan.moe/v4/anime/52657/videos";
$headers = array();
print_r(get($url, $headers));

Additional Details

Jikan Parser Version: v4.0.2@4df99e0df5a4adf2b92e7c6fc663de8fd4b9c325 PHP: 8.0.19 Redis: Connected Exception: Jikan\Exception\ParserException Code: 0 Message: Failed to parse 'https://myanimelist.net/anime/52657/_/video' Trace: /var/www/jikan-rest/vendor/jikan-me/jikan/src/Exception/ParserException.php on line 24 Request: GET /v4/anime/52657/videos

irfan-dahir commented 1 year ago

Resolved via #522