Seamlessly Transition from Zenrows to Zyte API
Web scraping is essential for many businesses to effectively gather data from the web. As technologies evolve, so do the tools and APIs we use. If you're currently using Zenrows, we understand the importance of a smooth transition to a new platform. That's why we are here to help you migrate seamlessly to Zyte API, ensuring that you can continue your web scraping activities without any interruptions.
Why Migrate to Zyte API?
Zyte API offers advanced features and improved performance, making your web scraping tasks more efficient and reliable. Here are some key benefits of switching to Zyte API:
Enhanced Performance: faster and more reliable data extraction
Scalability: easily handle increased loads and scale your scraping activities
Advanced Features: access a wider range of scraping capabilities and customization options
Robust Support: benefit from our dedicated support team and comprehensive documentation
Getting Started
Sign up to Zyte API [5 minutes]:
Sign up for a free Zyte API trial at https://app.zyte.com - no credit card required. Grab your API key.
A Simple Zyte API Spider [5 minutes]
Installing the Zyte API Client is the easiest way to use Zyte API.
ZenRows library uses ZenRowsClient to return the text response. Zyte API returns a base64 encoded response for httpResponseBody, which needs to be decoded using b64decode.
Rendering
There are only two differences in the way you will be sending requests to Zyte API for rendered content.
Zenrows requires that you send "js_render": "true" parameter while sending your request using ZenRowsClient. The parameter name that is used for rendering using Zyte API is "browserHtml": True
ZenRowsClient directly provides the response text, whereas ZyteAPI provides the response text in JSON format that needs to be parsed with a built-in python method.
API Parameters
Non-JS raw request
httpResponseBody
Renders the JavaScript on the page and/or browser actions
js_render
browserHtml
Setting custom HTTP request headers.
custom_headers
customHttpRequestHeaders
Geolocation of the IP used to make the request. Only for Premium Proxies.
proxy_country
geolocation
Creating client managed session
session_id
sessions
To use either desktop or mobile profile.
device
device
Set to true to get a page screenshot in the screenshot response field.
screenshot
screenshot
To capture full-page screenshot and file type selection (Jpeg/png)
screenshot_fullpage
screenshotOptions
To change the type of IP address from which the request should be sent.
premium_proxy
ipType (KYC approval may be needed to use this)
To capture browser network JSON responses (XHR/FETCH).
json_response
networkCapture
Wait for the specific element (CSS/XPATH) to appear.
wait_for
waitForSelector
Pause script execution for the given number of seconds before continuing.
wait
waitForTimeout
IDE for browser automation and help selecting actions
Zyte IDE
For more information on available parameters and action types you can refer to https://docs.zyte.com/zyte-api/usage/reference.html
Concurrent Requests
Concurrency is set differently in Zyte API compared to ZenRows. Concurrency is controlled by “concurrency” in ZenRowsClient. In Zyte API, you can configure the concurrency setting in the AsyncZyteAPI call such as n_conn = 10.
Extraction
Extracting the data or items you need is the next step after you get the HTML response. You have three options to do the extraction - hands off no-code AI Scraping, or ask Zyte API to do extraction for you which is equivalent to auto-parse in ZenRows, or you can do it yourself using Scrapy.
AI Scraping
You can use a single end-to-end AI Scraping that uses Zyte API and Zyte API extraction without needing to write any code. This works great for any product data that you might be interested in. Please refer to https://docs.zyte.com/web-scraping/guides/no-code/index.html to learn about how to do this on Zyte Dashboard.
Zyte API Extraction
You just have to enable Zyte API Automatic extraction fields and tell us what type of structured data you want through a parameter, and voila! You can refer to this page for information about the automatic extraction fields - https://docs.zyte.com/zyte-api/usage/extract.html
Extraction with Scrapy
Alternatively, you can use Zyte’s open source software Scrapy that gives you selector level flexibility for custom extraction. To use Zyte API with Scrapy, you just have to use our plugin zyte-api-convertor and it will create the Scrapy project for you.
This creates the spider code template with Zyte API integration. All you need to do is to add your API key.
Here are some sample usage commands to create the Scrapy project.
Scenario 1:
Scenario 2:
Scenario 3:
Scenario 4:
Once the Scrapy project is created, please refer to https://docs.scrapy.org/en/latest/topics/developer-tools.html to understand how to do custom extraction.
Continued Support and Resources
At Zyte, we are committed to making your migration process as smooth as possible. Our support team is available to assist you with any questions or issues you may encounter during the transition. Additionally, our comprehensive help center and community forums are excellent resources for troubleshooting and getting tips from other users.
Conclusion
Transitioning from Zenrows to Zyte API is easy. By following the steps outlined above, you can migrate your web scraping activities smoothly and take advantage of the powerful features Zyte has to offer. We are here to support you every step of the way, ensuring that your data extraction processes remain efficient and uninterrupted.
Ready to make the switch? Get started with Zyte API today and experience the future of web scraping!