Python Torrent Search
So the other day my roommate suggested I learn Python. So I simply figure, why not! I only know a handful of languages and markups, let’s add Python to the list. It seemed very easy to pick up and I decided to try and crank out an application. While I wanted to build a basic app, I wanted to make it provide some sort of use. So I decided to build a Desktop based Torrent Search.
The app is a meta search that opens up a google search in your default browser specifically for any .torrent file that meets your query. Why .torrent files? BitTorrent is a protocol for filesharing that allows distribution of large amounts of data. It accounts for approximately 35% of the traffic on the internet. Most users tend to search for torrents on one or two torrent trackers, this one allows you to search the web with google.
The Code
#!/usr/bin/python # Torrent Search # Filename: torrentsearch.py #--------------------- # A .torrent meta search written in Python. # # Author: Michael Springer # Website: michael-springer.net # from Tkinter import * import webbrowser root = Tk() root.title('Torrent Search') root.maxsize(200, 100) l = Label (root,text='Enter your search query') l.pack(side=TOP,padx=2,pady=2) e = Entry(root, width=50) e.pack(side=TOP,padx=2,pady=2) e.delete(0, END) search = "http://www.google.com/search?q=filetype:torrent+" def clear_entry(): e.delete(0, END) def doit(): webbrowser.open_new(search + e.get()) # For testing purposes..arrrrrgh def printit(): print search + e.get() b1 = Button(root, text='Clear', command = clear_entry) b1.pack(side=LEFT) b2 = Button(root, text='Search', command = doit) b2.pack(side=RIGHT) root.mainloop()
Pretty simple right? Just 48 lines of Python using Tkinter modules for the GUI. It has a Clear button to empt the entry box and a Search button for, well searching. I plan to in the near future bind the search function to the carriage return key.
Dependencies
To run the Torrent Search application you will need the following:
- Python 2.5+
- Tkinter
Update: I noticed there were unused lines of code, so I removed them and everything still seems to run fine.
Update2: After some feedback I found out it will not run in windows, I will look into getting it fixed.
Download the Python application here.
Feel free to tell me what you think of it, how it works for you, and any suggestions you may have; feedback is much appreciated.

Posts about Website traffic as of July 5, 2009 | Ebusiness Blog
July 5th, 2009
[...] Reasons book manuscripts are rejected @cassidylewis Ten Marketing Questions Authors are Asking ( Python Torrent Search – michael-springer.net 07/05/2009 So the other day my roommate suggested I learn Python . So I [...]
July 6th, 2009
Hi there,
michael-springer.net – da best. Keep it going!
Have a nice day