---
title: "Saad | Data APIs (@saadhazz) | Hashnode"
description: "Building data APIs on Apify. Read the latest articles by Saad | Data APIs on Hashnode."
url: "https://hashnode.com/@saadhazz"
---

@saadhazz

# Saad | Data APIs

@saadhazz · Saudi Arabia · Joined October 2026

Building data APIs on Apify

[Website](https://apify.com/saadhazz)

## Comments

[Thanks, all four are fair and I've folded them into the script. It now sniffs the first two bytes (\\x1f\\x8b) instead of trusting the suffix or Content-Type, so sitemap.xml.gz?ts=123 served with a generic type works. It takes only the <loc> that is a direct child of each <url>/<sitemap>, so <image:loc> from the image extension no longer leaks in. robots.txt lines are stripped and cut at # before matching Sitemap:. And fetch caps both the download and the decompressed size at 50 MB, the protocol's per-file limit, so a small .gz can't balloon in memory. I've updated the snippet in the post.](https://hashnode.com/posts/extract-every-url-from-a-sitemap-xml-in-python-sitemap-index-gz-robots-txt/6ad0bbad528de36d0eba40ab/comment/6ad23d112eaea1c09727e771#reply-6ad7513f472e599946f9cba8)

Reply · Article · Oct 20 · [Extract every URL from a sitemap.xml in Python (sitemap index, .gz, robots.txt)](https://hashnode.com/posts/extract-every-url-from-a-sitemap-xml-in-python-sitemap-index-gz-robots-txt/6ad0bbad528de36d0eba40ab)
