It seems that the majority of your answer is code copied and pasted from elsewhere, regardless of whether it's attributed properly. The OP mentioned in the question that Interception had already been tried and failed, so I'm not sure why you included code from an Interception wrapper. The Selenium code isn't even close to relevant - Selenium is for automating web browsers for website testing, automation, and scraping, not creating mouse movements for games.
If you're going to answer a question, it has to be an original contribution. It's okay to use some attributed code from elsewhere, preferably modified somewhat to fit the situation, but just copying someone else's work without adding anything original of your own isn't doing anyone any good. Use others' work as a starting point for your own customized solution. I use documentation to figure out how to do something (and link to it, for reference), but answer the question in my own words.
@DialFrost It's not the greatest I've ever seen, no...
Sure. Looking for constructive criticism is definitely a positive trait.
To be fair, the question isn't great, either - it's basically a recommendation request, which is explicitly off-topic. I'm surprised it hasn't been closed.
@Aran-Fey i mean lets say i am using package A and B, where a require package d >v2.3 and B require v>2.4 so with this info, i require package d>=2.4 for better compatibilty. so looking for a tool which can make such information from requirement.txt file itself (for legacy project i am facing issue now as it is trying to install all package and seeing which is better), so that i can download them all in one single go
from my own javascript knowledge, that also seems to be unequalized...the problem beside the bug that doesn't return an error is also the limitation caused by CORS and CSP. Maybe try to make a simple MRE using a local audio file on a simple HTML and see if it work on localhost first
once it work there, then fixing the CORS/CSP limitation or working around it should be easier
I don't see a solution to my problem in there, but at least I now know who I have to curse for this stupid design decision. Dishonor on Robert O'Callahan, dishonor on his family, and dishonor on his cow
additionally, you could check out the javascript room chat :P I went there myself once when I was doing my weird and unfinished python/js project
to fix it, there are dozens of way, I guess you could use a server that fetch the file on a buffer or locally and do whatever you have to do on it (websocket anyone?). Since you plan on making an extension, I guess you could also use the probably existing flags to "disable" the CORS/CSP limitation. However, that's usually unadvised, but if you're the only one using that extension...
I am injecting JS code into the page, but since the audio is being loaded from a different domain, the browser refuses to let JS access the audio stream
You can sort of hijack console.warn and if you get the message you're interested in, throw an exception or do something else instead, like:
og = console.log
console.log = (message) => {
if (message == 'hi') alert(message);
og(message)
}
@NordineLotfi I think it would be possible to load and play the audio file with JS, but there are multiple problems with that. One, The <audio> element on the webpage would become useless - the user wouldn't be able to change the volume, for example. And two, if it's actually a video, then I'd end up downloading the whole video twice.
@duhaime I remember doing the same thing when I wanted to know when a function finished or not. There a couple of tiny problems with this though, like the fact that it overwrite certain unknown function that also use console.log or the fact that you can easily end up in a recursive loop depending on what is being executed.
it's too bad there isn't any way to get access to the "queue" or stack of what's going to be executed in browsers, otherwise would make certain things easier
well how about injecting it into a page from a domain that has the right CSP set? I mean it plays on wiki pages, right? So their CSP allows that domain/subdomain
@Aran-Fey hmm, true. Maybe you could make one of those websocket but with chunk support? might be more complicated though, but I think there some implementation of that for audio somewhere. There also still the flags for disabling CORS/CSP limit if you really want to do it (only work inside an extension)
@duhaime Doesn't seem to work :( I tried warn, log, and debug, but none of them are called
@PeterT I don't see how this would work. Say there is only one single browser tab, which is on the domain stackoverflow.com. This tab plays an audio file from wikimedia.org. Where/how am I supposed to inject my JS?
another thing you could do is find a firefox extension that does something to an audio file/stream on a per tab basis, then inspire yourself from how it works.
Oh, that's an interesting idea. That sounds like it should work, but then again, can it really be so simple to bypass this security measure? Guess we'll find out...
The iframe thing is actually a lot trickier than I thought... it's not like I can just create an iframe with arbitrary HTML inside; I need to actually find a valid URL on that domain and then completely rewrite the HTML
I know very little of CORS, so maybe I'm restating the obvious: if I put crossorigin="anonymous" on the audio element, I can still hear the audio after clicking the button. jsfiddle.net/gboavx6n/1
There's a good chance one of you will now say, "yes, that works specifically when you're on jsfiddle.net because jsfiddle's server sets the 'allow cross origin tomfoolery: true' flag in all of its response headers. But most servers set that to false."
Alright, so as far as I can tell, crossorigin="anonymous" works as long as it's set before the browser starts loading the file. But, since it tells the browser not to send any credentials/cookies/whatevers along with the request, there's a chance that the server responds with "Who the heck are you?! I'm not sending you my audio file"
Hi, I'm trying to understand why I need print("\r\n") at the beginning of my python script to print in my Mac Terminal. I didn't need this when running on Windows. Could someone help explain this to me or recommend a resource? I can't seem to find an explanation on Google for why it's needed for my mac terminal.
@PeterT I dont think I've ever seen anyone use plain "println". It's always System.out.println or some sort of logging library and I've never had logging issues deploying locally across diff OSes. With Python, my single py script has different results across different terminals. Sometimes I need to flush in the script, sometimes I need to use -u program.py, etc.