When I try to scrap this site with Phantomjs, by default, Phantomjs send the following headers to server:
"name":"User-Agent",
"value":"Mozilla/5.0 (Unknown; Linux i686) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.1 Safari/534.34"}
And I get an status 405 "Not Allowed"
response.
I read in the Phantomjs API Reference that in order to imitate a request coming from some other browser, I should change my User-Agent value. On Wikipedia I found the value I should use for pretending to be Firefox under Ubuntu:
'name': 'User-Agent',
'value': 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:16.0) Gecko/20120815 Firefox/16.0'
In what part of Phantomjs should I put this properties? Where should I insert them - inside page.open, or inside page.evaluate, or at the top of it?
getElementsByClassName
after jQuery > sizzle – Afterdinner