Skip to main content

API Methods

ping

Checking server and API operation.

Example Request

{
"password": "pass",
"action": "ping"
}

Example Response

{
"success": 1,
"data": "pong"
}

oneRequest

A single scraping query, any scraper and preset can be used. The result will be a formed string according to the result format specified in the preset, as well as the full log of the scraper operation.

Example Request

{
"password": "pass",
"action": "oneRequest",
"data": {
"query": "test",
"parser": "SE::Google",
"configPreset": "default",
"preset": "Pages Count use Proxy"
}
}

Description of possible parameters:

  • parser - which scraper to use for the query
  • preset - which preset to use
  • configPreset - which thread config to use
  • query - the query itself
  • rawResults - optional parameter, if set, instead of the resulting string resultString will return an array results with all results supported by the specified scraper
  • needData - optional parameter indicating whether to return data and pages, in the response; used to save memory, disabled by default
  • doLog - optional parameter indicating whether to return the operation log along with the results, enabled by default
  • options - array with additional options applied to the scraper, for example - override - allows overriding values in the preset

Example Response

{
"success": 1,
"data": {
"resultString": "test: 6070000000\n",
"logs": [
[
0,
1614933603,
"Parser SE::Google::0 parse query test"
],
[
0,
1614933603,
"Parse page 1"
],
...
[
0,
1614933604,
"Thread complete work"
]
]
}
}

Description of variables in the response:

  • resultString - result string
  • logs - array with query execution logs

Overriding Scraper Settings

In options you can override any parameters of the scraper being used; they will be applied on top of the values specified in the settings preset.

Example Request:

{
"password": "pass",
"action": "oneRequest",
"data": {
"parser": "SE::Google",
"preset": "default",
"query": "test",
"rawResults": 1,
"doLog": 0,
"options": [
{
"value": 1,
"type": "override",
"id": "pagecount"
},
{
"value": 10,
"type": "override",
"id": "linksperpage"
},
{
"type": "override",
"id": "useproxy",
"value": false
}
]
}
}

Response:

{
"success": 1,
"data": {
"logs": [],
"results": [
{
"ads": [],
"success": 1,
"info": {
"success": 1,
"retries": 0,
"stats": {
"success": 1,
"retries": 0,
"proxiesUsed": 0,
"requests": 0,
"queries": 1
}
},
"query": {
"first": "test",
"threadId": "0",
"lvl": 0,
"query": "test",
"queryUid": "0",
"orig": "test",
"prefered_proxy": null
},
"totalcount": "6130000000",
"serp": [
"https://www.test.de/",
"Stiftung Warentest",
"Sichern Sie sich mit der <em>test</em>.de-Flatrate freien Zugriff auf alle <em>Tests</em> und Produktfinder. Mehr erfahren: <em>test</em>.de-Flatrates. <em>Test</em> CO2&nbsp;...",
0,
...
],
"related": [
"test <b>speed</b>",
...
],
"detected_geo": "Germany",
"rich": [
"Featured snippet"
],
"misspell": 0,
"resultsCount": 11
}
]
}
}

bulkRequest

Bulk scraping query, any scraper and preset can be used, and you can also specify the number of threads for scraping. The result will be a formed string according to the result format specified in the preset, as well as the full log of the scraper operation for each thread.

Example Request

{
"password": "pass",
"action": "bulkRequest",
"data": {
"parser": "SE::Google",
"preset": "Pages Count no Proxy",
"configPreset": "default",
"threads": 3,
"rawResults": 1,
"queries": [
"test1",
"test2",
"test3",
"test4",
"test5"
]
}
}

Description of possible variables in data:

  • threads - number of threads for scraping
  • queries - array of queries. Other variables are completely analogous to oneRequest, with the exception of query

Example Response

{
"success": 1,
"data": {
"logs": {
"0": {
"1": [
[
4,
1614935687,
"SE::Google::0",
"test1"
],
...
[
0,
1614935688,
"Thread complete work"
]
]
},
...log for other threads...
},
"results": [
{
"ads": [],
"success": 1,
"info": {
"success": 1,
"retries": 0,
"stats": {
"success": 1,
"retries": 0,
"proxiesUsed": 0,
"requests": 0,
"queries": 1
}
},
"query": {
"first": "test1",
"threadId": "0",
"lvl": 0,
"query": "test1",
"queryUid": "0",
"orig": "test1",
"prefered_proxy": null
},
"totalcount": "35800000",
"serp": [
"https://www.test1solutions.com/",
"FoamFlex200 | Oil Spill Absorbent | Oil Disaster solution",
"<em>TEST1</em> IS SOLUTION. In addition to the different models&nbsp;...",
0,
...
],
"related": [
"<b>test2</b>",
...
],
"detected_geo": "Germany",
"rich": [
"Featured snippet",
"People also ask"
],
"misspell": 0,
"resultsCount": 12
},
...results for other queries...
]
}
}

addTask

Adding a task to the queue; all parameters are analogous to those set in the Job Editor interface

tip

For quickly getting the full task configuration, you can use the Job Editor, to create a task and get the JSON for the API request

Example Request

{
"password": "pass",
"action": "addTask",
"data": {
"preset": "default",
"configPreset": "100 Threads",
"parsers": [
[
"SE::Bing",
"default",
{
"type": "override",
"id": "pagecount",
"value": 1
},
{
"type": "options",
"id": "parseAll",
"value": true
}
]
],
"resultsFormat": "$p1.serp.format('$link;$anchor\\n')",
"resultsSaveTo": "file",
"resultsFileName": "$datefile.format().csv",
"additionalFormats": [],
"resultsUnique": "string",
"queriesFrom": "text",
"queryFormat": [
"$query"
],
"uniqueQueries": true,
"saveFailedQueries": false,
"iteratorOptions": {
"onAllLevels": false,
"queryBuildersAfterIterator": false,
"queryBuildersOnAllLevels": false
},
"resultsOptions": {
"overwrite": false,
"writeBOM": true
},
"doLog": "db",
"limitLogsCount": "0",
"keepUnique": "No",
"moreOptions": true,
"resultsPrepend": "Link;Anchor\\n",
"resultsAppend": "",
"queryBuilders": [],
"resultsBuilders": [],
"configOverrides": [],
"runTaskOnComplete": null,
"useResultsFileAsQueriesFile": false,
"runTaskOnCompleteConfig": "default",
"toolsJS": "",
"prio": 5,
"removeOnComplete": false,
"callURLOnComplete": "",
"queries": [
"test",
"bla-bla"
]
}
}

Example Response

The response returns the ID of the created task.

{
"success": 1,
"data": "697403"
}

Task with Requests from a File

To make the task requests be taken from a file, you need to set "queriesFrom": "file" and the path(s) to the request file(s) "queriesFile": ["queries1.txt", "queries2.txt"]. Otherwise, everything is the same as in the example above.

Example Request

{
"password": "pass",
"action": "addTask",
"data": {
"preset": "default",
"configPreset": "100 Threads",
"parsers": [
[
"SE::Google",
"default"
]
],
"resultsFormat": "$p1.preset",
"resultsSaveTo": "file",
"resultsFileName": "$datefile.format().csv",
"additionalFormats": [],
"resultsUnique": "no",
"queriesFrom": "file",
"queryFormat": [
"$query"
],
"uniqueQueries": false,
"saveFailedQueries": false,
"iteratorOptions": {
"onAllLevels": false,
"queryBuildersAfterIterator": false,
"queryBuildersOnAllLevels": false
},
"resultsOptions": {
"overwrite": false,
"writeBOM": false
},
"doLog": "no",
"limitLogsCount": "0",
"keepUnique": "No",
"moreOptions": false,
"resultsPrepend": "",
"resultsAppend": "",
"queryBuilders": [],
"resultsBuilders": [],
"configOverrides": [],
"runTaskOnComplete": null,
"useResultsFileAsQueriesFile": false,
"runTaskOnCompleteConfig": "default",
"toolsJS": "",
"prio": 5,
"removeOnComplete": false,
"callURLOnComplete": "",
"queriesFile": [
"queries/Text Document.txt"
]
}
}

Example Response

{
"success": 1,
"data": "5432"
}

Starting a Previously Saved Task

You can start a preset created in advance through the interface. In this case, you only need to specify the queries. You can also override any of the task parameters; they will be used on top of the values in the preset.

Example Request

{
"password": "pass",
"action": "addTask",
"data": {
"queriesFrom": "text",
"queries": [
"google.com",
"yandex.ru"
],
"configPreset": "default",
"preset": "Analyze Domains"
}
}

Example Response

{
"success": 1,
"data": "5436"
}

removeOnRestart Flag

This flag indicates that tasks will be deleted upon scraper restart.

Example Request

{
"password": "pass",
"action": "addTask",
"data": {
"queriesFrom": "text",
"queries": [
"google.com",
"yandex.ru"
],
"configPreset": "default",
"preset": "Analyze Domains",
"removeOnRestart": 1
}
}

Example Response

{
"success": 1,
"data": "5437"
}

removeOnComplete Flag

This flag indicates that tasks will be deleted upon completion.

Example Request

{
"password": "pass",
"action": "addTask",
"data": {
"queriesFrom": "text",
"queries": [
"google.com",
"yandex.ru"
],
"configPreset": "default",
"preset": "Analyze Domains",
"removeOnComplete": 1
}
}

Example Response

{
"success": 1,
"data": "5438"
}

info

Retrieving general information about the A-Parser status and retrieving a list of all available scrapers.

tip

You can get the current A-Parser version number directly via the link: https://a-parser.com/members/versions

Example: {"lastBetaVersion":"1.2.1484","lastAlphaVersion":"1.2.1484","lastVersion":"1.2.1432"}

Example Request

{
"password": "pass",
"action": "info"
}

Example Response

{
"success": 1,
"data": {
"tasksInQueue": 0,
"pid": "13968",
"activeProxyCheckerThreads": 0,
"workingTasks": 0,
"activeThreads": 0,
"version": "1.2.1151",
"availableParsers": [
"API::Server::Redis",
"Check::BackLink",
"Check::RosKomNadzor",
"DeepL::Translator",
"GooglePlay::Apps",
"HTML::EmailExtractor",
...
"Util::AntiGate",
"Util::ReCaptcha2",
"Util::YandexRecognize"
]
}
}

getParserPreset

Retrieving the settings of the specified scraper and preset.

tip

This method can be used to get a complete list of parameters for use in other API requests.

Example Request

{
"password": "pass",
"action": "getParserPreset",
"data": {
"parser": "SE::Google",
"preset": "default"
}
}

Example Response

{
"success": 1,
"data": {
"queryformat": "$query",
"parsenotfound": 1,
"reCaptchaRetries": 3,
"pagecount": 5,
"gl": "",
"proxyChecker": "*",
"hl": "en",
"domain": "www.google.com",
"timeout": 60,
"Util_ReCaptcha2_preset": "default",
"useproxy": 1,
"nfpr": 0,
"extraquery": "",
"serptime": "all",
"location": "",
"usesessions": 1,
"filter": 1,
"linksperpage": 100,
"dontTakeSession": 0,
"addHeaders": "",
"serp": "",
"proxyretries": 10,
"device": "desktop",
"requestdelay": 0,
"debug_nonexists_domains": 0,
"proxybannedcleanup": 600,
"formatresult": "$serp.format('$link\\n')",
"reCaptchaPassProxy": 0,
"lr": ""
}
}

getProxies

Requesting a list of live proxies. Returns a list of live proxies from all proxy checkers.

Example Request

{
"password": "pass",
"action": "getProxies"
}

Example Response

{
"success": 1,
"data": {
"127.0.0.1:23486": [
"socks"
],
"127.0.0.1:23140": [
"socks"
],
"127.0.0.1:21971": [
"http"
]
}
}

IP:port the proxy will be indicated as the array name. The first element of the array is the proxy type, which can take 3 values - http, socks, socks4. If login/password authorization is specified, the second and third elements will be the login and password.

You can also get a list of proxies only from specific proxy checkers. To do this, you need to additionally pass an array of checkers.

Example:

{
"password": "pass",
"action": "getProxies",
"data": {
"checkers": [
"Elite proxies",
"free proxies"
]
}
}

getTaskState

Retrieving the status of a task by its ID.

Example Request

{
"password": "pass",
"action": "getTaskState",
"data": {
"taskUid": "181"
}
}

Example Response

{
"success": 1,
"data": {
"status": "completed",
"stats": "<b>Overall stats</b><br>Runtime: 0:00:19<br>HTTP requests: 464<br><br><b>1. HTML::LinkExtractor</b><br>Queries done: 254<br>Successful queries: 252<br>Proxies used: 0 (per query)<br>Retries used: 1.07 (per query)<br>HTTP requests: 1.82 (per query)",
"state": {
"totalFail": 2,
"totalWaitProxyThreads": 0,
"minimized": 0,
"queriesDoneCount": 254,
"avgSpeed": 802,
"activeThreads": 0,
"startTime": 1507281122,
"changeTime": 1507281141,
"queriesCount": 1,
"logExists": 0,
"runTime": 19,
"uniqueResultsCount": 656,
"requests": "464",
"addTime": 1507281120,
"additionalCount": 253,
"queriesDoneCountAtStart": 0,
"lastQuery": "https://www.nytimes.com/ref/membercenter/help/infoservdirectory.html",
"curSpeed": 846,
"started": 1,
"resultsCount": 31079
}
}
}

The response returns the task status (status) and its statistics (state).

You can also get information about several tasks at once; to do this, you need to pass an array of IDs.

Example Request

{
"password": "pass",
"action": "getTaskState",
"data": {
"taskUid": [
"22",
"23",
"31"
]
}
}

In this case, the response will be an array with data for each task.

Example Response

{
"success": 1,
"data": [
{
"status": "completed",
"stats": "<b>Overall stats</b><br>Runtime: 0:00:01<br>HTTP requests: 0<br><br><b>1. SE::Bing</b><br>Queries done: 0<br>Successful queries: 0<br>Proxies used: 0 (per query)<br>Retries used: 0 (per query)<br>HTTP requests: 0 (per query)",
"state": {
"totalFail": 0,
"totalWaitProxyThreads": 0,
"minimized": 0,
"queriesDoneCount": 0,
"avgSpeed": 0,
"activeThreads": 0,
"startTime": 1507023540,
"changeTime": 1507023541,
"queriesCount": 1,
"logExists": 1,
"runTime": 1,
"uniqueResultsCount": 0,
"requests": 0,
"addTime": 1507023443,
"additionalCount": 0,
"queriesDoneCountAtStart": 0,
"lastQuery": "none",
"curSpeed": 0,
"started": 1,
"resultsCount": 0
}
},
...data for other tasks...
]
}

getTaskConf

Retrieving the task configuration by its ID.

Example Request

{
"password": "pass",
"action": "getTaskConf",
"data": {
"taskUid": "181"
}
}

Example Response

The response returns the task settings, including the resulting file name.

{
"success": 1,
"data": {
"parsers": [
[
"SE::Bing",
"default",
{
"value": 1,
"type": "override",
"id": "pagecount"
}
]
],
"resultsFileName": "Mar-05_13-12-23.txt",
"runTaskOnComplete": null,
"limitLogsCount": "0",
"resultsPrepend": "",
"origResultsFileName": "$datefile.format().txt",
"queriesFrom": "text",
"runTaskOnCompleteConfig": "default",
"doLog": "db",
"useResultsFileAsQueriesFile": 0,
"additionalFormats": [],
"resultsSaveTo": "file",
"callURLOnComplete": "",
"resultsFormat": "$p1.related.format('$key\\n')",
"queryBuilders": [],
"preset": "default",
"resultsAppend": "",
"uniqueQueries": 0,
"keepUnique": 0,
"prio": "5",
"saveFailedQueries": 0,
"configPreset": "100 Threads",
"queries": [
"test"
],
"toolsJS": "",
"moreOptions": 0,
"resultsBuilders": [],
"resultsUnique": "string",
"iteratorOptions": {
"onAllLevels": 0,
"queryBuildersAfterIterator": 0,
"queryBuildersOnAllLevels": 0
},
"removeOnComplete": 0,
"queryFormat": [
"$query"
],
"configOverrides": [],
"resultsOptions": {
"overwrite": 0,
"writeBOM": 0
}
}
}

getTaskResultsFile

Getting a download link for the result by task ID. The file can only be downloaded once via the received link without authorization (a one-time token is used).

note

Works only with a static file name and $datefile.format(). To convert a dynamic result file name to a static one, you can use the template engine flag isStaticTemplate()

Example Request

{
"password": "pass",
"action": "getTaskResultsFile",
"data": {
"taskUid": "181"
}
}

Example Response

{
"success": 1,
"data": "http://127.0.0.1:9091/downloadResults?fileName=Mar-05_13-12-23.txt&token=wbvwlkes"
}

getTasksList

Retrieving a list of active tasks. If you pass the additional parameter completed: 1, you will get a list of completed tasks.

Example Request

{
"password": "pass",
"action": "getTasksList",
"data": {
"completed": "1"
}
}

Example Response

{
"success": 1,
"data": [
"2291",
"2324",
"2331",
"2384",
"2398",
"2434",
"2445",
"3482",
...
]
}

getParserInfo

Outputs a list of all available results that the specified scraper can return.

Example Request

{
"password" : "pass",
"action" : "getParserInfo",
"data" : {
"parser" : "SE::Google"
}
}

Example Response

{
"success": 1,
"data": {
"results": {
"arrays": {
"ads": [
"Ads list",
[
[
"link",
"Link"
],
...
]
],
"related": [
"Related keywords",
[
[
"key",
"Key"
]
]
],
"rich": [
"Rich snippets list",
[
[
"name",
"Name"
]
]
],
"serp": [
"Main serp list",
[
[
"link",
"Link"
],
...
]
],
"pages": [
"Raw data array",
[
[
"data",
"Raw data"
]
]
]
},
"flat": [
[
"query",
"Formatted query"
],
...
]
}
}
}

getAccountsCount

Retrieving the number of active Yandex accounts.

Example Request

{
"password": "pass",
"action": "getAccountsCount"
}

Example Response

{
"success": 1,
"data": {
"SE::Yandex": 18
}
}

deleteTaskResultsFile

Deleting the result file by task ID.

Example Request

{
"password": "pass",
"action": "deleteTaskResultsFile",
"data": {
"taskUid": "181"
}
}

Example Response

{
"success": 1
}

changeTaskStatus

Changing the status of a task by its ID. There are only 4 states a task can be transferred to:

  • starting - starting the task
  • pausing - pausing the task
  • stopping - stopping the task
  • deleting - deleting the task

Example Request

{
"password": "pass",
"action": "changeTaskStatus",
"data": {
"taskUid": "181",
"toStatus": "deleting"
}
}

Example Response

{
"success": 1
}

changeProxyCheckerState

Changing the status of a proxy checker (1 - enabled / 0 - disabled).

Example Request

{
"password": "pass",
"action": "changeProxyCheckerState",
"data": {
"checker": "proxychecker name",
"state": 1
}
}

Example Response

{
"success": 1
}

moveTask

Moving a task in the queue by its ID. Possible movement directions:

  • start - to the beginning of the queue
  • end - to the end of the queue
  • up - one position up
  • down - one position down

Example Request

{
"password": "pass",
"action": "moveTask",
"data": {
"taskUid": "181",
"direction": "start"
}
}

Example Response

{
"success": 1
}

update

Updates the scraper executable file to the latest available version. After the command is sent, A-Parser will automatically restart. The API will return a success response after it downloads and updates the executable file, which may take 1-3 minutes.

Example Request

{
"password": "pass",
"action": "update"
}

Example Response

{
"success": 1
}