How to scrape BBC News
BBC News is a news and finance site offering public news articles and sports coverage. Developers typically collect article metadata, publication details, and publisher information from its pages.
65 of 65 of our checks passed in the last 7 days (100%).
Last check 2026-11-02 20:33 UTC · last pass 2026-11-02 20:33 UTC · checked with our own requests, never customer data.
Run the code on this page with your own key: 5,000 free credits for 7 days, no card. Get a free API key →
Extraction recipe
Detail pages contain ReportageNewsArticle structured data with url, publisher name and logo, publishing principles, publication and modification dates, description, headline, and images. Public pages include WebPage data with page description, url, publisher details, and page name. The recipe below is a set of Scrape API extract rules: we ran it through our API on two real BBC News pages with the settings on this page and kept only the fields that came back on both. It is checked again every week, and hidden if it stops working.
bbc.com news and articles: Search and listing pages
Validated 2026-10-28| Field | Type | Example |
|---|---|---|
articles | list of 3+ items | |
articles[].url | URL | https://www.bbc.com/news/articles/ckreyqvqe3gyo |
articles[].title | text | Councillor sanctioned over offensive Facebook posts |
articles[].image | image URL | https://ichef.bbci.co.uk/news/480/cpsprodpb/749e/live/4b2e5830-c6fd... |
articles[].summary | text | Sub-committee members recommend that Carl Miller be removed from al... |
articles[].published | text | 36 mins ago |
Examples from www.bbc.com/news/technology on 2026-10-28, shortened.
Sample output (real, trimmed)
{
"articles": [
{
"url": "https://www.bbc.com/news/articles/c6x2qggrdxqeo",
"title": "Celebrity Traitors' Joe Lycett's tribute to viral TikTok nan",
"image": "https://ichef.bbci.co.uk/news/480/cpsprodpb/ff04/live/cfcbb040-d208-11f1-b3b6-c1e79e957e40.png.webp",
"summary": "Anne Hughes found fame after being hoisted into the air after getting caught in shop shutters.",
"published": "3 hrs ago"
},
{
"url": "https://www.bbc.com/news/articles/cmy56qy0ddexo",
"title": "Jo Malone donates £100k for cancer-detecting 'nose'",
"image": "https://ichef.bbci.co.uk/news/480/cpsprodpb/ad75/live/3c5e1260-d20a-11f1-b441-2b33b063138f.jpg.webp",
"summary": "Scientists say the device could help the NHS identify cancer in patients earlier.",
"published": "3 hrs ago"
},
{
"url": "https://www.bbc.com/news/articles/cknv06prz91mo",
"title": "Study to investigate harmful adult-child messaging",
"image": "https://ichef.bbci.co.uk/news/480/cpsprodpb/20d0/live/38aebfd0-d227-11f1-b441-2b33b063138f.jpg.webp",
"summary": "About 1,500 youngsters aged 12-18 years old will take part in the university-led survey.",
"published": "7 hrs ago"
}
]
}
extract_rules (1 rule)
{
"articles": {
"selector": "div[data-testid=\"alaska\"] > div",
"type": "obj",
"multiple": true,
"children": {
"url": {
"selector": "a[data-testid=\"internal-link\"]",
"type": "link"
},
"title": {
"selector": "h2",
"type": "text"
},
"image": {
"selector": "img.Image-styles__ImageStyled-sc-8c99a12b-0:not(.hide-when-no-script)",
"type": "image"
},
"summary": {
"selector": "p[data-testid='card-description']",
"type": "text"
},
"published": {
"selector": "span[data-testid='card-metadata-lastupdated']",
"type": "text"
}
}
}
}
bbc.com news and articles: Articles
Validated 2026-10-28| Field | Type | Example |
|---|---|---|
title | text | Blue plaque honour for poet's childhood home |
description | text | Tony Harrison, who died last year aged 88, grew up in Leeds and is... |
image | image URL | https://ichef.bbci.co.uk/news/1024/branded_news/ac34/live/226f37f0-... |
url | URL | https://www.bbc.com/news/articles/cmr4y2yl17x7o |
published | date | 2026-10-12T19:06:02.949Z |
summary | text | The man who wrote Prime Minister Andy Burnham's favourite poem has... |
section | text | Leeds |
Examples from www.bbc.com/news/articles/cmr4y2yl17x7o on 2026-10-28, shortened.
Sample output (real, trimmed)
{
"title": "Blue plaque honour for poet's childhood home",
"description": "Tony Harrison, who died last year aged 88, grew up in Leeds and is best known for his poem V.",
"image": "https://ichef.bbci.co.uk/news/1024/branded_news/ac34/live/226f37f0-c655-11f1-8600-efb62b613ab5.jpg",
"url": "https://www.bbc.com/news/articles/cmr4y2yl17x7o",
"published": "2026-10-12T19:06:02.949Z",
"summary": "The man who wrote Prime Minister Andy Burnham's favourite poem has been honoured with a blue plaque in his home city.",
"section": "Leeds"
}
extract_rules (7 rules)
{
"title": {
"selector": "h1",
"type": "text"
},
"description": {
"selector": "meta[property=\"og:description\"]",
"type": "attr",
"attribute": "content"
},
"image": {
"selector": "meta[property=\"og:image\"]",
"type": "attr",
"attribute": "content"
},
"url": {
"selector": "link[rel=\"canonical\"]",
"type": "attr",
"attribute": "href"
},
"published": {
"selector": "time[datetime]",
"type": "attr",
"attribute": "datetime"
},
"summary": {
"selector": "article p:first-of-type",
"type": "text"
},
"section": {
"selector": "a[data-testid='internal-link'][href*='/news/topics/']",
"type": "text"
}
}
Code
Complete scripts: set the UJEEBU_API_KEY environment variable and run them as they are. Each one sends the settings on this page and the extraction recipe, prints the extracted JSON, and prints the credits the request cost (the Ujb-Credits response header) on stderr. A non-200 answer stops the script with the API's error message.
bbc.com news and articles: Search and listing pages
Runs the recipe on the two pages it was validated on, one after the other.
pip install ujeebu-python==0.1.5 # Scrape BBC News bbc.com news and articles: search and listing pages with the Ujeebu Scrape API.
# Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
# Uses the official SDK ujeebu-python 0.1.5: pip install ujeebu-python==0.1.5
# Run: UJEEBU_API_KEY=your_key python3 bbc_listing_sdk.py
import json
import os
import sys
import time
import requests
from ujeebu_python import UjeebuClient
API_KEY = os.environ.get("UJEEBU_API_KEY")
URLS = [
"https://www.bbc.com/news/technology",
"https://www.bbc.com/business",
]
SETTINGS = {
"js": True,
}
EXTRACT_RULES = {
"articles": {
"selector": "div[data-testid=\"alaska\"] > div",
"type": "obj",
"multiple": True,
"children": {
"url": {
"selector": "a[data-testid=\"internal-link\"]",
"type": "link",
},
"title": {
"selector": "h2",
"type": "text",
},
"image": {
"selector": "img.Image-styles__ImageStyled-sc-8c99a12b-0:not(.hide-when-no-script)",
"type": "image",
},
"summary": {
"selector": "p[data-testid='card-description']",
"type": "text",
},
"published": {
"selector": "span[data-testid='card-metadata-lastupdated']",
"type": "text",
},
},
},
}
def scrape(client, url):
# with extract_rules, client.scrape sends a JSON POST and the API answers {"result": {...}}
try:
response = client.scrape(url, params={**SETTINGS, "extract_rules": EXTRACT_RULES})
except requests.RequestException as error:
sys.exit(f"Request failed for {url}: {error}")
if response.status_code != 200:
try:
message = response.json().get("message", response.text)
except ValueError:
message = response.text
sys.exit(f"HTTP {response.status_code} for {url}: {str(message)[:300]}")
print(f"Ujb-Credits: {response.headers.get('Ujb-Credits')}", file=sys.stderr)
return response.json()["result"]
if not API_KEY:
sys.exit("Set the UJEEBU_API_KEY environment variable.")
client = UjeebuClient(api_key=API_KEY)
for i, url in enumerate(URLS):
if i:
time.sleep(2) # be polite: one page at a time
print(json.dumps(scrape(client, url), indent=2, ensure_ascii=False))
npm install @ujeebu-org/ujeebu-sdk@0.1.2 // Scrape BBC News bbc.com news and articles: search and listing pages with the Ujeebu Scrape API.
// Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
// Uses the official SDK @ujeebu-org/ujeebu-sdk 0.1.2: npm install @ujeebu-org/ujeebu-sdk@0.1.2
// Run: UJEEBU_API_KEY=your_key node bbc_listing_sdk.mjs
import { UjeebuClient } from '@ujeebu-org/ujeebu-sdk';
const API_KEY = process.env.UJEEBU_API_KEY;
const URLS = [
"https://www.bbc.com/news/technology",
"https://www.bbc.com/business",
];
const SETTINGS = {
js: true,
};
const EXTRACT_RULES = {
articles: {
selector: "div[data-testid=\"alaska\"] > div",
type: "obj",
multiple: true,
children: {
url: {
selector: "a[data-testid=\"internal-link\"]",
type: "link",
},
title: {
selector: "h2",
type: "text",
},
image: {
selector: "img.Image-styles__ImageStyled-sc-8c99a12b-0:not(.hide-when-no-script)",
type: "image",
},
summary: {
selector: "p[data-testid='card-description']",
type: "text",
},
published: {
selector: "span[data-testid='card-metadata-lastupdated']",
type: "text",
},
},
},
};
async function scrape(client, url) {
let res;
try {
// client.scrape POSTs JSON when extract_rules is set (scrapeWithRules would send it as a GET query, which the API ignores)
res = await client.scrape(url, { ...SETTINGS, extract_rules: EXTRACT_RULES });
} catch (err) {
const status = err.response?.status ?? 'error';
const message = err.response?.data?.message ?? err.message;
console.error(`HTTP ${status} for ${url}: ${String(message).slice(0, 300)}`);
process.exit(1);
}
console.error(`Ujb-Credits: ${res.headers['ujb-credits']}`);
return res.data.result;
}
if (!API_KEY) {
console.error('Set the UJEEBU_API_KEY environment variable.');
process.exit(1);
}
const client = new UjeebuClient(API_KEY);
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
for (const [i, url] of URLS.entries()) {
if (i) await pause(2000); // be polite: one page at a time
console.log(JSON.stringify(await scrape(client, url), null, 2));
}
pip install requests # Scrape BBC News bbc.com news and articles: search and listing pages with the Ujeebu Scrape API.
# Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
# Run: UJEEBU_API_KEY=your_key python3 bbc_listing.py (pip install requests)
import json
import os
import sys
import time
import requests
API_URL = "https://api.ujeebu.com/scrape"
API_KEY = os.environ.get("UJEEBU_API_KEY")
URLS = [
"https://www.bbc.com/news/technology",
"https://www.bbc.com/business",
]
SETTINGS = {
"js": True,
}
EXTRACT_RULES = {
"articles": {
"selector": "div[data-testid=\"alaska\"] > div",
"type": "obj",
"multiple": True,
"children": {
"url": {
"selector": "a[data-testid=\"internal-link\"]",
"type": "link",
},
"title": {
"selector": "h2",
"type": "text",
},
"image": {
"selector": "img.Image-styles__ImageStyled-sc-8c99a12b-0:not(.hide-when-no-script)",
"type": "image",
},
"summary": {
"selector": "p[data-testid='card-description']",
"type": "text",
},
"published": {
"selector": "span[data-testid='card-metadata-lastupdated']",
"type": "text",
},
},
},
}
def scrape(url):
response = requests.post(
API_URL,
headers={"ApiKey": API_KEY},
json={"url": url, **SETTINGS, "extract_rules": EXTRACT_RULES},
timeout=180,
)
if response.status_code != 200:
try:
message = response.json().get("message", response.text)
except ValueError:
message = response.text
sys.exit(f"HTTP {response.status_code} for {url}: {str(message)[:300]}")
print(f"Ujb-Credits: {response.headers.get('Ujb-Credits')}", file=sys.stderr)
return response.json()["result"]
if not API_KEY:
sys.exit("Set the UJEEBU_API_KEY environment variable.")
for i, url in enumerate(URLS):
if i:
time.sleep(2) # be polite: one page at a time
print(json.dumps(scrape(url), indent=2, ensure_ascii=False))
// Scrape BBC News bbc.com news and articles: search and listing pages with the Ujeebu Scrape API.
// Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
// Run: UJEEBU_API_KEY=your_key node bbc_listing.mjs (Node.js 18 or later)
const API_URL = 'https://api.ujeebu.com/scrape';
const API_KEY = process.env.UJEEBU_API_KEY;
const URLS = [
"https://www.bbc.com/news/technology",
"https://www.bbc.com/business",
];
const SETTINGS = {
js: true,
};
const EXTRACT_RULES = {
articles: {
selector: "div[data-testid=\"alaska\"] > div",
type: "obj",
multiple: true,
children: {
url: {
selector: "a[data-testid=\"internal-link\"]",
type: "link",
},
title: {
selector: "h2",
type: "text",
},
image: {
selector: "img.Image-styles__ImageStyled-sc-8c99a12b-0:not(.hide-when-no-script)",
type: "image",
},
summary: {
selector: "p[data-testid='card-description']",
type: "text",
},
published: {
selector: "span[data-testid='card-metadata-lastupdated']",
type: "text",
},
},
},
};
async function scrape(url) {
const res = await fetch(API_URL, {
method: 'POST',
headers: { ApiKey: API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ url, ...SETTINGS, extract_rules: EXTRACT_RULES }),
signal: AbortSignal.timeout(180000),
});
const text = await res.text();
if (res.status !== 200) {
let message = text;
try {
message = JSON.parse(text).message ?? text;
} catch {}
console.error(`HTTP ${res.status} for ${url}: ${String(message).slice(0, 300)}`);
process.exit(1);
}
console.error(`Ujb-Credits: ${res.headers.get('ujb-credits')}`);
return JSON.parse(text).result;
}
if (!API_KEY) {
console.error('Set the UJEEBU_API_KEY environment variable.');
process.exit(1);
}
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
for (const [i, url] of URLS.entries()) {
if (i) await pause(2000); // be polite: one page at a time
console.log(JSON.stringify(await scrape(url), null, 2));
}
#!/usr/bin/env bash
# Scrape BBC News bbc.com news and articles: search and listing pages with the Ujeebu Scrape API.
# Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
# Run: UJEEBU_API_KEY=your_key bash bbc_listing.sh (curl 7.76 or later)
set -euo pipefail
curl -sS --fail-with-body --max-time 180 -D headers.txt \
-X POST 'https://api.ujeebu.com/scrape' \
-H "ApiKey: ${UJEEBU_API_KEY:?Set the UJEEBU_API_KEY environment variable.}" \
-H 'Content-Type: application/json' \
--data-binary @- <<'JSON'
{
"url": "https://www.bbc.com/news/technology",
"js": true,
"extract_rules": {
"articles": {
"selector": "div[data-testid=\"alaska\"] > div",
"type": "obj",
"multiple": true,
"children": {
"url": {
"selector": "a[data-testid=\"internal-link\"]",
"type": "link"
},
"title": {
"selector": "h2",
"type": "text"
},
"image": {
"selector": "img.Image-styles__ImageStyled-sc-8c99a12b-0:not(.hide-when-no-script)",
"type": "image"
},
"summary": {
"selector": "p[data-testid='card-description']",
"type": "text"
},
"published": {
"selector": "span[data-testid='card-metadata-lastupdated']",
"type": "text"
}
}
}
}
}
JSON
echo
grep -i '^ujb-credits' headers.txt >&2
<?php
// Scrape BBC News bbc.com news and articles: search and listing pages with the Ujeebu Scrape API.
// Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
// Run: UJEEBU_API_KEY=your_key php bbc_listing.php (PHP 7.4 or later with curl)
$apiKey = getenv('UJEEBU_API_KEY') ?: exit("Set the UJEEBU_API_KEY environment variable.\n");
$urls = [
'https://www.bbc.com/news/technology',
'https://www.bbc.com/business',
];
$settings = [
'js' => true,
];
$extractRules = [
'articles' => [
'selector' => 'div[data-testid="alaska"] > div',
'type' => 'obj',
'multiple' => true,
'children' => [
'url' => [
'selector' => 'a[data-testid="internal-link"]',
'type' => 'link',
],
'title' => [
'selector' => 'h2',
'type' => 'text',
],
'image' => [
'selector' => 'img.Image-styles__ImageStyled-sc-8c99a12b-0:not(.hide-when-no-script)',
'type' => 'image',
],
'summary' => [
'selector' => 'p[data-testid=\'card-description\']',
'type' => 'text',
],
'published' => [
'selector' => 'span[data-testid=\'card-metadata-lastupdated\']',
'type' => 'text',
],
],
],
];
function scrape(string $url, string $apiKey, array $settings, array $extractRules)
{
$ch = curl_init('https://api.ujeebu.com/scrape');
$headers = [];
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 180,
CURLOPT_HTTPHEADER => ['ApiKey: ' . $apiKey, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['url' => $url] + $settings + ['extract_rules' => $extractRules]),
CURLOPT_HEADERFUNCTION => function ($ch, $line) use (&$headers) {
if (strpos($line, ':') !== false) {
[$k, $v] = explode(':', $line, 2);
$headers[strtolower(trim($k))] = trim($v);
}
return strlen($line);
},
]);
$body = curl_exec($ch);
if ($body === false) {
fwrite(STDERR, 'Request failed: ' . curl_error($ch) . "\n");
exit(1);
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($status !== 200) {
$message = json_decode($body, true)['message'] ?? $body;
fwrite(STDERR, "HTTP $status for $url: " . substr((string) $message, 0, 300) . "\n");
exit(1);
}
fwrite(STDERR, 'Ujb-Credits: ' . ($headers['ujb-credits'] ?? '?') . "\n");
return json_decode($body, true)['result'];
}
foreach ($urls as $i => $url) {
if ($i > 0) {
sleep(2); // be polite: one page at a time
}
echo json_encode(scrape($url, $apiKey, $settings, $extractRules), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), "\n";
}
go mod init scraper && go get github.com/ujeebu/ujeebu-go@v0.1.8 // Scrape BBC News bbc.com news and articles: search and listing pages with the Ujeebu Scrape API.
// Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
// Uses the official SDK github.com/ujeebu/ujeebu-go v0.1.8: go mod init scraper && go get github.com/ujeebu/ujeebu-go@v0.1.8
// Run: UJEEBU_API_KEY=your_key go run bbc_listing.go
package main
import (
"encoding/json"
"errors"
"fmt"
"os"
"time"
ujeebu "github.com/ujeebu/ujeebu-go"
)
var urls = []string{
"https://www.bbc.com/news/technology",
"https://www.bbc.com/business",
}
// The extract rules of the recipe, as the JSON the API takes.
const extractRulesJSON = `{
"articles": {
"selector": "div[data-testid=\"alaska\"] > div",
"type": "obj",
"multiple": true,
"children": {
"url": {
"selector": "a[data-testid=\"internal-link\"]",
"type": "link"
},
"title": {
"selector": "h2",
"type": "text"
},
"image": {
"selector": "img.Image-styles__ImageStyled-sc-8c99a12b-0:not(.hide-when-no-script)",
"type": "image"
},
"summary": {
"selector": "p[data-testid='card-description']",
"type": "text"
},
"published": {
"selector": "span[data-testid='card-metadata-lastupdated']",
"type": "text"
}
}
}
}`
var extractRules map[string]any
func fail(format string, args ...any) {
fmt.Fprintf(os.Stderr, format+"\n", args...)
os.Exit(1)
}
func short(s string) string {
if len(s) > 300 {
return s[:300]
}
return s
}
func params(target string) ujeebu.ScrapeParams {
p := ujeebu.ScrapeParams{URL: target}
p.JS = true
p.ExtractRules = extractRules
return p
}
func scrape(client *ujeebu.Client, target string) map[string]any {
// the int is the credits the request cost (the Ujb-Credits header), not an HTTP status
resp, credits, err := client.Scrape(params(target))
if err != nil {
var apiErr *ujeebu.APIError
if errors.As(err, &apiErr) {
fail("HTTP %d for %s: %s", apiErr.StatusCode, target, short(apiErr.Message))
}
fail("Request failed for %s: %v", target, err)
}
fmt.Fprintf(os.Stderr, "Ujb-Credits: %d\n", credits)
result, _ := resp.Result.(map[string]any)
return result
}
func printJSON(v any) {
enc := json.NewEncoder(os.Stdout)
enc.SetEscapeHTML(false)
enc.SetIndent("", " ")
if err := enc.Encode(v); err != nil {
fail("Cannot print the result: %v", err)
}
}
func main() {
apiKey := os.Getenv("UJEEBU_API_KEY")
if apiKey == "" {
fail("Set the UJEEBU_API_KEY environment variable.")
}
if err := json.Unmarshal([]byte(extractRulesJSON), &extractRules); err != nil {
fail("Bad extract rules: %v", err)
}
client, err := ujeebu.NewClient(apiKey, ujeebu.WithTimeout(180*time.Second))
if err != nil {
fail("%v", err)
}
for i, target := range urls {
if i > 0 {
time.Sleep(2 * time.Second) // be polite: one page at a time
}
printJSON(scrape(client, target))
}
}
bbc.com news and articles: Articles
Runs the recipe on the two pages it was validated on, one after the other.
pip install ujeebu-python==0.1.5 # Scrape BBC News bbc.com news and articles: articles with the Ujeebu Scrape API.
# Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
# Uses the official SDK ujeebu-python 0.1.5: pip install ujeebu-python==0.1.5
# Run: UJEEBU_API_KEY=your_key python3 bbc_detail_sdk.py
import json
import os
import sys
import time
import requests
from ujeebu_python import UjeebuClient
API_KEY = os.environ.get("UJEEBU_API_KEY")
URLS = [
"https://www.bbc.com/news/articles/cmr4y2yl17x7o",
"https://www.bbc.com/news/articles/cq74pkelv9rxo",
]
SETTINGS = {
"js": True,
}
EXTRACT_RULES = {
"title": {
"selector": "h1",
"type": "text",
},
"description": {
"selector": "meta[property=\"og:description\"]",
"type": "attr",
"attribute": "content",
},
"image": {
"selector": "meta[property=\"og:image\"]",
"type": "attr",
"attribute": "content",
},
"url": {
"selector": "link[rel=\"canonical\"]",
"type": "attr",
"attribute": "href",
},
"published": {
"selector": "time[datetime]",
"type": "attr",
"attribute": "datetime",
},
"summary": {
"selector": "article p:first-of-type",
"type": "text",
},
"section": {
"selector": "a[data-testid='internal-link'][href*='/news/topics/']",
"type": "text",
},
}
def scrape(client, url):
# with extract_rules, client.scrape sends a JSON POST and the API answers {"result": {...}}
try:
response = client.scrape(url, params={**SETTINGS, "extract_rules": EXTRACT_RULES})
except requests.RequestException as error:
sys.exit(f"Request failed for {url}: {error}")
if response.status_code != 200:
try:
message = response.json().get("message", response.text)
except ValueError:
message = response.text
sys.exit(f"HTTP {response.status_code} for {url}: {str(message)[:300]}")
print(f"Ujb-Credits: {response.headers.get('Ujb-Credits')}", file=sys.stderr)
return response.json()["result"]
if not API_KEY:
sys.exit("Set the UJEEBU_API_KEY environment variable.")
client = UjeebuClient(api_key=API_KEY)
for i, url in enumerate(URLS):
if i:
time.sleep(2) # be polite: one page at a time
print(json.dumps(scrape(client, url), indent=2, ensure_ascii=False))
npm install @ujeebu-org/ujeebu-sdk@0.1.2 // Scrape BBC News bbc.com news and articles: articles with the Ujeebu Scrape API.
// Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
// Uses the official SDK @ujeebu-org/ujeebu-sdk 0.1.2: npm install @ujeebu-org/ujeebu-sdk@0.1.2
// Run: UJEEBU_API_KEY=your_key node bbc_detail_sdk.mjs
import { UjeebuClient } from '@ujeebu-org/ujeebu-sdk';
const API_KEY = process.env.UJEEBU_API_KEY;
const URLS = [
"https://www.bbc.com/news/articles/cmr4y2yl17x7o",
"https://www.bbc.com/news/articles/cq74pkelv9rxo",
];
const SETTINGS = {
js: true,
};
const EXTRACT_RULES = {
title: {
selector: "h1",
type: "text",
},
description: {
selector: "meta[property=\"og:description\"]",
type: "attr",
attribute: "content",
},
image: {
selector: "meta[property=\"og:image\"]",
type: "attr",
attribute: "content",
},
url: {
selector: "link[rel=\"canonical\"]",
type: "attr",
attribute: "href",
},
published: {
selector: "time[datetime]",
type: "attr",
attribute: "datetime",
},
summary: {
selector: "article p:first-of-type",
type: "text",
},
section: {
selector: "a[data-testid='internal-link'][href*='/news/topics/']",
type: "text",
},
};
async function scrape(client, url) {
let res;
try {
// client.scrape POSTs JSON when extract_rules is set (scrapeWithRules would send it as a GET query, which the API ignores)
res = await client.scrape(url, { ...SETTINGS, extract_rules: EXTRACT_RULES });
} catch (err) {
const status = err.response?.status ?? 'error';
const message = err.response?.data?.message ?? err.message;
console.error(`HTTP ${status} for ${url}: ${String(message).slice(0, 300)}`);
process.exit(1);
}
console.error(`Ujb-Credits: ${res.headers['ujb-credits']}`);
return res.data.result;
}
if (!API_KEY) {
console.error('Set the UJEEBU_API_KEY environment variable.');
process.exit(1);
}
const client = new UjeebuClient(API_KEY);
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
for (const [i, url] of URLS.entries()) {
if (i) await pause(2000); // be polite: one page at a time
console.log(JSON.stringify(await scrape(client, url), null, 2));
}
pip install requests # Scrape BBC News bbc.com news and articles: articles with the Ujeebu Scrape API.
# Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
# Run: UJEEBU_API_KEY=your_key python3 bbc_detail.py (pip install requests)
import json
import os
import sys
import time
import requests
API_URL = "https://api.ujeebu.com/scrape"
API_KEY = os.environ.get("UJEEBU_API_KEY")
URLS = [
"https://www.bbc.com/news/articles/cmr4y2yl17x7o",
"https://www.bbc.com/news/articles/cq74pkelv9rxo",
]
SETTINGS = {
"js": True,
}
EXTRACT_RULES = {
"title": {
"selector": "h1",
"type": "text",
},
"description": {
"selector": "meta[property=\"og:description\"]",
"type": "attr",
"attribute": "content",
},
"image": {
"selector": "meta[property=\"og:image\"]",
"type": "attr",
"attribute": "content",
},
"url": {
"selector": "link[rel=\"canonical\"]",
"type": "attr",
"attribute": "href",
},
"published": {
"selector": "time[datetime]",
"type": "attr",
"attribute": "datetime",
},
"summary": {
"selector": "article p:first-of-type",
"type": "text",
},
"section": {
"selector": "a[data-testid='internal-link'][href*='/news/topics/']",
"type": "text",
},
}
def scrape(url):
response = requests.post(
API_URL,
headers={"ApiKey": API_KEY},
json={"url": url, **SETTINGS, "extract_rules": EXTRACT_RULES},
timeout=180,
)
if response.status_code != 200:
try:
message = response.json().get("message", response.text)
except ValueError:
message = response.text
sys.exit(f"HTTP {response.status_code} for {url}: {str(message)[:300]}")
print(f"Ujb-Credits: {response.headers.get('Ujb-Credits')}", file=sys.stderr)
return response.json()["result"]
if not API_KEY:
sys.exit("Set the UJEEBU_API_KEY environment variable.")
for i, url in enumerate(URLS):
if i:
time.sleep(2) # be polite: one page at a time
print(json.dumps(scrape(url), indent=2, ensure_ascii=False))
// Scrape BBC News bbc.com news and articles: articles with the Ujeebu Scrape API.
// Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
// Run: UJEEBU_API_KEY=your_key node bbc_detail.mjs (Node.js 18 or later)
const API_URL = 'https://api.ujeebu.com/scrape';
const API_KEY = process.env.UJEEBU_API_KEY;
const URLS = [
"https://www.bbc.com/news/articles/cmr4y2yl17x7o",
"https://www.bbc.com/news/articles/cq74pkelv9rxo",
];
const SETTINGS = {
js: true,
};
const EXTRACT_RULES = {
title: {
selector: "h1",
type: "text",
},
description: {
selector: "meta[property=\"og:description\"]",
type: "attr",
attribute: "content",
},
image: {
selector: "meta[property=\"og:image\"]",
type: "attr",
attribute: "content",
},
url: {
selector: "link[rel=\"canonical\"]",
type: "attr",
attribute: "href",
},
published: {
selector: "time[datetime]",
type: "attr",
attribute: "datetime",
},
summary: {
selector: "article p:first-of-type",
type: "text",
},
section: {
selector: "a[data-testid='internal-link'][href*='/news/topics/']",
type: "text",
},
};
async function scrape(url) {
const res = await fetch(API_URL, {
method: 'POST',
headers: { ApiKey: API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ url, ...SETTINGS, extract_rules: EXTRACT_RULES }),
signal: AbortSignal.timeout(180000),
});
const text = await res.text();
if (res.status !== 200) {
let message = text;
try {
message = JSON.parse(text).message ?? text;
} catch {}
console.error(`HTTP ${res.status} for ${url}: ${String(message).slice(0, 300)}`);
process.exit(1);
}
console.error(`Ujb-Credits: ${res.headers.get('ujb-credits')}`);
return JSON.parse(text).result;
}
if (!API_KEY) {
console.error('Set the UJEEBU_API_KEY environment variable.');
process.exit(1);
}
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
for (const [i, url] of URLS.entries()) {
if (i) await pause(2000); // be polite: one page at a time
console.log(JSON.stringify(await scrape(url), null, 2));
}
#!/usr/bin/env bash
# Scrape BBC News bbc.com news and articles: articles with the Ujeebu Scrape API.
# Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
# Run: UJEEBU_API_KEY=your_key bash bbc_detail.sh (curl 7.76 or later)
set -euo pipefail
curl -sS --fail-with-body --max-time 180 -D headers.txt \
-X POST 'https://api.ujeebu.com/scrape' \
-H "ApiKey: ${UJEEBU_API_KEY:?Set the UJEEBU_API_KEY environment variable.}" \
-H 'Content-Type: application/json' \
--data-binary @- <<'JSON'
{
"url": "https://www.bbc.com/news/articles/cmr4y2yl17x7o",
"js": true,
"extract_rules": {
"title": {
"selector": "h1",
"type": "text"
},
"description": {
"selector": "meta[property=\"og:description\"]",
"type": "attr",
"attribute": "content"
},
"image": {
"selector": "meta[property=\"og:image\"]",
"type": "attr",
"attribute": "content"
},
"url": {
"selector": "link[rel=\"canonical\"]",
"type": "attr",
"attribute": "href"
},
"published": {
"selector": "time[datetime]",
"type": "attr",
"attribute": "datetime"
},
"summary": {
"selector": "article p:first-of-type",
"type": "text"
},
"section": {
"selector": "a[data-testid='internal-link'][href*='/news/topics/']",
"type": "text"
}
}
}
JSON
echo
grep -i '^ujb-credits' headers.txt >&2
<?php
// Scrape BBC News bbc.com news and articles: articles with the Ujeebu Scrape API.
// Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
// Run: UJEEBU_API_KEY=your_key php bbc_detail.php (PHP 7.4 or later with curl)
$apiKey = getenv('UJEEBU_API_KEY') ?: exit("Set the UJEEBU_API_KEY environment variable.\n");
$urls = [
'https://www.bbc.com/news/articles/cmr4y2yl17x7o',
'https://www.bbc.com/news/articles/cq74pkelv9rxo',
];
$settings = [
'js' => true,
];
$extractRules = [
'title' => [
'selector' => 'h1',
'type' => 'text',
],
'description' => [
'selector' => 'meta[property="og:description"]',
'type' => 'attr',
'attribute' => 'content',
],
'image' => [
'selector' => 'meta[property="og:image"]',
'type' => 'attr',
'attribute' => 'content',
],
'url' => [
'selector' => 'link[rel="canonical"]',
'type' => 'attr',
'attribute' => 'href',
],
'published' => [
'selector' => 'time[datetime]',
'type' => 'attr',
'attribute' => 'datetime',
],
'summary' => [
'selector' => 'article p:first-of-type',
'type' => 'text',
],
'section' => [
'selector' => 'a[data-testid=\'internal-link\'][href*=\'/news/topics/\']',
'type' => 'text',
],
];
function scrape(string $url, string $apiKey, array $settings, array $extractRules)
{
$ch = curl_init('https://api.ujeebu.com/scrape');
$headers = [];
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 180,
CURLOPT_HTTPHEADER => ['ApiKey: ' . $apiKey, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['url' => $url] + $settings + ['extract_rules' => $extractRules]),
CURLOPT_HEADERFUNCTION => function ($ch, $line) use (&$headers) {
if (strpos($line, ':') !== false) {
[$k, $v] = explode(':', $line, 2);
$headers[strtolower(trim($k))] = trim($v);
}
return strlen($line);
},
]);
$body = curl_exec($ch);
if ($body === false) {
fwrite(STDERR, 'Request failed: ' . curl_error($ch) . "\n");
exit(1);
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($status !== 200) {
$message = json_decode($body, true)['message'] ?? $body;
fwrite(STDERR, "HTTP $status for $url: " . substr((string) $message, 0, 300) . "\n");
exit(1);
}
fwrite(STDERR, 'Ujb-Credits: ' . ($headers['ujb-credits'] ?? '?') . "\n");
return json_decode($body, true)['result'];
}
foreach ($urls as $i => $url) {
if ($i > 0) {
sleep(2); // be polite: one page at a time
}
echo json_encode(scrape($url, $apiKey, $settings, $extractRules), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), "\n";
}
go mod init scraper && go get github.com/ujeebu/ujeebu-go@v0.1.8 // Scrape BBC News bbc.com news and articles: articles with the Ujeebu Scrape API.
// Settings and extract rules validated on real pages on 2026-10-28 (Ujeebu site guide).
// Uses the official SDK github.com/ujeebu/ujeebu-go v0.1.8: go mod init scraper && go get github.com/ujeebu/ujeebu-go@v0.1.8
// Run: UJEEBU_API_KEY=your_key go run bbc_detail.go
package main
import (
"encoding/json"
"errors"
"fmt"
"os"
"time"
ujeebu "github.com/ujeebu/ujeebu-go"
)
var urls = []string{
"https://www.bbc.com/news/articles/cmr4y2yl17x7o",
"https://www.bbc.com/news/articles/cq74pkelv9rxo",
}
// The extract rules of the recipe, as the JSON the API takes.
const extractRulesJSON = `{
"title": {
"selector": "h1",
"type": "text"
},
"description": {
"selector": "meta[property=\"og:description\"]",
"type": "attr",
"attribute": "content"
},
"image": {
"selector": "meta[property=\"og:image\"]",
"type": "attr",
"attribute": "content"
},
"url": {
"selector": "link[rel=\"canonical\"]",
"type": "attr",
"attribute": "href"
},
"published": {
"selector": "time[datetime]",
"type": "attr",
"attribute": "datetime"
},
"summary": {
"selector": "article p:first-of-type",
"type": "text"
},
"section": {
"selector": "a[data-testid='internal-link'][href*='/news/topics/']",
"type": "text"
}
}`
var extractRules map[string]any
func fail(format string, args ...any) {
fmt.Fprintf(os.Stderr, format+"\n", args...)
os.Exit(1)
}
func short(s string) string {
if len(s) > 300 {
return s[:300]
}
return s
}
func params(target string) ujeebu.ScrapeParams {
p := ujeebu.ScrapeParams{URL: target}
p.JS = true
p.ExtractRules = extractRules
return p
}
func scrape(client *ujeebu.Client, target string) map[string]any {
// the int is the credits the request cost (the Ujb-Credits header), not an HTTP status
resp, credits, err := client.Scrape(params(target))
if err != nil {
var apiErr *ujeebu.APIError
if errors.As(err, &apiErr) {
fail("HTTP %d for %s: %s", apiErr.StatusCode, target, short(apiErr.Message))
}
fail("Request failed for %s: %v", target, err)
}
fmt.Fprintf(os.Stderr, "Ujb-Credits: %d\n", credits)
result, _ := resp.Result.(map[string]any)
return result
}
func printJSON(v any) {
enc := json.NewEncoder(os.Stdout)
enc.SetEscapeHTML(false)
enc.SetIndent("", " ")
if err := enc.Encode(v); err != nil {
fail("Cannot print the result: %v", err)
}
}
func main() {
apiKey := os.Getenv("UJEEBU_API_KEY")
if apiKey == "" {
fail("Set the UJEEBU_API_KEY environment variable.")
}
if err := json.Unmarshal([]byte(extractRulesJSON), &extractRules); err != nil {
fail("Bad extract rules: %v", err)
}
client, err := ujeebu.NewClient(apiKey, ujeebu.WithTimeout(180*time.Second))
if err != nil {
fail("%v", err)
}
for i, target := range urls {
if i > 0 {
time.Sleep(2 * time.Second) // be polite: one page at a time
}
printJSON(scrape(client, target))
}
}
bbc.co.uk news and sport
No extraction recipe for these pages yet: the script fetches the page with the working settings. Add extract rules to get JSON.
pip install ujeebu-python==0.1.5 # Fetch a BBC News page with the Ujeebu Scrape API.
# Settings from our health checks (Ujeebu site guide). Prints the start of the page HTML.
# Uses the official SDK ujeebu-python 0.1.5: pip install ujeebu-python==0.1.5
# Run: UJEEBU_API_KEY=your_key python3 bbc_page_sdk.py
import json
import os
import sys
import time
import requests
from ujeebu_python import UjeebuClient
API_KEY = os.environ.get("UJEEBU_API_KEY")
URLS = [
"https://www.bbc.co.uk/news",
]
SETTINGS = {
"js": True,
}
def scrape(client, url):
try:
response = client.scrape(url, params=SETTINGS)
except requests.RequestException as error:
sys.exit(f"Request failed for {url}: {error}")
if response.status_code != 200:
try:
message = response.json().get("message", response.text)
except ValueError:
message = response.text
sys.exit(f"HTTP {response.status_code} for {url}: {str(message)[:300]}")
print(f"Ujb-Credits: {response.headers.get('Ujb-Credits')}", file=sys.stderr)
return response.text
if not API_KEY:
sys.exit("Set the UJEEBU_API_KEY environment variable.")
client = UjeebuClient(api_key=API_KEY)
for i, url in enumerate(URLS):
if i:
time.sleep(2) # be polite: one page at a time
html = scrape(client, url)
print(len(html), "bytes")
print(html[:500])
npm install @ujeebu-org/ujeebu-sdk@0.1.2 // Fetch a BBC News page with the Ujeebu Scrape API.
// Settings from our health checks (Ujeebu site guide). Prints the start of the page HTML.
// Uses the official SDK @ujeebu-org/ujeebu-sdk 0.1.2: npm install @ujeebu-org/ujeebu-sdk@0.1.2
// Run: UJEEBU_API_KEY=your_key node bbc_page_sdk.mjs
import { UjeebuClient } from '@ujeebu-org/ujeebu-sdk';
const API_KEY = process.env.UJEEBU_API_KEY;
const URLS = [
"https://www.bbc.co.uk/news",
];
const SETTINGS = {
js: true,
};
async function scrape(client, url) {
let res;
try {
res = await client.scrape(url, SETTINGS);
} catch (err) {
const status = err.response?.status ?? 'error';
const message = err.response?.data?.message ?? err.message;
console.error(`HTTP ${status} for ${url}: ${String(message).slice(0, 300)}`);
process.exit(1);
}
console.error(`Ujb-Credits: ${res.headers['ujb-credits']}`);
return String(res.data);
}
if (!API_KEY) {
console.error('Set the UJEEBU_API_KEY environment variable.');
process.exit(1);
}
const client = new UjeebuClient(API_KEY);
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
for (const [i, url] of URLS.entries()) {
if (i) await pause(2000); // be polite: one page at a time
const html = await scrape(client, url);
console.log(html.length, 'bytes');
console.log(html.slice(0, 500));
}
pip install requests # Fetch a BBC News page with the Ujeebu Scrape API.
# Settings from our health checks (Ujeebu site guide). Prints the start of the page HTML.
# Run: UJEEBU_API_KEY=your_key python3 bbc_page.py (pip install requests)
import json
import os
import sys
import time
import requests
API_URL = "https://api.ujeebu.com/scrape"
API_KEY = os.environ.get("UJEEBU_API_KEY")
URLS = [
"https://www.bbc.co.uk/news",
]
SETTINGS = {
"js": True,
}
def scrape(url):
response = requests.post(
API_URL,
headers={"ApiKey": API_KEY},
json={"url": url, **SETTINGS},
timeout=180,
)
if response.status_code != 200:
try:
message = response.json().get("message", response.text)
except ValueError:
message = response.text
sys.exit(f"HTTP {response.status_code} for {url}: {str(message)[:300]}")
print(f"Ujb-Credits: {response.headers.get('Ujb-Credits')}", file=sys.stderr)
return response.text
if not API_KEY:
sys.exit("Set the UJEEBU_API_KEY environment variable.")
for i, url in enumerate(URLS):
if i:
time.sleep(2) # be polite: one page at a time
html = scrape(url)
print(len(html), "bytes")
print(html[:500])
// Fetch a BBC News page with the Ujeebu Scrape API.
// Settings from our health checks (Ujeebu site guide). Prints the start of the page HTML.
// Run: UJEEBU_API_KEY=your_key node bbc_page.mjs (Node.js 18 or later)
const API_URL = 'https://api.ujeebu.com/scrape';
const API_KEY = process.env.UJEEBU_API_KEY;
const URLS = [
"https://www.bbc.co.uk/news",
];
const SETTINGS = {
js: true,
};
async function scrape(url) {
const res = await fetch(API_URL, {
method: 'POST',
headers: { ApiKey: API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ url, ...SETTINGS }),
signal: AbortSignal.timeout(180000),
});
const text = await res.text();
if (res.status !== 200) {
let message = text;
try {
message = JSON.parse(text).message ?? text;
} catch {}
console.error(`HTTP ${res.status} for ${url}: ${String(message).slice(0, 300)}`);
process.exit(1);
}
console.error(`Ujb-Credits: ${res.headers.get('ujb-credits')}`);
return text;
}
if (!API_KEY) {
console.error('Set the UJEEBU_API_KEY environment variable.');
process.exit(1);
}
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
for (const [i, url] of URLS.entries()) {
if (i) await pause(2000); // be polite: one page at a time
const html = await scrape(url);
console.log(html.length, 'bytes');
console.log(html.slice(0, 500));
}
#!/usr/bin/env bash
# Fetch a BBC News page with the Ujeebu Scrape API.
# Settings from our health checks (Ujeebu site guide). Prints the start of the page HTML.
# Run: UJEEBU_API_KEY=your_key bash bbc_page.sh (curl 7.76 or later)
set -euo pipefail
curl -sS --fail-with-body --max-time 180 -D headers.txt \
-X POST 'https://api.ujeebu.com/scrape' \
-H "ApiKey: ${UJEEBU_API_KEY:?Set the UJEEBU_API_KEY environment variable.}" \
-H 'Content-Type: application/json' \
-o page.html --data-binary @- <<'JSON'
{
"url": "https://www.bbc.co.uk/news",
"js": true
}
JSON
head -c 500 page.html
echo
grep -i '^ujb-credits' headers.txt >&2
<?php
// Fetch a BBC News page with the Ujeebu Scrape API.
// Settings from our health checks (Ujeebu site guide). Prints the start of the page HTML.
// Run: UJEEBU_API_KEY=your_key php bbc_page.php (PHP 7.4 or later with curl)
$apiKey = getenv('UJEEBU_API_KEY') ?: exit("Set the UJEEBU_API_KEY environment variable.\n");
$urls = [
'https://www.bbc.co.uk/news',
];
$settings = [
'js' => true,
];
function scrape(string $url, string $apiKey, array $settings)
{
$ch = curl_init('https://api.ujeebu.com/scrape');
$headers = [];
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 180,
CURLOPT_HTTPHEADER => ['ApiKey: ' . $apiKey, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['url' => $url] + $settings),
CURLOPT_HEADERFUNCTION => function ($ch, $line) use (&$headers) {
if (strpos($line, ':') !== false) {
[$k, $v] = explode(':', $line, 2);
$headers[strtolower(trim($k))] = trim($v);
}
return strlen($line);
},
]);
$body = curl_exec($ch);
if ($body === false) {
fwrite(STDERR, 'Request failed: ' . curl_error($ch) . "\n");
exit(1);
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($status !== 200) {
$message = json_decode($body, true)['message'] ?? $body;
fwrite(STDERR, "HTTP $status for $url: " . substr((string) $message, 0, 300) . "\n");
exit(1);
}
fwrite(STDERR, 'Ujb-Credits: ' . ($headers['ujb-credits'] ?? '?') . "\n");
return $body;
}
foreach ($urls as $i => $url) {
if ($i > 0) {
sleep(2); // be polite: one page at a time
}
$html = scrape($url, $apiKey, $settings);
echo strlen($html), " bytes\n", substr($html, 0, 500), "\n";
}
go mod init scraper && go get github.com/ujeebu/ujeebu-go@v0.1.8 // Fetch a BBC News page with the Ujeebu Scrape API.
// Settings from our health checks (Ujeebu site guide). Prints the start of the page HTML.
// Uses the official SDK github.com/ujeebu/ujeebu-go v0.1.8: go mod init scraper && go get github.com/ujeebu/ujeebu-go@v0.1.8
// Run: UJEEBU_API_KEY=your_key go run bbc_page.go
package main
import (
"errors"
"fmt"
"os"
"time"
ujeebu "github.com/ujeebu/ujeebu-go"
)
var urls = []string{
"https://www.bbc.co.uk/news",
}
func fail(format string, args ...any) {
fmt.Fprintf(os.Stderr, format+"\n", args...)
os.Exit(1)
}
func short(s string) string {
if len(s) > 300 {
return s[:300]
}
return s
}
func params(target string) ujeebu.ScrapeParams {
p := ujeebu.ScrapeParams{URL: target}
p.JS = true
return p
}
func scrape(client *ujeebu.Client, target string) string {
// the int is the credits the request cost (the Ujb-Credits header), not an HTTP status
resp, credits, err := client.Scrape(params(target))
if err != nil {
var apiErr *ujeebu.APIError
if errors.As(err, &apiErr) {
fail("HTTP %d for %s: %s", apiErr.StatusCode, target, short(apiErr.Message))
}
fail("Request failed for %s: %v", target, err)
}
fmt.Fprintf(os.Stderr, "Ujb-Credits: %d\n", credits)
return resp.HTML
}
func main() {
apiKey := os.Getenv("UJEEBU_API_KEY")
if apiKey == "" {
fail("Set the UJEEBU_API_KEY environment variable.")
}
client, err := ujeebu.NewClient(apiKey, ujeebu.WithTimeout(180*time.Second))
if err != nil {
fail("%v", err)
}
for i, target := range urls {
if i > 0 {
time.Sleep(2 * time.Second) // be polite: one page at a time
}
html := scrape(client, target)
fmt.Println(len(html), "bytes")
fmt.Println(html[:min(len(html), 500)])
}
}
SDK tabs use the official Ujeebu SDKs (ujeebu-python 0.1.5, @ujeebu-org/ujeebu-sdk 0.1.2, github.com/ujeebu/ujeebu-go v0.1.8); there is no PHP SDK, so the PHP tab calls the API with curl. For agents and scripts, the same status and settings are at /scrape/bbc.json.
Try it yourself
Run this on BBC News with your own key
Get a free API key, set UJEEBU_API_KEY and run any script above as it is. 5,000 free credits for 7 days, no card.
URL patterns and pagination
What the URLs look like, read from the pages our checks fetched.
bbc.com news and articles: Search and listing pages
- Next pages
- We did not see a next-page link on the pages we fetched. Results may load as you scroll: try
scroll_down. - Validated on
https://www.bbc.com/news/technologyhttps://www.bbc.com/business
bbc.com news and articles: Articles
- Pattern
https://www.bbc.com/news/articles/{id}- Validated on
https://www.bbc.com/news/articles/cmr4y2yl17x7ohttps://www.bbc.com/news/articles/cq74pkelv9rxo
Settings that work today
From our health checks over the last 7 days: the cheapest settings that return the real page most of the time.
bbc.com news and articles
| Endpoint | /scrape |
|---|---|
js | true |
| Cost | up to 5 credits a request (only HTTP 200 and 404 are billed) |
Collect detail page URLs from listing pages first, then fetch each detail page. Our checks run with JavaScript rendering on (js=true): keep it on. Start with the default (rotating) proxy, the cheapest one that passed most of its attempts in our checks.
| Proxy | Attempts | Passed |
|---|---|---|
| Default (rotating) | 33 | 33 |
The cheapest proxy that passes most of our checks of this site.
bbc.co.uk news and sport
| Endpoint | /scrape |
|---|---|
js | true |
| Cost | up to 5 credits a request (only HTTP 200 and 404 are billed) |
Collect detail page URLs from listing pages first, then fetch each detail page. Our checks run with JavaScript rendering on (js=true): keep it on. Start with the default (rotating) proxy, the cheapest one that passed most of its attempts in our checks.
| Proxy | Attempts | Passed |
|---|---|---|
| Default (rotating) | 32 | 32 |
The cheapest proxy that passes most of our checks of this site.
What people build with BBC News data
- Media monitoringTrack the articles published on the topics and companies you follow.More on this use case
- Content for AI and RAGCollect headlines, dates and summaries as structured input for search and LLM pipelines.More on this use case
- Publishing timelineMeasure when and how often a site publishes, by section.
Limits and etiquette
- Public pages only. Pages behind a login, and data shown only to signed-in users, are out of scope.
- Keep the rate modest: fetch pages one after another or with low concurrency, and cache what you already have.
- robots.txt of www.bbc.com (read 2026-10-27): bbc.com news and articles allowed for generic crawlers; no crawl delay set.
- Read BBC News's terms of service before you collect data at scale, and do not collect personal data you have no basis to process. This guide is not legal advice.
Questions
Can you scrape BBC News with Ujeebu?
Yes. 65 of 65 checks of public BBC News pages passed in the last 7 days with the settings on this page.
Which settings work for BBC News?
Call /scrape with js=true. On the default (rotating) proxy, 33 of 33 attempts passed in the last 7 days.
How many credits does a BBC News request cost?
With these settings a request costs up to 5 credits. Only responses with HTTP 200 or 404 are billed: a blocked or timed-out request is free.
Which fields can I extract from BBC News?
With the extraction recipes on this page, validated on real BBC News pages through our API: bbc.com news and articles: search and listing pages: url, title, image, summary, published; bbc.com news and articles: articles: title, description, image, url, published, summary, section. Pass the recipe as extract_rules in a POST to /scrape and the API returns those fields as JSON.
Is it allowed to scrape BBC News?
Its robots.txt allows generic crawlers on the page types in this guide. Collect public pages only, read BBC News's terms of service, keep your request rate modest and do not collect personal data you have no basis to process. This is not legal advice.
How fresh is this page?
The status and settings come from our own health checks of bbc.com, which run around the clock. Last check: 2026-11-02 20:33:06 UTC; last pass: 2026-11-02 20:33:06 UTC.