Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

500 error when selecting episodes #216

Closed
pete2583 opened this issue Jun 18, 2023 · 11 comments
Closed

500 error when selecting episodes #216

pete2583 opened this issue Jun 18, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@pete2583
Copy link

pete2583 commented Jun 18, 2023

Describe the bug
So I have Crunchy installed on two machines. If I run the same command on both one runs it fine and the other one errors out with a 500 error. Both using the latest version.

To Reproduce
Steps / command to reproduce the behavior:

crunchy-cli download -a ja-JP -o "{series_name} - S{season_number}E{relative_episode_number} - {episode_number} - {title} - [{resolution}] - [{audio}]-[Crunchy Roll].mkv" https://www.crunchyroll.com/series/G6JQVM3ER/case-closed-detective-conan[S1E39]

When running without a specific episode number but with --ignore-existing it produces the same error.

Running it without --ignore-existing or episode number it works fine.

However, on the other machine I can do any combinated of episode requests and it just grabs exactly what I want

Expected behavior
Both will download a single episode of a TV show. But one gives a 500 error along with "a unexpected error occurred: expected value at line 1 column 1 at 1:1 (https://www.crunchyroll.com/content/v2/cms/series/G6JQVM3ER/seasons?locale=en-US&preferred_audio_language=ja-JP): :
"
Screenshots
https://imgur.com/a/0i7jLZd
https://imgur.com/a/fS7cEcK

Client (please complete the following information):

  • OS: Ubuntu 22.04
  • crunchy-cli 3.0.0-dev.13 (b55ac9a 2023-06-18)
  • crunchy-cli 3.0.0-dev.13 (49d6480 2023-06-13)

Additional context
Add any other context about the problem here.

@pete2583 pete2583 added the bug Something isn't working label Jun 18, 2023
@bytedream
Copy link
Member

Is the issue still there? I can't reproduce it atm.

@matheus2740
Copy link

matheus2740 commented Jun 20, 2023

I am having the same problem.
I was to able to get around it by setting the powershell locale to the same as the one I'm downloading from (I'm using a VPN and downloading in a dubbed language).

See here on how to change the locale: https://stackoverflow.com/questions/59909992/temporarily-change-powershell-language-to-english (I used the Use-Culture cmdlet)

I think the solution here is to allow for a cmd line argument to override the locale used to call the API.

@pete2583
Copy link
Author

That's for sure an interesting read. Unfortunately I'm not running it in Powershell as I'm a Ubuntu user. I know in yt-dlp there is an option for geo-location-bypass so I guess I need something similar for this.

@matheus2740
Copy link

@pete2583 try setting the locale of your pc to the targeted cr region. For example, I'm in north america but wanted to download content in french, so the fix in my case was to set my locale to fr-FR. The powershell script was just a way to accomplish this without doing a global change in the entire computer.

@bytedream
Copy link
Member

You are able to overwrite your locale which gets used by crunchy-cli with the (root) --lang flag. This should have the same impact as changing your system locale.

@pete2583
Copy link
Author

That's interesting. I didn't know that.

So if I wanted the UK would I set the lang to:

--lang to en/GB

Cheers

@matheus2740
Copy link

@bytedream I am passing the --lang flag, and yet it won't work unless I set my system locale using the powershell script

@bytedream
Copy link
Member

Okay that's a bit weird. I'll look into it when I have sufficient time

@bytedream
Copy link
Member

Could (one of) you paste the full error output @pete2583 @matheus2740? In the first screenshot provided is more text after a unexpected error occurred: expected value at line 1 column 1 at 1:1 (https://www.crunchyroll.com/content/v2/cms/series/G6JQVM3ER/seasons?locale=en-US&preferred_audio_language=ja-JP): : which got cut out.

@pete2583
Copy link
Author

pete2583 commented Jul 5, 2023

Hey.

So the full error is as below:

crunchy-cli download -a ja-JP -o "{series_name} - S{season_number}E{relative_episode_number} - {episode_number} - {title} - [{resolution}]
- [{audio}]-[Crunchy Roll].mkv" https://www.crunchyroll.com/series/G6JQVM3ER/case-closed-detective-conan[S1E39]
:: ✔ Logging in
:: expected value at line 1 column 1 at 1:1 (https://www.crunchyroll.com/auth/v1/token): : <!DOCTYPE html>
<html lang="en-US">
<head>
    <title>Just a moment...</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="robots" content="noindex,nofollow">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="/cdn-cgi/styles/challenges.css" rel="stylesheet">
</head>
<body class="no-js">
    <div class="main-wrapper" role="main">
    <div class="main-content">
        <noscript>
            <div id="challenge-error-title">
                <div class="h2">
                    <span class="icon-wrapper">
                        <div class="heading-icon warning-icon"></div>
                    </span>
                    <span id="challenge-error-text">
                        Enable JavaScript and cookies to continue
                    </span>
                </div>
            </div>
        </noscript>
        <div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/captcha/nojs/transparent.gif?ray=7e1f39effbfb3aa2')"></div>
        <form id="challenge-form" action="/auth/v1/token?__cf_chl_f_tk=JpQkAzTE.Q79kDoP7pUX1oY7pyKw55bXFYg_knhmLh4-1688556106-0-gaNycGzNCjs" method="POST" enctype="application/x-www-form-urlencoded">
            <input type="hidden" name="md" value="4JSeWzQbHIaF77zgDVHeKznF513hE1I47E4YszR8MdU-1688556106-0-AbbJYjQXbHVl_Y2KOPAUwKzOcK0RQMxNcbjt84oO0Ar8BiovD56uINGZHC2bUtnkYRlHew4q4Wkwq4WhXtupLfxWDERSYqyovNV4dgngDrU-avwQWQ900DpsKNsjZcFGcpqitlU3Akr2IUeqqo-Ir6IcNNs_d3pP9mEulpNFrbIDQY8n8VwJxvPc95M0UzKtSbmdxZZrwofwKF4q4Tlnuyklekyaxqeg_IpOFY6eJCbBL1jfAz2BFTtYvpx5aRoC4imvi9GxZ4JhavCdDGW6XuQAx_I5ghgOH9u83jrEZkrZJCR1ln0vhCvTVJ4370sdQRYhMPjm8HODbb5mx9xPYEoFY457MCaeIpeESKBg_p21OkBizcXNkNSJyUSY91stYDpetGlops2RiH5HPvqP2fq73SyNzThZ1DIpOGTe-TRBs8Jy-rpOxsaaFgQv_Lfggzuhs_rPSZvnOi_iBHjtqFma4vn2jrSlxovV531GLCWEj8lvJCUFKav6JuwlYMau8Wys6misRMZv0bgSlG_gJde0mNPPLe5lcltdCKMqyrir6lHsXYRyXW9LSAmbC5b8TRms7mH29pt-Z1MO-B-YFvY-YESGc6lGPINqDs0an6auU5fMBTBFzdyVUGVpjilEUPdlfDp7id0X6adQ3nkM57mhPk5Hk34KWGdsi70CXzrB5reUkihP_R1n5pjds15PSNTpiNhX2S57Yg0DVrBEXjYl9_bCD5dua1-qU6YrKD4W2p8e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uTBi7RncF47eWPpsOyzKfZRd8sCxY2Xk4fzF8R1OtyshpNghJzEl1qqNrJNKb3faMxjPqPEGgqN-VodtuJqpWxmr31OoQo6O8Nj4XlFI6BRnNPGMjBlTFjwR5OlyyyjjYSN4BQBzeO-bZkkChJRnJIN77DSq8m9VTl4mB0Zkvh-Rhe0o6pbWoquBD5rlbUO4hOs7exbGfOSFpnzCN3c12_Nk3gyOYJtlhQjlFDjgbEaxSfV2GptUz_JU6ohT0UcU03tgTVgYhKyGpyfqFxuVfighT8NEzRkqKAMeW99F6RKX7N_cKtokBdI8Y4OvvTQc1slGP_mH-HLpGsDmbZ0sopxnhFw5A5NxWL6TT86Yrf5YR2ZvAlXvQLnbEMBNBnD_Z0Mg-VIFlpQ9GW-eZlLsn-HLAOk6C3b7tgjYk3UYobIJ2snM_mv5yUVjzpRQWsfvbIrt-iRBJeLRwUSu_WW3I-k7Pq6Y3BAS3T957ysXlfpuAEwOzjlXSkZvCBEoJXlCUZD_DZJxcffT6a9I8SbF-9yQu9ARdvatfFYqTY6PMfU8_iTJ1HsY4xwxqt-i7NhyA1rFT2E9wcu7yLv7vtiWo1-O0tsxAkzVgHEwikDidY32eWJvr44cx35ysbpkGz5fz2NJUBY63XrLbB-0wjVjHgutfsMxhUL6A8nnP97RRDzAz_6ocYSfcAyOR9uQ084q2TY6oZ2DieRvGyLpcRcy_ahXGktA">
        </form>
    </div>
</div>
<script>
    (function(){
        window._cf_chl_opt={
            cvId: '2',
            cZone: 'www.crunchyroll.com',
            cType: 'interactive',
            cNounce: '2066',
            cRay: '7e1f39effbfb3aa2',
            cHash: '9ab5b27e8eab734',
            cUPMDTk: "\/auth\/v1\/token?__cf_chl_tk=JpQkAzTE.Q79kDoP7pUX1oY7pyKw55bXFYg_knhmLh4-1688556106-0-gaNycGzNCjs",
            cFPWv: 'g',
            cTTimeMs: '1000',
            cMTimeMs: '0',
            cTplV: 5,
            cTplB: 'cf',
            cK: "",
            cRq: {
                ru: 'aHR0cHM6Ly93d3cuY3J1bmNoeXJvbGwuY29tL2F1dGgvdjEvdG9rZW4=',
                ra: 'TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzEwOC4wLjAuMCBTYWZhcmkvNTM3LjM2IEVkZy8xMDguMC4xNDYyLjQ2YQ==',
                rm: 'UE9TVA==',
                d: 'PB3AWYewlJ97K/M2OjsCH3UluTK4fGWS/aNONFhrVGPnZy4v08uGWOavAuyYoRzByy6Mjak2t7a5CFhyOZIQJSIit/dJMfcJWLia+ZWAMxdXlzuQIlexRyO7SdvdrcKhgZLPxsOWrM8b8znV9XuTUtpH2f5l/NieZ7j2KarqpcSvGs8f5kpi+584QP2sywF4WFuCytCAOcfm/DBdMV6cBL7fsbrzkiNGxqnkbeQB8auzohbBL0jQPnSbKFS3/pIwzJTCO7ItrLlnttR2RhuLEpUm/iWJiXEYLnrhy3Q93jSqlZ5FsLRDMyLVAp9fl8M8+76sHETSqpjG714Dh5l6YicYgBa6Zip6K3ygqL01WO5sTEORTlv1p5KHSwhO2GOD/tLtQxDxlHEd4D03g4MY3X1cyYbliWbh02OhljqaMSY3sh+ZcH1q9JkggHsZNc21P2A7lJUUDXp5VyqrkCfBUQKveh+gc3FY/8gQMDrGuiyJ4k5NTIMFjX+eIxS5CfaMoQs1hUpcayAmS549qKp/FE/1D44ALVf0khKLhC4QjYlHDpUAf1UKLL66glMAIubJIairu92h8nnv2/UVnEHOOA==',
                t: 'MTY4ODU1NjEwNi4yNDcwMDA=',
                cT: Math.floor(Date.now() / 1000),
                m: '0l2O5kPuCBfTvhVn+jVbSwlHJ0GdZgHVGQR6KuEiaos=',
                i1: 'N1Uhk31mt17Pt6vc7+WvzA==',
                i2: 'dRXoPoYsZ91U5oZFg1TwVA==',
                zh: 'qQz4tblgEgtOKuLwUaA7NrEUXyzFHvjAH4jkpQCn35I=',
                uh: '2t+rFn8KEzvjNbeHViAPFROowHq9NJ6WRekpBQcGr2w=',
                hh: 'X/ui56Hpfhv5vN0FUDU58Tk8kOdH4hwp+B7yjRL1zVA=',
            }
        };
        var trkjs = document.createElement('img');
        trkjs.setAttribute('src', '/cdn-cgi/images/trace/captcha/js/transparent.gif?ray=7e1f39effbfb3aa2');
        trkjs.setAttribute('alt', '');
        trkjs.setAttribute('style', 'display: none');
        document.body.appendChild(trkjs);
        var cpo = document.createElement('script');
        cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/captcha/v1?ray=7e1f39effbfb3aa2';
        window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
        window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, location.href.length - window._cf_chl_opt.cOgUHash.length).indexOf('?')
!== -1 ? '?' : location.search;
        if (window.history && window.history.replaceState) {
            var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
            history.replaceState(null, null, "\/auth\/v1\/token?__cf_chl_rt_tk=JpQkAzTE.Q79kDoP7pUX1oY7pyKw55bXFYg_knhmLh4-1688556106-0-gaNycGzNCjs" + window._cf_chl_opt.cOgUHash);
            cpo.onload = function() {
                history.replaceState(null, null, ogU);
            };
        }
        document.getElementsByTagName('head')[0].appendChild(cpo);
    }());
</script>
</body>
</html>

@bytedream
Copy link
Member

Ty. This error is triggered by cloudflare which already has its dedicated issue #104, I should've asked earlier for the full error output. But I still don't know how the system locale can decide if the error shows up or not.

@bytedream bytedream closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants