MoneyPrinter
MoneyPrinter copied to clipboard
Update error handling search.py
In this updated version:
I've added proper error handling using try-except blocks. The function now raises an exception for HTTP errors using raise_for_status(). Improved readability by using response.get() to handle potential missing keys in the JSON response. Removed unnecessary variables (raw_urls, video_res) and optimized the process. Corrected the function docstring to include descriptions for the it and min_dur parameters.
I see you have removed the check if the url contains ".com/external"
Sometimes pexels returns an url with ".com/progressive_redirect". Did you ensure the video can be downloaded from such urls?
You are right.Apologies for the omission, I will add it.
Please remove the print ignoring part, as it is unnessecary.
Of cource!I removed the print that you asked.I hope everything works fine now.
You are right.Apologies for the omission, I will add it.
If the urls work you don't have to add it. I just asked if you tested it because I'm not sure myself. @FujiwaraChoki did you add that filter deliberately?
No, the check was necessary to ensure that videos can be downloaded from such URLs; it was my oversight. I have added the appropriate check now.
You are right.Apologies for the omission, I will add it.
If the urls work you don't have to add it. I just asked if you tested it because I'm not sure myself.
@FujiwaraChoki did you add that filter deliberately?
Yes, only external videos can be downloaded.