Automatically identifies the primary image(s) on any web page and returns comprehensive information and metadata for each image.
Request
| Authentication | |
|---|---|
token | Cache and insert token into example requests (15d expiry) |
| Query parameters | |
|---|---|
url | Target URL to extract |
fields | Specify optional fields to be returned from any fully-extracted pages (e.g. One of: |
timeout | Sets a value in milliseconds to wait for the retrieval/fetch of content from the requested URL. The default timeout for the third-party response is 30 seconds (30000). |
callback | Use for jsonp requests. Needed for cross-domain ajax. |
proxy | Specify an IP address of a custom proxy that will be used to fetch the target page. (Ex: |
proxyAuth | Used to specify the authentication parameters that will be used with a custom proxy specified in the &proxy parameter. (Ex: |
useProxy | Set to |
Example request
curl --request GET \
--url 'https://api.diffbot.com/v3/image?url=https%3A%2F%2Fwww.diffbot.com%2Fproducts%2Fextract%2F&token=<DIFFBOT_TOKEN>' \
--header 'Accept: application/json'
Response
| 200Successful API Response | |
|---|---|
request | |
pageUrl | |
api | |
version | |
objects | |
xpath | |
humanLanguage | |
naturalHeight | |
diffbotUri | |
pageUrl | |
type | |
url | |
naturalWidth | |
tags | |
typeHierarchy | |
id | |
label | |
type | |
uri |
{
"request": {
"pageUrl": "https://www.diffbot.com/products/extract/",
"api": "image",
"version": 3
},
"objects": [
{
"xpath": "/HTML/BODY/MAIN/DIV[@id='slice-readslikehumans']/DIV[@class='container px-3 py-5 py-md-6 mx-auto']/DIV[@class='row justify-content-center']/DIV[@class='col-12 col-md d-flex justify-content-center align-items-center order-md-1']/IMG[@class='img-fluid mb-4 align-self-start']",
"humanLanguage": "en",
"naturalHeight": 1023,
"diffbotUri": "image|3|666824882",
"pageUrl": "https://www.diffbot.com/products/extract/",
"type": "image",
"url": "https://www.diffbot.com/assets/img/products/extract_screenshot.png",
"naturalWidth": 897,
"tags": [
{
"typeHierarchy": [
"http://www.w3.org/2002/07/owl#Thing",
"http://dbpedia.org/ontology/Work",
"http://dbpedia.org/ontology/Website"
],
"id": 33898,
"label": "Website",
"type": "http://dbpedia.org/ontology/Website",
"uri": "https://www.diffbot.com/entity/Xd90vp_U4MJOoRHIja3quxg"
},
{
"id": 1404579,
"label": "Ring binder",
"uri": "http://diffbot.com/entity/XYwPij6UgPdaDEY6fXSrrRA"
}
]
},
{
"xpath": "/HTML/BODY/MAIN/DIV[@id='slice-lookslikeahuman']/DIV[@class='container px-3 py-5 py-md-6 mx-auto']/DIV[@class='row justify-content-center']/DIV[@class='col-12 col-md d-flex justify-content-center align-items-center order-md-1']/IMG[@class='img-fluid mb-4']",
"humanLanguage": "en",
"naturalHeight": 270,
"diffbotUri": "image|3|1865428953",
"pageUrl": "https://www.diffbot.com/products/extract/",
"type": "image",
"url": "https://www.diffbot.com/assets/img/products/any_language.png",
"naturalWidth": 554,
"tags": [
{
"id": 5462349,
"label": "Sachet",
"uri": "http://diffbot.com/entity/X1_7MIKBoPpuRnAPVQXqQxA"
},
{
"id": 479373,
"label": "Eraser",
"uri": "http://diffbot.com/entity/XGPnWNBUZPyuNyfK9rJr6vQ"
},
{
"id": 57260,
"label": "Envelope",
"uri": "http://diffbot.com/entity/XK5gEV93iP6SqKMDjDr0YBQ"
}
]
},
{
"xpath": "/HTML/BODY/MAIN/DIV[@id='slice-one-click-crawling']/DIV[@class='container px-3 py-5 py-md-6 mx-auto']/DIV[@class='row justify-content-center']/DIV[@class='col-12 offset-md-1 col-md d-flex justify-content-center align-items-center order-md-2']/IMG[@class='img-fluid mb-4']",
"humanLanguage": "en",
"naturalHeight": 372,
"diffbotUri": "image|3|1699007329",
"pageUrl": "https://www.diffbot.com/products/extract/",
"type": "image",
"url": "https://www.diffbot.com/assets/img/products/analyze_two.png",
"naturalWidth": 451,
"tags": [
{
"id": 268267,
"label": "Tray",
"uri": "http://diffbot.com/entity/XwXgQ3A7sNmypX2VX3oZCgg"
},
{
"id": 467731,
"label": "Spatula",
"uri": "http://diffbot.com/entity/XZohZtDoDPvq1wusJQCSZZA"
},
{
"id": 2649730,
"label": "Measuring cup",
"uri": "http://diffbot.com/entity/XhwdQ4HnKOsCVrf9YU3hyWw"
}
]
}
]
}
| 500Internal Server Error | |
|---|---|
errorCode | |
error |
{
"errorCode": 500,
"error": "Internal Server Error"
}