Foreign Policy Scraper
Spider read foreignpolicy.com in 157 ms without a browser and returned 736 lines of clean markdown, including sections like "Odysseus at the End of Civilization", "There’s Only One Way Out of Trump’s Reckless War" and "The Western Myth of Russian Greatness".
What do export controls between Washington and Beijing have in common with the Houthis’ ability to disrupt shipping through the Bab el-Mandeb? Both representA battle scene from the film ‘The Odyssey’ by director Christopher Nolan.### Odysseus at the End of CivilizationNolan’s film confronts the betrayal of the West’s own values.People pass a banner depicting U.S. President Donald Trump with a target on his head during funeral ceremonies for Iranian Supreme Leader Ali Khamenei at the Grand Mosalla in Tehran on July 5.### There’s Only One Way Out of Trump’s Reckless WarPay off Iran to open Hormuz and freeze its nuclear program.Shadow Government Philip H. GordonA woman crosses a road in front of a mural depicting Russian President Vladimir Putin in Kashira, Russia, southeast of Moscow, on Oct. 16, 2017.### The Western Myth of Russian GreatnessThere is a long history of foreigners idealizing Russia and exaggerating its power.U.S. President Donald Trump and military leaders are seen watching U.S. troops in a demonstration, which includes paratroopers.### How a U.S. Ground Operation in Iran Could UnfoldMilitary experts said limited raids could happen, but a large-scale invasion is unlikely.fp-collections-icon-550x367COLLECTIONS: Download PDFs on the trade wars, the AI arms race, and the scramble for critical minerals.An Iranian flag flutters in the wind as ships remain anchored in the Strait of Hormuz on May 16.### Ranking the World’s Top 5 ChokepointsA Trojan horse statue on top of a rock reading, "The Odyssey."### What Homer’s ‘Odyssey’ Tells Us About the Economics of the Bronze AgeInsider Cameron Abadi, Adam ToozeThe shadow of a pump jack is seen against a sunset.### Why Energy Prices Didn’t Soar Higher This Year The same call, in code.
The capture above came back as markdown. These examples add a key, so you get browser rendering, proxies, and concurrency on foreignpolicy.com.
import { SpiderBrowser } from "spider-browser";
const spider = new SpiderBrowser({
apiKey: process.env.SPIDER_API_KEY!,
});
await spider.connect();
const page = spider.page!;
await page.goto("https://foreignpolicy.com/");
// No selectors, no schema. Spider reads the page and names the fields.
const data = await page.scrape();
console.log(data);
await spider.close(); import { SpiderBrowser } from "spider-browser";
const spider = new SpiderBrowser({
apiKey: process.env.SPIDER_API_KEY!,
stealth: 2,
captcha: "solve",
});
await spider.connect();
const page = spider.page!;
await page.goto("https://foreignpolicy.com/");
await page.content();
const data = await page.evaluate(`(() => {
const articles = [];
document.querySelectorAll("article, .card-article, .content-card").forEach(el => {
const headline = el.querySelector("h2 a, h3 a, .hed a")?.textContent?.trim();
const link = el.querySelector("h2 a, h3 a, .hed a")?.getAttribute("href");
const author = el.querySelector(".byline a, .author")?.textContent?.trim();
const dek = el.querySelector(".dek, .excerpt")?.textContent?.trim();
if (headline) articles.push({ headline, link, author, dek });
});
return JSON.stringify({ total: articles.length, articles: articles.slice(0, 15) });
})()`);
console.log(JSON.parse(data));
await spider.close(); Ready for volume? Get an API key →
Fields you can pull.
Spider names these from the page. The capture above came back as markdown; the same
call with return_format: "json" returns them as keys.
What foreignpolicy.com costs to scrape.
The capture above cost $0.000854 to fetch. Pricing is $1 per GB of pre-transformation bandwidth plus $0.001 per CPU minute, so a page like this one lands at a fraction of a cent. Failed requests are billed at $0.
- Free balance on signup
- No card required to test
- Balance never expires
Run it keyless, no account
More News scrapers.
Google News Scraper
Extract news articles, headlines, publication sources, and trending stories from Google News.
BBC News Scraper
Extract news articles, headlines, and publication data from BBC News.
CNN Scraper
Extract news articles, headlines, and video content data from CNN.
Start scraping foreignpolicy.com.
You already have the call. A key raises the rate limit and turns on browser rendering, proxies, and concurrency. Balance never expires, and top-ups go through secure checkout.