Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
Search for films in 'mynamelist.txt'. If not found write film name in 'result_list'
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# created by x0x01 (aka.x0x01[AT]gmail[dot]com)
import urllib, urllib2, cookielib
import re
from string import strip
LOGIN = 'User'
PASS = 'password'
OUT_DIR = '/home/user/rutracker/'
# формирование кук
post_params = urllib.urlencode({
'login_username' : LOGIN,
'login_password' : PASS,
'login' : '%C2%F5%EE%E4'
# инит обработчика кук
cookie = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie))
# авторизация + сессия с куками
web_obj ='', post_params)
data =
file_film_list = open('mynamelist.txt', 'r')
film_list = file_film_list.readlines()
r_list = open('result_list', 'w')
for film_name in film_list:
print 'Searching for: ', film_name
search_url = ''+film_name
web_obj =, post_params)
data =
if not"leechmed", data):
print 'Not found!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment