-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscrape.js
37 lines (28 loc) · 937 Bytes
/
scrape.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Shopee Product Scraper
* @author Fazxid | https://github.com/fazxid/shopee-product-scraper
*/
const path = require('path');
const { exit } = require('process');
const shopeeScraper = require('./lib/node-shopee-scraper');
const scrape = new shopeeScraper({
mainUrl : 'https://shopee.co.id/',
userAgent : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36',
savePath : path.join(__dirname, './storage/'),
headless : true,
extract : ['data','image']
})
if(process.argv[2]!==undefined) {
(async () => {
try {
let response = await scrape.go(process.argv[2].toString())
console.log(`\n\n`)
console.log(response)
exit()
} catch (err) {
console.log(err)
}
})();
} else {
console.log(`Argument not valid`)
}