import ctypes import urllib import webbrowser from datetime import datetime def do_check(data, match): for x in xrange(0, 5): if match in data[x] or match.replace(' ', '.') in data[x]: return x return -1 def main(): match = raw_input('Enter part of torrent name to match: ') while True: data = urllib.urlopen('http://predb.me/').read().split('') result = do_check(data, match) if result != -1: print 'Torrent found at ' + str(datetime.now()) + '. Opening in browser now..' url = 'http://predb.me?post=' + data[result+1].split('http://predb.me?post=')[1].split('"')[0] webbrowser.open_new_tab(url) break if __name__ == '__main__': main()