refactor(streaming): Use aiohttp instead of curl and use Flaresolverr to bypass bot checks - #124
Open
Dolly132 wants to merge 25 commits into
Open
refactor(streaming): Use aiohttp instead of curl and use Flaresolverr to bypass bot checks#124Dolly132 wants to merge 25 commits into
Dolly132 wants to merge 25 commits into
Conversation
**Summary** Well, YouTube is so strict sometimes, so it blocks buffer from actually being sent to the ffmpeg process in time, and we can't control that, however, a 15 seconds timeout was set, youtube usually takes more than 5 seconds to send buffers in time. **Why aiohttp?** I had to get rid of curl because handling it is harder, aiohttp is way easier and more reliable for requests like YouTube and MyInstants. - Solves srcdslab#119 - Now local files don't need a curl process to be made, it can be done inside ffmpeg itself - Set the duration of the youtube video before playing it instead of calculating it during the stream.
Dolly132
marked this pull request as draft
September 3, 2026 13:41
Dolly132
marked this pull request as ready for review
September 3, 2026 14:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this PR focuses on changing the logic used in FFmpegAudioPlayer.
Previously, it was using a curl process to retrieves the bytes of a desired url, no matter whether it was local or from the internet.
however, this PR will not require any process other than ffmpeg itself to play local sounds, and a
aiohttpfor extern sounds.Another change:
Recently, myinstants website added a cloudflare bot protection, so genuinely, before this PR, the torchlight bot could not resolve the bot protection, so it ended up not playing any sound from myinstants.
A fix was introduced to use FlareSolverr from https://github.com/Flaresolverr/Flaresolverr .
Added the required
HostandPortin config for *FlareSolverr`.Changelog:
--no-depsflag on PIP dependencies on production and dev environments. pip will not install any dependency required from the desired one to install.aiohttp-socksandcurl-cffidependencies.FlareSolverr.pymodule to handle everything related to FlareSolverr.Note:
This is a huge PR, i tried my best to test. however there could be errors!
This PR also combines #120