Web Scrape
Web page text by link: the main content without menus and ads in Markdown, optionally with the page tables and data.
Հատկություններ
Նկարագրություն
What it is
Web Scrape opens a page by its address and returns its main text without menus, ads, buttons and footer. The text comes in Markdown: headings, lists and links are kept, so it is easy to read, store and pass to a language model.
On request the service also returns two kinds of content that do not get into the main text:
- the page tables;
- the page data — information the site fills the page with using scripts: for example, a list of products with prices or catalogue rows.
Use it when you need to:
- get the text of an article, a manual or a help page by its link;
- pass the page content to a chatbot so it can answer based on it;
- take a table or a list from a page in a form that is easy to process.
If you need specific details rather than the whole text (a price, a date, an author), Web Extract is more convenient: it returns the fields you ask for.
What you need
- An API key. Create it in your account dashboard. Send the key with every request in the
Authorization: Bearer YOUR_API_KEYheader, replacingYOUR_API_KEYwith your key. Do not publish the key or share it with anyone: requests made with it are paid from your balance. - Money on your balance. Every request is paid; the price is shown on this page.
- A program that sends HTTP requests. The command line (
curl), Python with therequestslibrary or any API testing tool will do. Ready-made examples are in the "Code examples" block below: copy one, put in your key and run it.
How a request is built
- The method and address are in the "Endpoints" block on this page.
- Headers:
Authorization: Bearer YOUR_API_KEYandContent-Type: application/json. - The request body is JSON:
"name": valuepairs in curly braces, separated by commas. Text goes in double quotes; numbers andtrue/falsego without quotes.
Request example
In the examples PAGE_URL is the full page address as shown in the browser address bar, starting with https:// or http://.
Page text only:
{"url": "PAGE_URL"}Text, tables and page data:
{"url": "PAGE_URL", "include_tables": true, "include_data": true}Request parameters
url— required. The full page address.include_tables—trueto get the page tables in thetablesfield. Off by default.include_data—trueto get the page data in thedatafield. Off by default. It helps on pages where a list (products, prices, ratings) is drawn by a script and is missing from the main text or incomplete.
Tables and data do not change the price of a request.
What the response contains
{
"object": "web_scrape",
"url": "PAGE_URL",
"content": "# Article title\n\nThe first paragraph of the article…",
"content_type": "text/html; charset=utf-8",
"tables": [
"| Name | Price |\n|---|---|\n| Product 1 | 100 |\n| Product 2 | 250 |"
],
"data": [
{
"path": "…",
"total": 120,
"columns": ["name", "price.amount", "price.currency"],
"records": [
{"name": "Product 1", "price.amount": 100, "price.currency": "USD"}
]
}
]
}content— the main page text in Markdown.\nin JSON means a line break; in your program it becomes a normal line break.content_type— the content type reported by the site (a service field).tables— present only with"include_tables": true. A list of tables, each a Markdown string with columns separated by|. Empty tables and one-row tables (usually used only for layout) are skipped.
The data field is present only with "include_data": true. It is a list of record sets, largest first. Each set has:
total— how many records the set has on the page;records— the records themselves. Iftotalis greater than the number of items inrecords, the long list was cut;columns— the record field names. Nested fields are written with a dot:price.amountis theamountfield insideprice. Fields that have the same value in every record are left out;path— where in the page data the set was found (a service field; it helps to recognise the same set the next time you read this page).
If the page has no tables or data, tables and data are empty lists [].
Limits
- The page must open without signing in. Private sections and password-protected pages cannot be read.
- The service does not click buttons or scroll. If text appears only after a visitor does something, it will not be in
content. On some of these pagesinclude_datahelps. - The service is made for web pages. Files (PDF, documents, images) are not turned into text:
contentwill be empty. - The service waits up to 30 seconds for the site to respond. A very slow site may not make it.
- Some sites block automated programs. Then you get an error or an empty
content. - Very long tables and lists are cut.
Tips
- If
contentis empty or lacks the list you need, repeat the request with"include_tables": trueand"include_data": true. - To read several pages of one site at once, use Web Crawl.
- You can pass the text from
contentstraight to a language model together with your question: models understand Markdown well.
Pricing
Every request (one page) is paid at a fixed price shown on this page.
If you get an error
The server replies with an HTTP status code. 200 means everything is fine; any other code means an error:
401— the key is missing or wrong. Check the header: the wordBearer, a space and the whole key.402— not enough money on your balance. Top it up in your account dashboard.403— this key is not allowed to use the tool. Check the key permissions in your dashboard.429— too many requests per minute. Wait a little and try again.503— the service is temporarily unavailable. Try again in a minute.- Other codes usually mean the request is malformed: a required field is missing or the JSON has a mistake (an extra or missing comma, single quotes instead of double). Compare your request with the example on this page.
Errors related to the page itself:
404— the site has no page at this address. Check the address.503— the site did not open: the address has a typo, the site does not respond or blocks automated programs. Check the address in a browser and try again later.
Ենդպոինտներ
Կոդի օրինակներ
NeuralBridge-ի այլ մոդելներ
/v1 base_url-ում։ Anthropic SDK-ի համար — առանց /v1.