import re
import mechanize
import time
br = mechanize.Browser()
br.open("http://www.qhonline.info/forum/forum.php")
# follow second link with element text matching regular expression
br.select_form(nr=0)
br.set_all_readonly(False) # allow everything to be written to
br.set_handle_robots(False) # ignore robots
br.set_handle_refresh(True)
# User credentials
br.form['vb_login_username'] = '...............'
br.form['vb_login_password'] = '...............'
br.submit()
#br.click_link(href='http://www.qhonline.info/forum/forum.php')
for link in br.links():
print link.text, link.url
br.follow_link(link)
print br.response().read()
br.follow_link(url="forumdisplay.php/3-Y-kien-gop-y")
br.follow_link(url="newthread.php?do=newthread&f=3")
form = br.select_form("vbform")
br.set_all_readonly(False) # allow everything to be written to
br.set_handle_robots(False) # ignore robots
br.set_handle_refresh(True)
for control in br.form.controls:
if control.name == 'sbutton':
control.value = 'ok'
break
br.form['subject'] = 'Chống spam thôi các mod ơi'
br.form['message'] = 'Dạo này spam cháy cả forum rùi,mấy mod ăn tết cũng nên xem lại diễn đàn cái,ọc '
br.submit(name='sbutton', label='ok')
Không có nhận xét nào:
Đăng nhận xét