What are the best Python scripts you've ever written? by @manoj_g33k
Answer by Manoj Memana Jayakumar:
UPDATE: I got a job because of these scripts!
1. One-click subtitle downloader for any movie/tv series episode:
We have all had those days where we open up subscene or opensubtitles, search for the movie/TV series name, select the correct ripper, download the subtitle, unzip it, cut and paste it in the movie's folder and rename it to match the name of our movie file.
Too tedious right? Well, I wrote a script to download the correct subtitle for a movie/tv series episode and save it, right next to your movie file. All with just one click.
Don't understand what I'm saying?
See for yourself:
That's right. Just click once, and abrakadabra!
The most matching English subtitle for your movie or tv series episode is downloaded to the very same folder, renamed to the very same name as that of your movie file.
All of this in under 4 seconds!
So all you have to do now is open the movie file, crunch the popcorn and enjoy the show. 🙂
Source on GitHub:
Update: Now you can download subtitles for multiple files at once. Press Ctrl and select the files you need to find subtitles for, and then execute the script.
2. IMDb Lookup/ Spreadsheet Generator
I am a movie buff, and I love watching movies. I have a huge collection of movies with me, and I get confused as to which one to watch.
So what do I do to avoid this confusion and to select one to watch tonight?
That's right. IMDb.
I open up, type in the name of the movie, see the rating, read the review and find out if it is worth watching.
But hey, I have so many movies with me! Who wants to type in all these names in the search box ? I don't want to, especially because I believe "If something is repetitive, it can be automated"
So I wrote a Python script which makes use of the unofficial IMDb API to fetch the data.
I select a movie folder/file. Right click it. Click on Send To. Click on IMDB.cmd ( This, BTW, calls the Python script which I have written.)
My browser opens up with the exact IMDb page of the movie!
All this, just with the click of a button.
If you did not understand how cool this is and how much time it can save you, watch the video here:
From now on you don't have to open up your browser, wait for IMDb to load and type in the movie name. The script does all this for you!
As always, the source is on GitHub: with the instructions on how to use it.
Of course, there is a certain percentage of error, because of the fact that the script has to clean up all the junk values in the file/folder name like "DVDRip, YIFY, BRrip", etc., but the script works well with almost all the movies that I have it tested on.
Many people asked me whether I could write a script so as to find details of all movies within a folder, as finding details of one movie at a time is cumbersome.
I have now updated the script to send a folder to the script, analyze all folders within the folder, fetch details of all movies from IMDb and then open a spreadsheet, sorted by decreasing order of IMDb rating.
It also consists details like the IMDb URL, year, plot, genre, awards, actors and everything else you could possibly find in IMBb.
Here is how the spreadsheet generated by the script looks after the script is executed.
Your very own personal IMDb database! What more can a movie buff ask for? 😉
Source on GitHub:
3. theoatmeal.com COMICS DOWNLOADER
I'm a huge fan of Matthew Inman's comic. They are insanely funny and thought-provoking at the same time.
However, I was tired of clicking next and reading every comic.
Also, it was difficult to download them even manually because each comic is divided to many pictures.
So, I wrote a Python script to download all the comics from the site.
The script makes use of BeautifulSoup ( ) to parse the HTML data, so make sure you have it installed before trying to run the script.
The source code of oatmeal downloader is available on GitHub:
This is how the folder looked after download 😀
4. someecards.com DOWNLOADER
After successfully downloading comics from, I wondered if I could do the same thing and download stuff from another favourite site of mine – the hilarious, one and only .
The problem with someecards was that the pictures are purely randomly named and there is no specific order in which they are arranged and there are tons of photos in each category. And there are 52 such categories.
I understood that it would be best if my script is multithreaded since there is so much data to be parsed and downloaded, and hence I allocated a thread each to each page in each category.
The script downloads all of those hilarious ecards from each single category of the website. Every single one of them (!) into a separate folder.
Now I have my own private collection of the most amazingly funny ecards on the planet.
This is how the folder looked after the download was complete.
That's right. 52 categories, 5036 ecards in my very own private collection.
The source code is available here:
EDIT: Lot of people asked me whether I could provide all the files that I have downloaded. I could not upload it to a file hosting service owing to my very unreliable network, but I have uploaded a torrent of the same and you can download it from here:
Seed and spread the love! 🙂
Do comment or message me if you have trouble running any of these scripts. I am always happy to help 🙂
Python FTW \m/