Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*-coding: cp1251 -*-
- import urllib2
- import cookielib
- import urllib
- import lxml.html
- nick = 'nick'
- passw = 'pass'
- cookie = cookielib.CookieJar()
- opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie))
- urllib2.install_opener(opener)
- headers = {"User-Agent" : "Mozilla/4.0 (compatible; MSIE 5.5; WindowsNT)" }
- data_s = {"email":nick, "pass":passw}
- send_data = urllib.urlencode(data_s)
- u_request = urllib2.Request("http://vkontakte.ru/login.php", send_data, headers)
- try:
- vk = urllib2.urlopen(u_request)
- except:
- cookie = status = "ERROR"
- print cookie, status
- else:
- if "remixsid=deleted" in str(vk):
- print "NO"
- else:
- print "YES"
- vk1 = urllib2.urlopen('http://vkontakte.ru/friends?all=1')
- #vk2 = urllib2.urlopen('javascript: Friends.showMore()')
- doc = lxml.html.document_fromstring(vk1.read())
- for name in doc.cssselect('div.labeled a'):
- print name.text
Advertisement
Add Comment
Please, Sign In to add comment