-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a2db82
commit 8c0f512
Showing
7 changed files
with
74 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
import fs from "fs" | ||
import optimist from "optimist" | ||
import { IOptions } from "./interface" | ||
const argv = optimist.argv | ||
|
||
import { Spider } from "./spider" | ||
import { getSpecSource } from "./utils" | ||
|
||
const args = process.argv.slice(2) | ||
const bookNames = argv._ as string[] | ||
const url = argv.source as string | ||
|
||
if (args[0] === "download") { | ||
const options: IOptions = {} | ||
|
||
if (url) { | ||
options.source = getSpecSource(url) | ||
} | ||
|
||
if (bookNames[0] === "download") { | ||
const download = fs.readFileSync("./download.txt", "utf-8").split("\r\n") | ||
download.forEach(item => { | ||
new Spider(item) | ||
new Spider(item, options) | ||
}) | ||
} else { | ||
args.forEach(item => { | ||
new Spider(item) | ||
bookNames.forEach(item => { | ||
new Spider(item, options) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,11 @@ | |
resolved "https://registry.nlark.com/@types/node/download/@types/node-15.3.1.tgz?cache=0&sync_timestamp=1621463831198&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-15.3.1.tgz#23a06b87eedb524016616e886b116b8fdcb180af" | ||
integrity sha1-I6Brh+7bUkAWYW6IaxFrj9yxgK8= | ||
|
||
"@types/optimist@^0.0.29": | ||
version "0.0.29" | ||
resolved "https://registry.nlark.com/@types/optimist/download/@types/optimist-0.0.29.tgz#a8873580b3a84b69ac1e687323b15fbbeb90479a" | ||
integrity sha1-qIc1gLOoS2msHmhzI7Ffu+uQR5o= | ||
|
||
"@types/signale@^1.4.1": | ||
version "1.4.1" | ||
resolved "https://registry.nlark.com/@types/signale/download/@types/signale-1.4.1.tgz?cache=0&sync_timestamp=1621243058878&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fsignale%2Fdownload%2F%40types%2Fsignale-1.4.1.tgz#6137a6fd7960b48703dd2793c5b795480368b246" | ||
|
@@ -247,13 +252,26 @@ make-error@^1.1.1: | |
resolved "https://registry.npm.taobao.org/make-error/download/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" | ||
integrity sha1-LrLjfqm2fEiR9oShOUeZr0hM96I= | ||
|
||
minimist@~0.0.1: | ||
version "0.0.10" | ||
resolved "https://registry.nlark.com/minimist/download/minimist-0.0.10.tgz?cache=0&sync_timestamp=1618846813226&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fminimist%2Fdownload%2Fminimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" | ||
integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= | ||
|
||
nth-check@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.nlark.com/nth-check/download/nth-check-2.0.0.tgz#1bb4f6dac70072fc313e8c9cd1417b5074c0a125" | ||
integrity sha1-G7T22scAcvwxPoyc0UF7UHTAoSU= | ||
dependencies: | ||
boolbase "^1.0.0" | ||
|
||
optimist@^0.6.1: | ||
version "0.6.1" | ||
resolved "https://registry.npm.taobao.org/optimist/download/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" | ||
integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= | ||
dependencies: | ||
minimist "~0.0.1" | ||
wordwrap "~0.0.2" | ||
|
||
p-limit@^1.1.0: | ||
version "1.3.0" | ||
resolved "https://registry.nlark.com/p-limit/download/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" | ||
|
@@ -367,6 +385,11 @@ typescript@^4.2.4: | |
resolved "https://registry.nlark.com/typescript/download/typescript-4.2.4.tgz?cache=0&sync_timestamp=1621581792911&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftypescript%2Fdownload%2Ftypescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961" | ||
integrity sha1-hhC1l0feAo/aiYqK7w4QPxVtCWE= | ||
|
||
wordwrap@~0.0.2: | ||
version "0.0.3" | ||
resolved "https://registry.npm.taobao.org/wordwrap/download/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" | ||
integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= | ||
|
||
[email protected]: | ||
version "3.1.1" | ||
resolved "https://registry.npm.taobao.org/yn/download/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" | ||
|