PINGDOM_CHECK

#ExtractSummit2026 The world's largest web scraping conference returns. Austin Oct 7–8 · Dublin Nov 10–11.

Register now
Data Services
Pricing
Login
Try Zyte APIContact Sales
  • Unblocking and Extraction

    Zyte API

    The ultimate API for web scraping. Avoid website bans and access a headless browser or AI Parsing

    Ban Handling

    Headless Browser

    AI Extraction

    SERP

    Enterprise

    DocumentationSupport

    Hosting and Deployment

    Scrapy Cloud

    Run, monitor, and control your Scrapy spiders however you want to.

    Coding Agent Add-Ons

    Agentic Web Data

    Plugins that give coding agents the context to build production Scrapy projects. Starts with Claude Code.

  • Data Services
  • Pricing
  • Browse

    • BlogArticles, podcasts, videos
    • Case studiesCustomer outcomes
    • White papersIn-depth reports
    • EventsConferences, webinars, recordings

    Subscribe

    • NewsletterSwiftly delivered
    • Discord communityExtract Data community
  • Product and E-commerce

    From e-commerce and online marketplaces

    Data for AI

    Collect and structure web data to feed AI

    Job Posting

    From job boards and recruitment websites

    Real Estate

    From Listings portals and specialist websites

    News and Article

    From online publishers and news websites

    Search

    Search engine results page data (SERP)

    Social Media

    From social media platforms online

  • Meet Zyte

    Our story, people and values

    Contact us

    Get in touch

    Support

    Knowledge base and raise support tickets

    Terms and Policies

    Accept our terms and policies

    Open Source

    Our open source projects and contributions

    Web Data Compliance

    Guidelines and resources for compliant web data collection

    Join the team building the future of web data
    We're Hiring
    Trust Center
    Security, compliance & certifications
Login
Try Zyte APIContact Sales

Zyte Developers

Coding tools & hacks straight to your inbox

Become part of the community and receive a bi-weekly dosage of all things code.

Join us
    • Zyte Data
    • News & Articles
    • Search
    • Social Media
    • Product
    • Data for AI
    • Job Posting
    • Real Estate
    • Zyte API - Ban Handling
    • Zyte API - Headless Browser
    • Zyte API - AI Extraction
    • Web Scraping Copilot
    • Zyte API Enterprise
    • Scrapy Cloud
    • Solution Overview
    • Blog
    • Webinars
    • Case Studies
    • White Papers
    • Documentation
    • Web Scraping Maturity Self-Assesment
    • Web Data compliance
    • Meet Zyte
    • Jobs
    • Terms and Policies
    • Trust Center
    • Support
    • Contact us
    • Pricing
    • Do not sell
    • Cookie settings
    • Sign up
    • Talk to us
    • Cost estimator
All articles
AI-assisted data extraction28, 28 articles
Data gathering for AI6, 6 articles
Large Language Models (LLMs)24, 24 articles
Tool-assisted coding3, 3 articles
Developer interest143, 143 articles
Integration13, 13 articles
Open-source96, 96 articles
Scraping practice59, 59 articles
Scraping strategy46, 46 articles
Anti-ban35, 35 articles
Traffic6, 6 articles
Web data application25, 25 articles
Web data collection358, 358 articles
Web data collection ethics3, 3 articles
Web data collection legality16, 16 articles
Web scraping APIs63, 63 articles
Zyte API59, 59 articles
Scrapy48, 48 articles
Scrapy Cloud10, 10 articles
Web Scraping Copilot12, 12 articles
AI & Machine Learning1, 1 articles
Automotive2, 2 articles
E-commerce & retail26, 26 articles
Entertainment & Streaming2, 2 articles
Financial Services8, 8 articles
Government2, 2 articles
Market Research & Intelligence3, 3 articles
Media & publishing8, 8 articles
Real Estate2, 2 articles
Recruitment & HR3, 3 articles
Transportation & Logistics2, 2 articles
Travel & hospitality2, 2 articles
Extract Summit25, 25 articles
PyCon1, 1 articles

Appearance

Discord Community
BlogWeb ScrapingZyte API Sessions - flexible cookie management maintaining control
VideoWeb Scraping

Zyte API Sessions - flexible cookie management maintaining control

February 6, 2026
J

John Rooney

February 6, 2026

Full transcript

In my last video, I talked about how to use a hybrid scraping method where you load a browser up and then take the cookies and the headers and the information and then you can transfer that across to an HTTP client session. And in this video, I want to expand on that and show you how we do it within Zite API and how it's much much easier to manage and handle. So this was the demo site and if I go to inspect and just open this up and if we look at the application we can see that we have this or token cookie. Obviously this is my demo site. Real sites will look slightly different but if I delete this and refresh the page we get this browser check. What this means is that if we aren't able to pass the JavaScript test that runs on this browser when you initially load up the site that generates this token, you're going to get rejected and you're going to be blocked or whatever is going to happen. So what we want to do is load this up. Now within site API, we have the browser feature here which will you know use a browser through our system which will render the HTML and work for you. Now, you could of course use this to scrape every page, but this is, you know, slower, it's heavier, it's uh it's more costly because we're running more on the infrastructure. But, as I talked about at the beginning of the video, we can actually use one browser request and then utilize that session to then make multiple requests. And what's different about this site is that we don't just want to make multiple requests with the HTTP to the page because if I go view page source, you'll see that this page is loaded dynamically. So we need to go one step further and we need to actually utilize the network page that is being the network request sorry that is being uh run here and will actually then return the JSON data. Very standard way of scraping websites like this. So what do we need to do then? Well, we can have a look at the features. And if we look at uh sessions, which is here, we have two options, client managed and server managed. I'm going to be going through client managed in this one because I want full control. So if we scroll down to the example and I look under the examples, this is the one that I want here. Reuse browser cookie session in reuse browser cookies and HTTP requests. It's exactly what we want to do. From here we can see that we are making two requests with a session ID which is a UYU ID for nice and straightforward in Python. So what I did is I copied this out and I recreated it here and I just need to edit this one. There we go. So I recreated it here. Now let's make this a bit bigger. So I'm pulling in my Zite API key from my environment here. And then we're going to go ahead and create our browser request just like we did manually except you this time we don't have to worry about running the browser or managing it or anything like that with the session ID. And with this session ID we can then reuse it. Now what I've got down here is the actual API response page that I needed to get to to actually get this information back. We saw here this was the URL that gives me this information which in this case is the product information. Now what happens is we send in our session ID which we created which we've utilized and this is going to reuse it. So if I go ahead and run this and I've got that commented out for a reason. I just want to show you this this response. So Zite API is running the browser for us. It's then taking the cookies and the session from that transferring it over to the HTTP requests and then going to run that one. So, the first one is always going to take longer, but once you actually have that loaded up and have that session, you'll be able to use it multiple times. Now, I'm getting a key error here, and that's because we have um this here. So, what I want to do is I'm going to show you that in the cases where you're trying to hit an API endpoint with this, you might come across this error. So, I'm just going to do print uh HTTP response.json, and we'll run it again. What we're going to see is that we have an issue with some of the headers. Now, in this web on this website, obviously I made it. I know which headers you need to include to actually get that request. But our API is going to respond and say, you know, website ban. You think, oh well, it didn't work. But actually, what's going on here is it's saying, if you are targeting an API endpoint, please see this documentation. And that's exactly what we are doing. So I'm going to come over here and we'll load this in the page and it talks about down here when targeting API pens set the right request headers and cookies. So to me straight away I know that my headers are probably not correct. And if you've done your due diligence and you've looked through this website or whatever website it is that you're trying to work and you've tested it with different curl commands or maybe an API um testing program, you'll know that there is a header here that we need to include to actually make this work. So I'm going to go over here and I'm going to put that header back in. And we put it under custom HTTP headers. And we can uncomment this and comment this out. Now, so we needed this referral. Now, our API documentation will talk about referers and say, you know, probably don't set them, but generally that's probably the case. I just made this test site that required these extra headers and I just picked that one. So, you just have to understand what you're working with. So, let's run this now. and we're going to send our request through the uh Zite browser. It's going to take the the the cookies and all the everything else. It's going to send it through the HTTP request and we're actually going to get this back. Now, there is another way that you can get this information because this is actually a network request. You can do this through the ZI API browser. There is the uh where is it? Network capture. But what this is for is this is going to capture all the network requests when you load that page up. it's not going to allow us to utilize those cookies to push them into HTTP requests. So, we actually wanted a different feature. It's just worth mentioning because you can get a bit confused if you look at this. You might think it's what you're after. So, from here, we would just want to tidy this up to actually, you know, loop through all the pages. Maybe we would put uh this into a function where we create our session and then we can like, you know, go through and send the different URL with the different pages as we go through. But essentially what we've done here is we have taken our principle our idea of utilizing a browser to load up the main page generate or pass the JavaScript test generate the the tokens or the cookies or the whatever we need and we're storing that into a session on API which we can then reuse and actually make requests to the sites API to get that data. uh and we can do it much quicker, much easier, and much more cost-effective than we than and much more reliably than if we were to try and do it ourselves. Generally, trying to manage browsers is a bit of a pain. And keeping updated and making sure that that browser that you're using is sufficient enough to actually beat that [clears throat] challenge is always going to be difficult to stay on top of. And this is a nice neat cost-effective solution.

Follow

Get the latest

Zyte and the data web in your inbox — or wherever you already are.

Subscribe

Or follow elsewhere

The Community · Newsletter

The best of Zyte and the data web, in your inbox.

One curated edition — new articles, product updates, and the stories shaping the data web. No noise.

More videos

Screenshot webpages with this Claude Skill and Zyte API▶
Video

Screenshot webpages with this Claude Skill and Zyte API

0% Hallucination? RAG + Web Scraping (Step-by-Step)▶
Video

0% Hallucination? RAG + Web Scraping (Step-by-Step)

Generate HTML Parsing code the right way with Scrapy & Web Scraping Copilot▶
Video

Generate HTML Parsing code the right way with Scrapy & Web Scraping Copilot

G2.com

Capterra.com

Proxyway.com

EWDCI logoMost loved workplace certificateZyte rewardISO 27001 iconG2 rewardG2 rewardG2 reward

© Zyte Group Limited 2026