Questions Stack Exchange
Analysez une page de questions, de tag ou de résultats de recherche Stack Exchange en JSON structuré avec le titre de chaque question, le score, le nombre de réponses et de vues, les tags, l'extrait, l'auteur et la pagination. C'est l'un des deux scrapers Stack Exchange de la page Stack Exchange Scraper API, où vous trouverez aussi les tarifs et pourrez démarrer gratuitement.
Utilisation de l'API
Ajoutez &scraper=stackexchange-serp à une requête Crawling API. Encodez en URL l'URL cible dans le paramètre url.
curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
--data-urlencode 'url=https://stackoverflow.com/questions/tagged/web-scraping' \
--data-urlencode 'scraper=stackexchange-serp' -Gfrom crawlbase import CrawlingAPI
api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
'https://stackoverflow.com/questions/tagged/web-scraping',
{'scraper': 'stackexchange-serp'}
)
import json
data = json.loads(res['body'])const { CrawlingAPI } = require('crawlbase');
const api = new CrawlingAPI({ token: 'YOUR_TOKEN' });
const res = await api.get(
'https://stackoverflow.com/questions/tagged/web-scraping',
{ scraper: 'stackexchange-serp' }
);
const data = JSON.parse(res.body);require 'crawlbase'
api = Crawlbase::API.new(token: 'YOUR_TOKEN')
res = api.get('https://stackoverflow.com/questions/tagged/web-scraping', scraper: 'stackexchange-serp')
data = JSON.parse(res.body)Exemple d'URL en entrée
N'importe quelle liste Stack Exchange fonctionne dans le paramètre url : une page de tag, de recherche ou de questions sur n'importe quel site du réseau. Par exemple :
https://stackoverflow.com/questions/tagged/web-scraping
https://superuser.com/search?q=ssh+tunnel
https://askubuntu.com/questions?tab=Votes
https://unix.stackexchange.com/questions/tagged/bash
https://mathoverflow.net/questionsStructure de la réponse
Corps de la réponse JSON. Les types de champs peuvent être null lorsque la page source omet la valeur.
stackoverflow).newest, votes, active).results.Exemple de réponse
{
"site": "stackoverflow.com",
"query": "web scraping infinite scroll pagination",
"tag": null,
"sort": "Relevance",
"currentPage": 1,
"totalQuestions": null,
"results": [
{
"position": 1,
"id": "78912345",
"title": "How to handle pagination when scraping an infinite scroll page?",
"questionUrl": "https://stackoverflow.com/questions/78912345/how-to-handle-pagination-when-scraping-an-infinite-scroll-page",
"score": 4,
"answerCount": 2,
"viewCount": 137,
"hasAcceptedAnswer": true,
"excerpt": "I'm trying to scrape a product listing that loads more items as you scroll. The network tab shows a POST request returning JSON, but the cursor token keeps changing...",
"tags": ["python", "web-scraping", "pagination", "requests"],
"author": "dev_ana",
"authorUrl": "https://stackoverflow.com/users/1234567/dev-ana",
"askedAt": "2026-07-15T09:42:11Z"
},
{
"position": 2,
"id": "78911002",
"title": "Rotating proxies with residential IPs to avoid rate limiting",
"questionUrl": "https://stackoverflow.com/questions/78911002/rotating-proxies-with-residential-ips-to-avoid-rate-limiting",
"score": 1,
"answerCount": 0,
"viewCount": 42,
"hasAcceptedAnswer": false,
"excerpt": "My crawler gets blocked after roughly 500 requests from a datacenter IP. I want to rotate through a residential proxy pool but I'm unsure how to detect a soft ban...",
"tags": ["web-scraping", "proxy", "http"],
"author": "crawler_joe",
"authorUrl": "https://stackoverflow.com/users/9988776/crawler-joe",
"askedAt": "2026-07-15T08:05:47Z"
}
],
"resultCount": 2,
"pagination": {
"currentPage": 1,
"nextPageUrl": "https://stackoverflow.com/search?q=web+scraping+infinite+scroll+pagination&tab=Relevance&page=2",
"hasNext": true
}
}