problem:emulate it in python with mechanize

contro opinion contropinion at gmail.com
Sun Jan 15 08:59:02 EST 2012


you can do it by hand ,
1.open
http://www.flvcd.com/'
2.input
http://v.163.com/movie/2008/10/O/Q/M7F57SUCS_M7F5R3DOQ.html
3.click  submit
you can get
http://mov.bn.netease.com/movie/2012/1/V/7/S7MKQOBV7.flv

i want to  emulate it  in python with  mechanize,here is my code ,why i
can't get  the  right result:
 http://mov.bn.netease.com/movie/2012/1/V/7/S7MKQOBV7.flv



import mechanize
import cookielib
import lxml.html
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
br = mechanize.Browser()
br.set_handle_robots(False)

r = br.open('http://www.flvcd.com/')
for f in br.forms():
    print f
br.select_form(nr=0)
br.form['kw']='http://v.163.com/movie/2008/10/O/Q/M7F57SUCS_M7F5R3DOQ.html'
print  br.submit().read()

why??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120115/f91a0ec9/attachment.html>


More information about the Python-list mailing list