quickscraper-sdk
Advanced tools
@@ -7,3 +7,3 @@ "use strict"; | ||
BASE_URL: process.env.QS_BASE_URL || 'https://api.quickscraper.co/', | ||
VERSION: process.env.npm_package_version || '2.0.6' // Increase version when you increase in package.json | ||
VERSION: process.env.npm_package_version || '2.0.7' // Increase version when you increase in package.json | ||
}; |
{ | ||
"name": "quickscraper-sdk", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "Quick Scraper SDK NodeJS APIs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -101,5 +101,6 @@ # Quick Scraper NodeJS SDK | ||
const response = await QuickScraperClient.getHtml("https://httpbin.org/headers", { | ||
keep_headers: true, | ||
//This field is added to set cookis,authorizarion token etc from request header. | ||
keep_headers: true,//This value will be true when we want to use header | ||
headers: { | ||
"X-My-Custom-Header": "QS-APP", | ||
"X-My-Custom-Header": "QS-APP",//Supports values like `'Accept-Encoding': 'gzip,deflate,compress'` | ||
}, | ||
@@ -116,3 +117,3 @@ }); | ||
const response = await QuickScraperClient.getHtml("http://httpbin.org/ip", { | ||
country_code: "US", | ||
country_code: "US", //Add your Geotargeting country which you are selecting from request page,for example, for Canada value like `CA`,for China value like `CN` | ||
}); | ||
@@ -129,3 +130,3 @@ console.log(response); | ||
const response = await QuickScraperClient.getHtml("http://httpbin.org/ip", { | ||
premium: true, | ||
premium: true,//Up or premium proxies will be picked | ||
}); | ||
@@ -152,3 +153,3 @@ console.log(response); | ||
const response = await QuickScraperClient.getHtml("http://httpbin.org/ip", { | ||
device_type: 'mobile' | ||
device_type: 'mobile' //Add value `mobile` if the device which you are using is mobile and no need to provide this option if want to scrap site as desktop view | ||
}); | ||
@@ -165,3 +166,3 @@ console.log(response); | ||
const response = await QuickScraperClient.getHtml("http://httpbin.org/ip", { | ||
parserSubscriptionId: 'YOUR_PARSER_SUBSCRIPTION_ID' | ||
parserSubscriptionId: 'YOUR_PARSER_SUBSCRIPTION_ID' //Get the parser subscription id from request page when you select parser and paste here, for example value like '4a0360ea-042a-555e-b214-e3054a400f2a' | ||
}); | ||
@@ -177,3 +178,3 @@ console.log(response); | ||
const response = await QuickScraperClient.getHtml("http://httpbin.org/ip", { | ||
webhookRequestId: 'WEBHOOK_REQUEST_ID' | ||
webhookRequestId: 'WEBHOOK_REQUEST_ID' //Get the webhook id from dashboard and paste here, for example value like `2233-34jkjsd-324jkds-3243kh` | ||
}); | ||
@@ -189,3 +190,3 @@ console.log(response); | ||
const response = await QuickScraperClient.getData("http://httpbin.org/ip", { | ||
parserSubscriptionId: 'YOUR_PARSER_SUBSCRIPTION_ID' | ||
parserSubscriptionId: 'YOUR_PARSER_SUBSCRIPTION_ID' //Get the parser subscription id from request page when you select parser and paste here, for example value like '4a0360ea-042a-555e-b214-e3054a400f2a' | ||
}); | ||
@@ -202,12 +203,13 @@ console.log(response); | ||
const response = await QuickScraperClient.getData("http://httpbin.org/ip", { | ||
//This field is added when we want to scrap data after login or sign up. | ||
formData: { | ||
formSelector: 'FORM_SELECTOR', | ||
submitButtonSelector: 'SUBMIT_BUTTON_SELECTOR', | ||
formSelectorScript: 'FORM_SELECTOR_SCRIPT', | ||
submitButtonSelectorScript: 'SUBMIT_BUTTON_SELECTOR_SCRIPT', | ||
formSelector: 'FORM_SELECTOR',//Supports values like `'form[class="unique_class"]'` | ||
submitButtonSelector: 'SUBMIT_BUTTON_SELECTOR',//Supports values like `'button[class="unique_class"]'` | ||
formSelectorScript: 'FORM_SELECTOR_SCRIPT',//Supports values like `document.getElementById("demo")` | ||
submitButtonSelectorScript: 'SUBMIT_BUTTON_SELECTOR_SCRIPT',//Supports values like `document.getElementById("demo")` | ||
formFields: [ | ||
{ | ||
value: 'VALUE_TO_PASS_IN_FORM', | ||
selectorScript: 'SELECT_INPUT', | ||
isScript: 'BOOLEAN' | ||
value: 'VALUE_TO_PASS_IN_FORM',//Add value of form input fields | ||
selectorScript: 'SELECT_INPUT',//Supports values like `'input[class="unique_class"]','span[class="unique_class"]'` | ||
isScript: 'BOOLEAN'//If your selector has JavaScript code then make this true | ||
} | ||
@@ -221,2 +223,3 @@ ] | ||
``` | ||
### Add dynamic inputs | ||
@@ -230,6 +233,7 @@ | ||
parserSubscriptionId: 'YOUR_PARSER_SUBSCRIPTION_ID', | ||
//These dynamic inputs field is required when some input fields are required to get data of page | ||
dynamicInputs: [ | ||
{ | ||
"name":"YOUR_INPUT_NAME", | ||
"value":"YOUR_VALUE" | ||
"name":"YOUR_INPUT_NAME",//Name stands for input name field like `Username`,`password`,`limit` etc | ||
"value":"YOUR_VALUE" //Value of name field like `abc`,`123456789`,`25` | ||
} | ||
@@ -241,2 +245,33 @@ ] | ||
### Actions | ||
```javascript | ||
const QuickScraper = require("quickscraper-sdk"); | ||
const QuickScraperClient = new QuickScraper(); | ||
QuickScraperClient.setAccessToken("YOUR_ACCESS_TOKEN"); | ||
const response = await QuickScraperClient.getHtml("https://www.hilton.com/en/locations/india/?WT.mc_id=zLADA0IN1MB2PSH3GGL4INTCRB5dkt6MULTIBR7en_&epid!_&ebuy!&&&&&gad_source=1&gclid=CjwKCAiAvJarBhA1EiwAGgZl0HWfZEaLc_HWhRFRxTT3gs8pwQvFZKtLPNMj3szkjCbFzlef4ox_XxoCGDYQAvD_BwE&gclsrc=aw.ds", { | ||
customSelectors: [{ | ||
"name": "YOUR_VALUE", //Name stands for action name and it supports only 2 actions like `waitForElement` and `click` | ||
'selectorScript': "YOUR_SELECTOR", //Supports values like `'a[href="google.com"]', 'span[class="unique_class"]', document.getElementById("demo")` | ||
'options': null, //This options support timeout feature only like `{"timeout":3000}` | ||
'isScript': false //If your selector has JavaScript code then make this true | ||
}], | ||
keepSelection: true | ||
}); | ||
console.log(response); | ||
``` | ||
### Scroll To Bottom Of The Page | ||
```javascript | ||
const QuickScraper = require("quickscraper-sdk"); | ||
const QuickScraperClient = new QuickScraper(); | ||
QuickScraperClient.setAccessToken("YOUR_ACCESS_TOKEN"); | ||
const response = await QuickScraperClient.getHtml("YOUR_REQUEST_URL", { | ||
isScroll: true, | ||
scrollTimeout: 1000 // Consider as milliseconds, Wait for start scraping | ||
}); | ||
console.log(response); | ||
``` | ||
## Do you need an expert? | ||
@@ -243,0 +278,0 @@ |
48454
6.68%270
14.89%