mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Fix commonjs import method (#16297)
This commit is contained in:
committed by
Mohamed Hegazy
parent
e93d87a899
commit
2e9178c4b5
Vendored
+6
-2
@@ -43,8 +43,12 @@ declare namespace websiteScraper {
|
||||
interface Callback {
|
||||
(error: any | null, result: Resource[] | null): void;
|
||||
}
|
||||
function scrape(options: Options, callback: Callback): void;
|
||||
function scrape(options: Options): Promise<Resource[]>;
|
||||
interface scrape {
|
||||
(options: Options, callback: Callback): void;
|
||||
(options: Options): Promise<Resource[]>;
|
||||
}
|
||||
}
|
||||
|
||||
declare var websiteScraper: websiteScraper.scrape;
|
||||
|
||||
export = websiteScraper;
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
import * as scraper from 'website-scraper';
|
||||
import * as scraper from "website-scraper";
|
||||
|
||||
scraper.scrape({
|
||||
scraper({
|
||||
urls: [
|
||||
'http://nodejs.org/',
|
||||
{url: 'http://nodejs.org/about', filename: 'about.html'},
|
||||
{url: 'http://blog.nodejs.org/', filename: 'blog.html'}
|
||||
"http://nodejs.org/",
|
||||
{ url: "http://nodejs.org/about", filename: "about.html" },
|
||||
{ url: "http://blog.nodejs.org/", filename: "blog.html" }
|
||||
],
|
||||
directory: '/path/to/save',
|
||||
directory: "/path/to/save",
|
||||
subdirectories: [
|
||||
{directory: 'img', extensions: ['.jpg', '.png', '.svg']},
|
||||
{directory: 'js', extensions: ['.js']},
|
||||
{directory: 'css', extensions: ['.css']}
|
||||
{ directory: "img", extensions: [".jpg", ".png", ".svg"] },
|
||||
{ directory: "js", extensions: [".js"] },
|
||||
{ directory: "css", extensions: [".css"] }
|
||||
],
|
||||
sources: [
|
||||
{selector: 'img', attr: 'src'},
|
||||
{selector: 'link[rel="stylesheet"]', attr: 'href'},
|
||||
{selector: 'script', attr: 'src'}
|
||||
{ selector: "img", attr: "src" },
|
||||
{ selector: "link[rel=\"stylesheet\"]", attr: "href" },
|
||||
{ selector: "script", attr: "src" }
|
||||
],
|
||||
request: {
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19'
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D)\
|
||||
AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"
|
||||
}
|
||||
}
|
||||
}).then(function (result) {
|
||||
}).then(function(result) {
|
||||
console.log(result);
|
||||
}).catch(function(err){
|
||||
}).catch(function(err) {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user