mechanize

How to use Ruby Mechanize to automatically like Facebook posts

Hi, I'm trying create a bot which automatically "likes" Facebook posts. Using Mechanize I can log into facebook, but unforunately the links to the like button are not understood by Mechanize - they seem to be obsfuscated by JS. The only links I see are the basics such as: <Mechanize::Page::Link "Edit friends" "http://www.facebook.co...

Which is best in Python: urllib2, PycURL or mechanize?

Ok so I need to download some web pages using Python and did a quick investigation of my options. Included with Python: urllib - seems to me that I should use urllib2 instead. urllib has no cookie support, HTTP/FTP/local files only (no SSL) urllib2 - complete HTTP/FTP client, supports most needed things like cookies, does not support ...

How do I disable history in python mechanize module?

I have a web scraping script that gets new data once every minute, but over the course of a couple of days, the script ends up using 200mb or more of memory, and I found out it's because mechanize is keeping an infinite browser history for the .back() function to use. I have looked in the docstrings, and I found the clear_history() func...

Python mechanize ignores form input in the HTML

Got my little mechanize code: br.open('http://tumblr.com/customize'); print br.response().read() print br.form['edit_tumblelog[cname]'] # there definitely is edit_tumblelog # and br.form['edit_tumblelog[enable_cname]'] works fine Output: ... <br/> <input typ...

Ruby: Problems using Mechanize to access my form!

Hello! Just for fun, I wrote a very small rails blog (just a hello world). Now I want to create a post using mechanize. So I created a Ruby Prog and started coding. Here is my problem: Rails creates my form element including all inputs. In HTML my inputs look like this: <input type="text" size="30" name="post[title]" id="post_title"> ...

How can I use Python with Mechanize for posting multipart/form-data?

Hi there! I am using http://pypi.python.org/pypi/mechanize/0.1.11 for programmatic web browsing, I want to be able to upload files to servers the same way the browser does (by sending the content as multipart/form-data, defined in RFC2388) Is this possible with mechanize, can you show me an example? Thanks! ...

GAE-mechanize sourcecode

Hi, i saw a project that made mechanize compatible to google app engine. But I couldn't find the sourcecode to it It would be very nice if someone can give me the source of it, because I most likely need this in the app I'm creating currently. ...

Nokogiri Error: undefined method `radiobutton_with' - Why?

Hello! I try to access a form using mechanize (Ruby). On my form I have a gorup of Radiobuttons. So I want to check one of them. I wrote: target_form.radiobutton_with(:name => "radiobuttonname")[2].check In this line I want to check the radiobutton with the value of 2. But in this line, I get an error: : undefined method `radiobutto...

Issues logging in LinkedIn with ruby mechanize

Hi folks, this week I'm having problems logging in LinkedIn using ruby mechanize. My code is as follows: agent = WWW::Mechanize.new home_page = agent.get('http://www.linkedin.com') sign_in_link = home_page.links.find{|link| link.text == "Sign In"} login_form = sign_in_link.click.form('login') # with email and password variables properl...

Python mechanize to follow image links?

mechanize's Browser class is great and it's follow_link() function is great too. But what to do with this kind of links: <a href="http://example.com"&gt;&lt;img src="…"></a> Is there any way to follow such links? The text attribute of this type of links is simply '[IMG]', so AFAIK, there is no way to differentiate such links. Any help...

python mechanize.browser submit() related problem

Hello All im making some script with mechanize.browser module. one of problem is all other thing is ok, but when submit() form,it not working, so i was found some suspicion source part. in the html source i was found such like following. <form method="post" onsubmit="return loginCheck(this)" name="FRMLOGIN"/> im thinking, loginChe...

how to manually add a cookie to Mechanize state?

[I'm working in Ruby, but my question is valid for other languages as well.] I have a Mechanize-driven application. The server I'm talking to sets a cookie using javascript (rather than standard set-cookie), so Mechanize doesn't catch the cookie. I need to pass that cookie back on the next GET request. The good news is that I alr...

Mechanize Javascript ...

I try to submit a form by Mechanize, however, I am not sure how to add necessary form valuables which are done by some Javascript. Since Mechanize does not support Javascript yet, and so I try to add the variables manually. The form source: <form name="aspnetForm" method="post" action="list.aspx" language="javascript" onkeypress="javas...

How to find an element by name using Nokogiri?

<input type="Checkbox" checked="" name="new"> if I have the above html in a document, how would I find it by searching for its name attribute? Edit 1: Clarified that I was looking for a solution using Nokogiri ...

How do I debug a Net::HTTPInternalServerError error when using Mechanize?

c:/ruby/lib/ruby/gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:259:in `get': 500 => Net::HTTPInternalServerError (Mechanize::ResponseCodeError) I get the above error when I try to navigate to the following webpage http://fakewebsite.com//admin/edit_building.cfm?page=buildings&amp;updateMode=yes&amp;id=1251 I can navigate just fine ...

How do I print out the cookies that Mechanized has stored?

I'm using mechanize to login into a website and then retrieve a page. I'm running into some problems and I suspect this is due to some values in the cookies. When Mechanize logs into a website I assume it stores the cookies. How do I print out all the data stored in the cookies by Mechanize? ...

In Mechanize what is the cookiejar and how does it differ from cookies?

How does Mechanize::CookieJar differ from the Mechanize::Cookies array? There must be some difference but after poking around for a little bit I can't seem to find a good explanation? ...

Python Mechanize select a form with no name

I am attempting to have mechanize select a form from a page, but the form in question has no "name" attribute in the html. What should I do? when I try to use br.select_form(name = "") I get errors that no form is declared with that name, and the function requires a name input. There is only one form on the page, is there some other w...

Get Mechanize to handle cookies from an arbitrary POST (to log into a website programmatically)

I want to log into https://www.t-mobile.com/ programmatically. My first idea was to use Mechanize to submit the login form: However, it turns out that this isn't even a real form. Instead, when you click "Log in" some javascript grabs the values of the fields, creates a new form dynamically, and submits it. "Log in" button HTML: <bu...

Opening SSL URLs with Python

Hi folks, I'm using mechanize to navigate pages, it works pretty well. Unfortunately I have a random error come up, by random I mean it occasionally appears. URLError at /test/ urlopen error [Errno 1] _ssl.c:1325: error:140943FC:SSL routines:SSL3_READ_BYTES:sslv3 alert bad record mac> I really need help on this one :) ...