Python Headless Web Browser Scraping on Amazon Linux
fruchterco.com
Python Headless Web Browser Scraping on Amazon Linux
1–10 of 40 posts
Re: Python Headless Web Browser Scraping on Amazon Linux
#2Minor nitpick: I don't think it is a good idea to copy a binary directly to /usr/bin, without a package manager. You could just put it into /opt and symlink to /usr/(local/)bin.
Re: Python Headless Web Browser Scraping on Amazon Linux
#3Re: Python Headless Web Browser Scraping on Amazon Linux
#4Fortunately you can do it by using phantomjs directly instead of going through the Selenium WebDriver API. Maybe one day the phantomjs WebDriver API implementation (ghostdriver) will extend the API to pass HTTP status information back to the caller. Until then, this API is unusable (at least for me).
Re: Python Headless Web Browser Scraping on Amazon Linux
#5You are installing some devel-packages, but i don't see anything compiling? Does the selenium installation build native extensions? Then the commands should probably the other way round. Or is phantomjs compiling something on the first run? Minor nitpick: I don't think it is a good idea to copy a binary directly to /usr/bin, without a package manager. You could just put it into /opt and symlink to /usr/(local/)bin.
Re: Python Headless Web Browser Scraping on Amazon Linux
#6PhantomJS is brilliant, but Selenium is a questionable choice for this task. For some reason, the creators of Selenium have decided that passing HTTP status codes back through the API is and always will be outside the scope of their project. So if you request a page and it returns 404 you have no way to find out (other than using crude heuristics). This makes Selenium completely unusable for anything I would have use…
See: http://voorloopnul.com/blog/a-python-proxy-in-less-than-100-...
Re: Python Headless Web Browser Scraping on Amazon Linux
#7PhantomJS is brilliant, but Selenium is a questionable choice for this task. For some reason, the creators of Selenium have decided that passing HTTP status codes back through the API is and always will be outside the scope of their project. So if you request a page and it returns 404 you have no way to find out (other than using crude heuristics). This makes Selenium completely unusable for anything I would have use…
You could always write a simple proxy in python and simply route all of your traffic through that. See: http://voorloopnul.com/blog/a-python-proxy-in-less-than-100-...
Re: Python Headless Web Browser Scraping on Amazon Linux
#8PhantomJS is brilliant, but Selenium is a questionable choice for this task. For some reason, the creators of Selenium have decided that passing HTTP status codes back through the API is and always will be outside the scope of their project. So if you request a page and it returns 404 you have no way to find out (other than using crude heuristics). This makes Selenium completely unusable for anything I would have use…
You could always write a simple proxy in python and simply route all of your traffic through that. See: http://voorloopnul.com/blog/a-python-proxy-in-less-than-100-...
Re: Python Headless Web Browser Scraping on Amazon Linux
#9PhantomJS is brilliant, but Selenium is a questionable choice for this task. For some reason, the creators of Selenium have decided that passing HTTP status codes back through the API is and always will be outside the scope of their project. So if you request a page and it returns 404 you have no way to find out (other than using crude heuristics). This makes Selenium completely unusable for anything I would have use…
There are tools, such as BrowserMob Proxy, far better suited for monitoring HTTP traffic. And they'll get you all the headers. You can even capture to HAR so you measure performance.
Re: Python Headless Web Browser Scraping on Amazon Linux
#10PhantomJS is brilliant, but Selenium is a questionable choice for this task. For some reason, the creators of Selenium have decided that passing HTTP status codes back through the API is and always will be outside the scope of their project. So if you request a page and it returns 404 you have no way to find out (other than using crude heuristics). This makes Selenium completely unusable for anything I would have use…
Well, I think the matter is a bit more complicated than that. When dealing with a full browser, you fetch a lot of resources. The status code for the first page fetch may be easily obtained, but your API gets very wonky as soon as you want to get status codes for all linked resources. Even if you managed that, any Ajax requests would complicate things, especially if they have deferred loading. And then you have WebSo…
Also, phantomjs has access to all the information you want and the WebDriver API already has a capabilities negotiation facility.
[Edit] Don't forget that the original URL is the only one supplied by the client of the API. It may be incorrect for very different reasons than all the other resources included by the page itself. That's why it is justified to treat it as a special case.