avatar

Iveta Vistorskyte

Jun 26, 2020 5 min read

Just recently, Oxylabs hosted the first webinar about residential proxies usage mistakes and how to solve them. We shared our knowledge on how to start web scraping. In this article, we will specify our tips on setting the right approach to web scraping and what are the key elements for the best web scraping practice. 

If you are interested in watching the whole webinar, click here and watch it for free! In the webinar, you will learn how to choose between residential and datacenter proxies. Also, get tips on how to decide which proxy service provider works best for you.

Successful web scraping

Just as with most data gathering tasks, getting started is the hardest part. To make it easier, follow these steps: set a preferred session, see if it works with a test query, and then start scraping your target website. Testing is an essential part because you can check if your web scraping will be successful, and make sure you will get the best results.

Sessions and their importance

Sessions are an essential part of the residential proxy network. They enable you to use the same IP address for multiple requests. By default, every new request that goes through the residential network is carried out by a new proxy and this can cause issues. For example, if you are using a full browser, bot, or a headless browser to download assets from your target websites, all of them must be downloaded using the same IP address. In this case, assets mean everything that comes with the HTML – CSS, JavaScript files, images, and so on.

Reliable proxy providers will offer you flexible and adjustable session control features, so you can be sure that this part will be managed easily.

HTTP headers for web scraping

HTTP abbreviation stands for HyperText Transfer Protocol, which manages how communication is transferred and structured on the internet. Also, HTTP is responsible for how web servers and browsers should respond to different requests. There are different types of HTTP headers: request header, response header, general HTTP header, entity header, and so on. If you want to get more information, check out our other blog post, where we covered this topic in detail.

When web scraping, sending the HTTP headers, and preferably in the right order is the minimum these days. All the requests without specific HTTP headers are likely to be blocked very quickly. For successful web scraping, you should think of every possible way to avoid blocks. Optimizing HTTP headers reduces the chances of being blocked by data sources.

To start optimizing HTTP headers, we advise you to see how the browser works by itself. In Firefox or Chrome, hit the F12 button and open developer tools. Go to the Network tab and refresh a page you are on. You will see all requests that the browser had to make in order to fully render the page. Find where the HTML content was loaded, and you will see what headers and in which order were sent. Try to make this happen on your scraper too.

“Fingerprinting” and its relevance

“Fingerprinting” is all the information that your browser gives websites about you and your computer, such as mouse input, resolution, installed plugins, and much more. Having all this information, you can make a single hash, a fingerprint. It makes it easier to identify if requests come from a browser or not. Fingerprinting is becoming the primary weapon to identify web scraping bots and increases the chances of being blocked.

Some websites already have anti-scraping solutions that check “fingerprints”, but it is not very common yet. The major problems are that it still brings a lot of false positives, which might have converted to sales. More importantly, it requires tremendous hardware resources to process all the data. Overall, chances to run into such issues are quite slim, but if you do, the best way is to use a headless browser, preferably with stealth addons.

What are headless browsers?

As the last resort we recommend trying headless browsers. A headless browser is a type of software that can access web pages but does not show them to the user. They can direct the content of the target servers to another program. Some of them even have extensions and plugins to hide that they are not real browsers, but usually they work pretty well out of the box. This is your best shot with seriously difficult targets.

More practical tips on web scraping

1. Visit the home page before accessing the inner content. Regular users rarely have full links to products or articles, first they land on the home page, and then browse further.

2. Data that is under authentication or protected with the password could be considered as private, and scraping such data in some cases can be illegal. Before starting web scraping of any kind, we suggest you consult your legal advisors and carefully read the particular website’s terms of service, or even receive a scraping license if possible.

3. Choose the right proxy type for your web scraping tasks. Two of the main proxy types are residential and datacenter proxies. Usually, they are used for different targets. You can find more information on this topic by watching the whole webinar.

Conclusions

Figuring out how to start web scraping can be a complicated task. To make it easier, follow this workflow: set a preferred session, see if it works with a test query, and then start scraping your target public data source. Do not forget to discuss with your legal advisors that you would not encounter any legal issues when web scraping.

The most difficult part is to avoid being blocked by targeted servers. Sessions, HTTP headers, headless browsers, and “fingerprinting” are the essential things you should note to make your web scraping session successful.

If you are interested in web scraping, Oxylabs has a self-service check out for smaller residential proxy plans! Register here and decide what is best for you. Furthermore, if you have more questions, book a call with our sales team! They are ready to answer all your questions.

avatar

About Iveta Vistorskyte

Iveta Vistorskyte is a Copywriter at Oxylabs. Growing up as a writer and a challenge seeker, she decided to welcome herself to the tech-side, and instantly became interested in this field. When she is not at work, you'll probably find her just chillin' while listening to her favorite music or playing board games with friends.

Related articles

Choosing the Right Proxy Service Provider

Choosing the Right Proxy Service Provider

Jun 22, 2020

4 min read

Choosing Between Residential and Datacenter Proxies

Choosing Between Residential and Datacenter Proxies

Jun 19, 2020

3 min read

All information on Oxylabs Blog is provided on an "as is" basis and for informational purposes only. We make no representation and disclaim all liability with respect to your use of any information contained on Oxylabs Blog or any third-party websites that may be linked therein. Before engaging in scraping activities of any kind you should consult your legal advisors and carefully read the particular website's terms of service or receive a scraping license.