Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Not a valid URL" for media #230

Open
glottisfaun0000 opened this issue Aug 25, 2024 · 1 comment · May be fixed by #231
Open

"Not a valid URL" for media #230

glottisfaun0000 opened this issue Aug 25, 2024 · 1 comment · May be fixed by #231
Labels
bug Something isn't working

Comments

@glottisfaun0000
Copy link

So glad this project is back.

I just spun up a local instance and user pages (and RSS!) load 🎉 but while video thumbnails load, the embedded videos themselves don't ("No video with supported format and MIME type found." in Firefox) and attempting to download or open the video in a new tab goes to an html page saying "not a valid url".

Here's the path url I get:

/stream?url=https%3A%2F%2Fv16-webapp-prime.us.tiktok.com%2Fvideo%2Ftos%2Fuseast8%2Ftos-useast8-pve-0068-tx2%2FoMrAE2qIPCnMUTBGicAiUYHcIfiLzUiAhQN5BA%2F%3Fa%3D1988%26bti%3DODszNWYuMDE6%26ch%3D0%26cr%3D3%26dr%3D0%26lr%3Dall%26cd%3D0%257C0%257C0%257C%26cv%3D1%26br%3D7040%26bt%3D3520%26cs%3D0%26ds%3D6%26ft%3D4KJMyMzm8Zmo0Qbo4-4jVifrQpWrKsd.%26mime_type%3Dvideo_mp4%26qs%3D0%26rc%3DNGhoN2VlM2U4OTVnOTw8OkBpM25mO3M5cmRydTMzaTczNEAtLWFhYWNhXjMxYGBhMmA0YSNvYDZeMmRjYS1gLS1kMTJzcw%253D%253D%26btag%3De00090000%26expire%3D1724586378%26l%3D2024082505451321D656A3BB827C40D476%26ply_type%3D2%26policy%3D2%26signature%3D8b3a03dd8eac4ec95359563c507d74fb%26tk%3Dtt_chain_token

And here's what your instance gets for the same video, which works:

https://proxitok.pabloferreiro.es/stream?url=https%3A%2F%2Fv16-webapp-prime.tiktok.com%2Fvideo%2Ftos%2Fmaliva%2Ftos-maliva-ve-0068c799-us%2FoMrAE2qIPCnMUTBGicAiUYHcIfiLzUiAhQN5BA%2F%3Fa%3D1988%26bti%3DODszNWYuMDE6%26ch%3D0%26cr%3D3%26dr%3D0%26lr%3Dall%26cd%3D0%257C0%257C0%257C%26cv%3D1%26br%3D7040%26bt%3D3520%26cs%3D0%26ds%3D6%26ft%3D4fUEKMPc8Zmo0_No4-4jVuJKupWrKsd.%26mime_type%3Dvideo_mp4%26qs%3D0%26rc%3DNGhoN2VlM2U4OTVnOTw8OkBpM25mO3M5cmRydTMzaTczNEAtLWFhYWNhXjMxYGBhMmA0YSNvYDZeMmRjYS1gLS1kMTJzcw%253D%253D%26btag%3De00090000%26expire%3D1724586333%26l%3D2024082505442678C623FC9C56BF3ABD69%26ply_type%3D2%26policy%3D2%26signature%3D2f91c561f8651f0fedd56c2cbd9dbd81%26tk%3Dtt_chain_token

Same thing happens for audios.

I can't tell if it's a URL encoding thing or what. PHP issue?

My install is just git clone, docker compose up -d

@glottisfaun0000 glottisfaun0000 added the bug Something isn't working label Aug 25, 2024
@elektrikfisch
Copy link

elektrikfisch commented Sep 2, 2024

I found the issue in app/Controllers/ProxyControllers.php around Line 42

Pablo's instance is getting streams from v16-webapp-prime.tiktok.com but your (and my!) instance is getting streams from v16-webapp-prime**.us**.tiktok.com which makes $host_count 4 so it fails the if statement. Instead of checking different array elements depending on the length of the array $host_split, I used array_slice to just put the last two elements of $host_split into $host_domain and now it's working as expected:

    static private function isValidDomain(string $url): bool {
        $valid = false;                                       
        $host = parse_url($url, PHP_URL_HOST);
        $host_split = explode('.', $host);
        $host_domain = array_slice($host_split,-2);
        $valid = in_array($host_domain[0] . '.' . $host_domain[1], self::VALID_TIKTOK_DOMAINS);
        /* $host_count = count($host_split);
        if ($host_count === 2) {
            // Using no watermark
            $valid = in_array($host_split[0] . '.' . $host_split[1], self::VALID_TIKTOK_DOMAINS);
        } elseif ($host_count === 3) {
            $valid = in_array($host_split[1] . '.' . $host_split[2], self::VALID_TIKTOK_DOMAINS);
        } */
        return $valid;
    } 

Probably clumsy, but it works lol

@elektrikfisch elektrikfisch linked a pull request Sep 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants