Breaks Captcha - #28
Conversation
| with open(filename, "wb") as handle: | ||
| for data in content.iter_content(): | ||
| handle.write(data) | ||
| # END TEST |
| time.sleep(1) | ||
| outeriframe.click() | ||
| time.sleep(2) | ||
| allIframesLen = driver.find_elements_by_tag_name('iframe') |
There was a problem hiding this comment.
"allIFrames" seems like a more accurate name for this variable, unless you want to just save the len() of this directly and skip it on line 71
There was a problem hiding this comment.
Yeah you are correct there
joeyagreco
left a comment
There was a problem hiding this comment.
Suggested a few minor changes, otherwise looks good!
| except FileNotFoundError: | ||
| pass | ||
| # convert wav to mp3 | ||
| subprocess.run(f"ffmpeg -i {mp3Path} {CAPTCHA_WAV_FILENAME}", shell=True, timeout=5) |
There was a problem hiding this comment.
Are there any benefits to using ffmpeg over pydub's AudioSegment? Seems like an extra layer of complexity for the end user (installing ffmpeg & setting up the path) vs 3 lines of code in main.py and 1 in requirements.txt à la #26 .
A better way than both methods would be probably be to save the incoming stream straight to WAV, but my brain is too fried to work that out at the moment.
Also, is checking for the file and deleting necessary before running ffmpeg? Using the solution in #26, sound.export() overwrites the old WAV file during each new iteration. Perhaps ffmpeg can't do that for some reason (permissions?) or needs an additional command flag?
There was a problem hiding this comment.
I simply couldn't get pydubs working. I think you are right though saving directly to wav would be best
There was a problem hiding this comment.
Also my understanding is that pydubs relies on ffmpeg for conversion anyway
There was a problem hiding this comment.
I see. I wonder if anyone else who's tested with the #26 solution has had issues with pydub? I hope not... 🤦
I didn't mean to give you hard time about ffmpeg, but I've done A LOT of scripting with it in the past. And while it's been...a while...for me, ffmpeg used to have a pretty dodgy reputation for breaking things with their updates, in addition to some nasty security loopholes stemming from outdated libraries. Maybe that's not the case anymore, but it was bad enough just a few years ago that I would regularly have to re-write scripts after updates to account for altered internal default values or implementation differences between distros. That's my unsolicited $0.02 on ffmpeg 😅
There was a problem hiding this comment.
Also my understanding is that pydubs relies on ffmpeg for conversion anyway
Well I learned something today. I should have RTFM. Doh!
ffmpeg on its own is still kludgy IMO, maybe that's why I prefer using the pydub wrapper. When I get some time, I'll work out the "clean" solution and hopefully we'll be done with creating multiple audio files.
Thanks to @jmrushing for providing the code to break the captcha. Just tried to make the code a bit neater. It now has a separate function for breaking the captcha and calls on FFmpeg without a wrapper library as this appeared easier than getting everyone to sort out the extra dependencies. Additionally, it tells people to install FFmpeg in the read me. (Also thanks to @joeyagreco I'd started working on my PR before you submitted yours but I used yours to speed up adding the new constants to my code.)