21 Commits

Author SHA1 Message Date
Godzil
eb15d7d854 1.3.4 2018-07-30 22:47:36 +01:00
Godzil
66670547b9 Add a crude debug mechanism 2018-07-30 22:47:36 +01:00
Godzil
987e424324 Force an exit if authentication failed! 2018-07-30 22:47:35 +01:00
Godzil
523c780b18 Force to use a user account 2018-07-30 22:47:35 +01:00
Godzil
6c2100fbff Give access to the config objet to the subtitles for future changes. 2018-07-30 22:47:35 +01:00
Godzil
f10bead0dc Remove episode and volume filter, they were buggy and useless.
Use the @URL syntax do download a single episode.
2018-07-30 22:47:35 +01:00
Godzil
6448f4ec97 1.3.3 2018-07-30 22:47:35 +01:00
Godzil
829bb080ee Small update on the bug report template 2018-07-30 22:47:35 +01:00
Godzil
5edd7cf05a Fix 4 silly bugs 2018-07-30 22:47:35 +01:00
Godzil
8cf70e57cf 1.3.2 2018-07-30 22:47:34 +01:00
Godzil
2545c36241 Remove more DEP005 warning 2018-07-30 22:47:34 +01:00
Godzil
e2a4ba738f Make during series fetching error reporting a bit more clear 2018-07-30 22:47:34 +01:00
Godzil
e4e0fc3ea7 More error stack issue 2018-07-30 22:47:34 +01:00
Godzil
c56998312c Forgot to update config object with the new generated file name 2018-07-30 22:47:34 +01:00
Godzil
3ac1f4ee9e Don't display error stack when not needed, and if needed check it exist
before trying to display it.
2018-07-30 22:47:34 +01:00
Godzil
c2e9449630 Change the readme file, and add some templates for issue tracking and pull requests 2018-07-30 22:47:34 +01:00
Manoël Trapier
fb14020a7f Add issue templates 2018-07-30 22:47:34 +01:00
Godzil
5a51d888b8 Remove DEP0005 warning from use of the Buffer object 2018-07-30 22:47:34 +01:00
Godzil
301fa1c860 Remove dependencies on fs and only use fs-extra 2018-07-30 22:47:34 +01:00
Godzil
7e32028195 Update some packages 2018-07-30 22:47:34 +01:00
Godzil
dea2c38dc4 Upgrade some packages 2018-07-30 22:47:33 +01:00
18 changed files with 394 additions and 306 deletions

0
.github/CONTRIBUTING.md vendored Normal file
View File

32
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Please fill theses informations:**
(Add a X between brackets to make them ticked)
- OS: [e.g:. Windows 10, Mac OS X 10.13, ...]
- [ ] I'm using the latest version of Crunchy
- [ ] I have a premium accrount on CR
- Serie you get a problem with (and specify which episode if it is specific to one):
- The command line you are running Crunchy with:
- The message Crunchy is giving you, if any:
**Please be careful to remove your real account login and password if they appear!**
**Additional context**
Add any other context about the problem here.
_Also don't hesitate to add labels you feel apropriate on your report._

View File

@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

11
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,11 @@
*Goal for this pull request*
A clear and concise description of pull request
### Checklist
[ ] I've run `npm run compile` and it produce no error
[ ] I've run `npm run test` and it produce no error
[ ] I've not pushing more than one feature in that pull request
[ ] My branch is updated with the latest from main when I make that pull request
[ ] I've tested as much as I can my changes

View File

@@ -66,18 +66,22 @@ The [command-line interface](http://en.wikipedia.org/wiki/Command-line_interface
Options:
-h, --help output usage information
-V, --version output the version number
-p, --pass <s> The password.
-u, --user <s> The e-mail address or username.
-c, --cache Disables the cache.
-m, --merge Disables merging subtitles and videos.
-e, --episode <i> The episode filter.
-v, --volume <i> The volume filter.
-f, --format <s> The subtitle format. (Default: ass)
-o, --output <s> The output path.
-s, --series <s> The series override.
-t, --tag <s> The subgroup. (Default: CrunchyRoll)
-V, --version output the version number
-p, --pass <s> The password.
-u, --user <s> The e-mail address or username.
-c, --cache Disables the cache.
-m, --merge Disables merging subtitles and videos.
-f, --format <s> The subtitle format. (Default: ass)
-o, --output <s> The output path.
-s, --series <s> The series override.
-n, --filename <s> The name override.
-t, --tag <s> The subgroup. (Default: CrunchyRoll) (default: CrunchyRoll)
-r, --resolution <s> The video resolution. (Default: 1080 (360, 480, 720, 1080)) (default: 1080)
-g, --rebuildcrp Rebuild the crpersistant file.
-b, --batch <s> Batch file (default: CrunchyRoll.txt)
--verbose Make tool verbose
--retry <i> Number or time to retry fetching an episode. Default: 5 (default: 5)
-h, --help output usage information
#### Batch-mode
@@ -97,7 +101,7 @@ Download *Fairy Tail* to `C:\Anime`:
crunchy --output C:\Anime http://www.crunchyroll.com/fairy-tail
#### Switches
#### Command line parameters
##### Authentication
@@ -108,20 +112,24 @@ Download *Fairy Tail* to `C:\Anime`:
##### Disables
* `-c or --cache` disables the cache.
* `-c or --cache` disables the cache in batch mode.
* `-m or --merge` disables merging subtitles and videos.
##### Filters
* `-e or --episode <i>` filters episodes (positive is greater than, negative is smaller than).
* `-v or --volume <i>` filters volumes (positive is greater than, negative is smaller than).
##### Settings
* `-f or --format <s>` sets the subtitle format. (Default: ass)
* `-o or --output <s>` sets the output path.
* `-s or --series <s>` sets the series override.
* `-t or --tag <s>` sets The subgroup. (Default: CrunchyRoll)
* `-r or --resolution <s>` sets the resolutoin you want to download (360, 480, 720, 1080)
* `--retry <i>` set the number of try Crunchy will use if downloading a serie or episode fail
##### Others
* `-b or --batch <s>` specify the batch file to use. Default to "CrunchyRoll.txt"
* `--verbose` make Crunchy really verbose. You should use it only for bug reporting or to try to see why it does not work
* `-g or --rebuildcrp` use that parameter only if the .crpersistent file has been corrupted and Crunchy try to redownload everything. It will try to rebuild the cache file from the file if find. If you renamed of move any file they will be ignored and not added to the cache file.
## When things goes wrong
@@ -131,27 +139,14 @@ Second thing to check, you have to give your credentials (-u and -p parameters)
Third, is it a recently released episode? If yes, sometimes CR have issues were the requested format is not available, and Crunchy is not able to get it. When in doubt, try to watch CR website, if it does not work there, Crunchy will not either. This is valid in all cases even on non recently released.
Fourth, sometimes, CR website does weird things, and there are some transient errors, wait a couple of minutes (or hours) and try again. It often solved the issue on my side (yes I know that's not really a way of fixing, but if the error is on CR side, Crunchy can't do anything)
Fourth, sometimes, CR website does weird things, and there are some transient errors, wait a couple of minutes (or hours) and try again. It has really often solved lots of weird issue on my side (yes I know that's not really a way of fixing, but if the error is on CR side, Crunchy can't do anything)
If really nothing works or you find a problem with Crunchy, then you can go and fill an Issue, first read the already open and closed one to make sure you are not reporting an existing problem. If your problem has been already reported, what you can do is to either:
- Add a comment saying you also have the same issue
- Add a Thumbs Up reaction to the original entry in the issue, they will are used as a metric to know how many people are annoyed by that issue
If you find one which correspond and is close, don't hesitate to add a comment, the issue may have not be fully solved.
- Add a Thumbs Up reaction to the original entry in the issue, I use them as a metric to know how many people are annoyed by that issue
If you find one which correspond and it is close, don't hesitate to add a comment, the issue may have not be fully solved.
If there is no comparable opened or close issue, you can create a new one.
### What to put in a bug report
It is really important for me to know:
- on which Operating System you are running Crunchy,
- which anime you want to fetch if it is related to a specific one,
- The command line you use to run Crunchy
- What message Crunchy is giving you if any
**Please be careful to remove your real account login and password if they appear!**
Also don't hesitate to add labels you feel apropriate on your report.
_Note: You can also use a bug report for a feature requests._
If there is no comparable opened or close issue, you are welcome to create a new one.
## Developers
@@ -159,9 +154,5 @@ More information will be added at a later point. For now the recommendations are
* Atom with `atom-typescript` and `linter-tslint` (and dependencies).
Since this project uses TypeScript, compile with `node ts` or `npm install`.
Since this project uses TypeScript, compile with `node run compile` to build the tool and `npm run test` to run the linter.
#### A note about pull requests:
If you want to help working on this project, Pull request are welcome, but please explain the goal of your changes, and do a pull request per change: you want to add support for _X_, _Y_ and _Z_, make a pull request for X, one for Y and one for Z. I'm not saying a pull request per commit that would be idiotic.
The idea is if your pull request changes lots of thing at the same time, if just a single part can't be accepted, if will delay the acceptation of the whole pull request where some of the feature could be integrated quicker is they were requested alone.
Also if for example the change _Y_ depends on _X_, you can wait for _X_ to be accepted before requesting for _Y_, if they are independant you can send a pull request for each at the same time.

402
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "crunchy",
"version": "1.3.1",
"version": "1.3.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -22,22 +22,28 @@
"integrity": "sha512-+T9qBbqe/jXtTjzVddArZExahoPPmt8eq3O1ZuCKZXjBVxf/ciUYNXrIDZJEVgYvpELnv6VlPRCfLzufRxpAag==",
"dev": true
},
"@types/events": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz",
"integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==",
"dev": true
},
"@types/form-data": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz",
"integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==",
"dev": true,
"requires": {
"@types/node": "8.5.2"
"@types/node": "*"
}
},
"@types/fs-extra": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.2.tgz",
"integrity": "sha512-Q3FWsbdmkQd1ib11A4XNWQvRD//5KpPoGawA8aB2DR7pWKoW9XQv3+dGxD/Z1eVFze23Okdo27ZQytVFlweKvQ==",
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.3.tgz",
"integrity": "sha512-m2QKoRrJnei1s10e1ZfMIa7QcABBVLdQhVUv5+bMRaHhPzxO/IWMmREiags59AqFbI+piWPq/PupTahNS/0kyA==",
"dev": true,
"requires": {
"@types/node": "8.5.2"
"@types/node": "*"
}
},
"@types/mkdirp": {
@@ -46,25 +52,24 @@
"integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==",
"dev": true,
"requires": {
"@types/node": "8.5.2"
"@types/node": "*"
}
},
"@types/node": {
"version": "8.5.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.2.tgz",
"integrity": "sha512-KA4GKOpgXnrqEH2eCVhiv2CsxgXGQJgV1X0vsGlh+WCnxbeAE1GT44ZsTU1IN5dEeV/gDupKa7gWo08V5IxWVQ==",
"dev": true
"version": "10.3.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.3.3.tgz",
"integrity": "sha512-/gwCgiI2e9RzzZTKbl+am3vgNqOt7a9fJ/uxv4SqYKxenoEDNVU3KZEadlpusWhQI0A0dOrZ0T68JYKVjzmgdQ=="
},
"@types/request": {
"version": "2.47.0",
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.47.0.tgz",
"integrity": "sha512-/KXM5oev+nNCLIgBjkwbk8VqxmzI56woD4VUxn95O+YeQ8hJzcSmIZ1IN3WexiqBb6srzDo2bdMbsXxgXNkz5Q==",
"version": "2.47.1",
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.47.1.tgz",
"integrity": "sha512-TV3XLvDjQbIeVxJ1Z3oCTDk/KuYwwcNKVwz2YaT0F5u86Prgc4syDAp6P96rkTQQ4bIdh+VswQIC9zS6NjY7/g==",
"dev": true,
"requires": {
"@types/caseless": "0.12.1",
"@types/form-data": "2.2.1",
"@types/node": "8.5.2",
"@types/tough-cookie": "2.3.2"
"@types/caseless": "*",
"@types/form-data": "*",
"@types/node": "*",
"@types/tough-cookie": "*"
}
},
"@types/request-promise": {
@@ -73,23 +78,24 @@
"integrity": "sha512-qlx6COxSTdSFHY9oX9v2zL1I05hgz5lwqYiXa2SFL2nDxAiG5KK8rnllLBH7k6OqzS3Ck0bWbxlGVdrZhS6oNw==",
"dev": true,
"requires": {
"@types/bluebird": "3.5.20",
"@types/request": "2.47.0"
"@types/bluebird": "*",
"@types/request": "*"
}
},
"@types/tough-cookie": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.2.tgz",
"integrity": "sha512-vOVmaruQG5EatOU/jM6yU2uCp3Lz6mK1P5Ztu4iJjfM4SVHU9XYktPUQtKlIXuahqXHdEyUarMrBEwg5Cwu+bA==",
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.3.tgz",
"integrity": "sha512-MDQLxNFRLasqS4UlkWMSACMKeSm1x4Q3TxzUC7KQUsh6RK1ZrQ0VEyE3yzXcBu+K8ejVj4wuX32eUG02yNp+YQ==",
"dev": true
},
"@types/xml2js": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.2.tgz",
"integrity": "sha1-pLhLOHn/1HEJU/2Syr/emopOhFY=",
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.3.tgz",
"integrity": "sha512-Pv2HGRE4gWLs31In7nsyXEH4uVVsd0HNV9i2dyASvtDIlOtSTr1eczPLDpdEuyv5LWH5LT20GIXwPjkshKWI1g==",
"dev": true,
"requires": {
"@types/node": "8.5.2"
"@types/events": "*",
"@types/node": "*"
}
},
"ajv": {
@@ -97,10 +103,10 @@
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"requires": {
"co": "4.6.0",
"fast-deep-equal": "1.1.0",
"fast-json-stable-stringify": "2.0.0",
"json-schema-traverse": "0.3.1"
"co": "^4.6.0",
"fast-deep-equal": "^1.0.0",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.3.0"
}
},
"ansi-regex": {
@@ -121,7 +127,7 @@
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "1.0.3"
"sprintf-js": "~1.0.2"
},
"dependencies": {
"sprintf-js": {
@@ -163,9 +169,9 @@
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
"dev": true,
"requires": {
"chalk": "1.1.3",
"esutils": "2.0.2",
"js-tokens": "3.0.2"
"chalk": "^1.1.3",
"esutils": "^2.0.2",
"js-tokens": "^3.0.2"
},
"dependencies": {
"chalk": {
@@ -174,11 +180,11 @@
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
"ansi-styles": "2.2.1",
"escape-string-regexp": "1.0.5",
"has-ansi": "2.0.0",
"strip-ansi": "3.0.1",
"supports-color": "2.0.0"
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
}
}
@@ -195,13 +201,13 @@
"integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
"optional": true,
"requires": {
"tweetnacl": "0.14.5"
"tweetnacl": "^0.14.3"
}
},
"big-integer": {
"version": "1.6.30",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.30.tgz",
"integrity": "sha512-LGDF7k/8yjS+GTbfFRGiSdcPnIwcjM6kQ0lmbja3tKJzVMmqHmUFnTuUOm/Lt2KVQ3mAZVupf9KNcsew0QV8Kw=="
"version": "1.6.31",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.31.tgz",
"integrity": "sha512-lDbZNHHwxDKnjP7LWg2leO+tjs4SyVs2Z83dsR1Idbe2urRnxZAUdeQ8YBhHaGaWK/4WM3mz+RlbZsgqck17CA=="
},
"bluebird": {
"version": "3.5.1",
@@ -219,7 +225,7 @@
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
"dev": true,
"requires": {
"balanced-match": "1.0.0",
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
@@ -240,9 +246,9 @@
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
"dev": true,
"requires": {
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5",
"supports-color": "5.4.0"
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"dependencies": {
"ansi-styles": {
@@ -251,7 +257,7 @@
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "1.9.1"
"color-convert": "^1.9.0"
}
},
"supports-color": {
@@ -260,7 +266,7 @@
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"dev": true,
"requires": {
"has-flag": "3.0.0"
"has-flag": "^3.0.0"
}
}
}
@@ -270,22 +276,22 @@
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz",
"integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=",
"requires": {
"css-select": "1.2.0",
"dom-serializer": "0.1.0",
"entities": "1.1.1",
"htmlparser2": "3.9.2",
"lodash.assignin": "4.2.0",
"lodash.bind": "4.2.1",
"lodash.defaults": "4.2.0",
"lodash.filter": "4.6.0",
"lodash.flatten": "4.4.0",
"lodash.foreach": "4.5.0",
"lodash.map": "4.6.0",
"lodash.merge": "4.6.0",
"lodash.pick": "4.4.0",
"lodash.reduce": "4.6.0",
"lodash.reject": "4.6.0",
"lodash.some": "4.6.0"
"css-select": "~1.2.0",
"dom-serializer": "~0.1.0",
"entities": "~1.1.1",
"htmlparser2": "^3.9.1",
"lodash.assignin": "^4.0.9",
"lodash.bind": "^4.1.4",
"lodash.defaults": "^4.0.1",
"lodash.filter": "^4.4.0",
"lodash.flatten": "^4.2.0",
"lodash.foreach": "^4.3.0",
"lodash.map": "^4.4.0",
"lodash.merge": "^4.4.0",
"lodash.pick": "^4.2.1",
"lodash.reduce": "^4.4.0",
"lodash.reject": "^4.4.0",
"lodash.some": "^4.4.0"
}
},
"cloudscraper": {
@@ -293,7 +299,7 @@
"resolved": "https://registry.npmjs.org/cloudscraper/-/cloudscraper-1.5.0.tgz",
"integrity": "sha512-bZagLhj59+N6Z6lD9zRksYu87GthLwXdKARULi4RZ6UVpotH39ruSFN3UQmw3uuqoj00iDxkGrapAvxeurmlQA==",
"requires": {
"request": "2.87.0"
"request": "^2.49.0"
}
},
"co": {
@@ -307,7 +313,7 @@
"integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==",
"dev": true,
"requires": {
"color-name": "1.1.3"
"color-name": "^1.1.1"
}
},
"color-name": {
@@ -327,7 +333,7 @@
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
"requires": {
"delayed-stream": "1.0.0"
"delayed-stream": "~1.0.0"
}
},
"commander": {
@@ -351,10 +357,10 @@
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
"integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=",
"requires": {
"boolbase": "1.0.0",
"css-what": "2.1.0",
"boolbase": "~1.0.0",
"css-what": "2.1",
"domutils": "1.5.1",
"nth-check": "1.0.1"
"nth-check": "~1.0.1"
}
},
"css-what": {
@@ -367,7 +373,7 @@
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"requires": {
"assert-plus": "1.0.0"
"assert-plus": "^1.0.0"
}
},
"delayed-stream": {
@@ -386,8 +392,8 @@
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz",
"integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=",
"requires": {
"domelementtype": "1.1.3",
"entities": "1.1.1"
"domelementtype": "~1.1.1",
"entities": "~1.1.1"
},
"dependencies": {
"domelementtype": {
@@ -407,7 +413,7 @@
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz",
"integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=",
"requires": {
"domelementtype": "1.3.0"
"domelementtype": "1"
}
},
"domutils": {
@@ -415,8 +421,8 @@
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz",
"integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=",
"requires": {
"dom-serializer": "0.1.0",
"domelementtype": "1.3.0"
"dom-serializer": "0",
"domelementtype": "1"
}
},
"ecc-jsbn": {
@@ -425,7 +431,7 @@
"integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
"optional": true,
"requires": {
"jsbn": "0.1.1"
"jsbn": "~0.1.0"
}
},
"entities": {
@@ -483,7 +489,7 @@
"integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=",
"dev": true,
"requires": {
"glob": "5.0.15"
"glob": "~5.0.0"
},
"dependencies": {
"glob": {
@@ -492,11 +498,11 @@
"integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=",
"dev": true,
"requires": {
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "2 || 3",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
}
}
@@ -511,9 +517,9 @@
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
"integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
"requires": {
"asynckit": "0.4.0",
"asynckit": "^0.4.0",
"combined-stream": "1.0.6",
"mime-types": "2.1.18"
"mime-types": "^2.1.12"
}
},
"fs-extra": {
@@ -521,9 +527,9 @@
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz",
"integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==",
"requires": {
"graceful-fs": "4.1.11",
"jsonfile": "4.0.0",
"universalify": "0.1.1"
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"fs.realpath": {
@@ -537,7 +543,7 @@
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"requires": {
"assert-plus": "1.0.0"
"assert-plus": "^1.0.0"
}
},
"glob": {
@@ -546,12 +552,12 @@
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"dev": true,
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"graceful-fs": {
@@ -569,8 +575,8 @@
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
"requires": {
"ajv": "5.5.2",
"har-schema": "2.0.0"
"ajv": "^5.1.0",
"har-schema": "^2.0.0"
}
},
"has-ansi": {
@@ -579,7 +585,7 @@
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": {
"ansi-regex": "2.1.1"
"ansi-regex": "^2.0.0"
}
},
"has-flag": {
@@ -593,12 +599,12 @@
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz",
"integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=",
"requires": {
"domelementtype": "1.3.0",
"domhandler": "2.4.1",
"domutils": "1.5.1",
"entities": "1.1.1",
"inherits": "2.0.3",
"readable-stream": "2.3.3"
"domelementtype": "^1.3.0",
"domhandler": "^2.3.0",
"domutils": "^1.5.1",
"entities": "^1.1.1",
"inherits": "^2.0.1",
"readable-stream": "^2.0.2"
}
},
"http-signature": {
@@ -606,9 +612,9 @@
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"requires": {
"assert-plus": "1.0.0",
"jsprim": "1.4.1",
"sshpk": "1.14.1"
"assert-plus": "^1.0.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
}
},
"inflight": {
@@ -617,8 +623,8 @@
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
@@ -653,8 +659,8 @@
"integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
"dev": true,
"requires": {
"argparse": "1.0.10",
"esprima": "4.0.0"
"argparse": "^1.0.7",
"esprima": "^4.0.0"
}
},
"jsbn": {
@@ -683,7 +689,7 @@
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"requires": {
"graceful-fs": "4.1.11"
"graceful-fs": "^4.1.6"
}
},
"jsprim": {
@@ -772,7 +778,7 @@
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
"integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
"requires": {
"mime-db": "1.33.0"
"mime-db": "~1.33.0"
}
},
"minimatch": {
@@ -781,7 +787,7 @@
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "1.1.8"
"brace-expansion": "^1.1.7"
}
},
"minimist": {
@@ -810,7 +816,7 @@
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.1.tgz",
"integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=",
"requires": {
"boolbase": "1.0.0"
"boolbase": "~1.0.0"
}
},
"oauth-sign": {
@@ -824,7 +830,7 @@
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1.0.2"
"wrappy": "1"
}
},
"optimist": {
@@ -833,8 +839,8 @@
"integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
"dev": true,
"requires": {
"minimist": "0.0.10",
"wordwrap": "0.0.3"
"minimist": "~0.0.1",
"wordwrap": "~0.0.2"
}
},
"path-is-absolute": {
@@ -879,13 +885,13 @@
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "1.0.7",
"safe-buffer": "5.1.1",
"string_decoder": "1.0.3",
"util-deprecate": "1.0.2"
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~1.0.6",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.0.3",
"util-deprecate": "~1.0.1"
}
},
"request": {
@@ -893,26 +899,26 @@
"resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz",
"integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==",
"requires": {
"aws-sign2": "0.7.0",
"aws4": "1.7.0",
"caseless": "0.12.0",
"combined-stream": "1.0.6",
"extend": "3.0.1",
"forever-agent": "0.6.1",
"form-data": "2.3.2",
"har-validator": "5.0.3",
"http-signature": "1.2.0",
"is-typedarray": "1.0.0",
"isstream": "0.1.2",
"json-stringify-safe": "5.0.1",
"mime-types": "2.1.18",
"oauth-sign": "0.8.2",
"performance-now": "2.1.0",
"qs": "6.5.2",
"safe-buffer": "5.1.1",
"tough-cookie": "2.3.4",
"tunnel-agent": "0.6.0",
"uuid": "3.2.1"
"aws-sign2": "~0.7.0",
"aws4": "^1.6.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.5",
"extend": "~3.0.1",
"forever-agent": "~0.6.1",
"form-data": "~2.3.1",
"har-validator": "~5.0.3",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.17",
"oauth-sign": "~0.8.2",
"performance-now": "^2.1.0",
"qs": "~6.5.1",
"safe-buffer": "^5.1.1",
"tough-cookie": "~2.3.3",
"tunnel-agent": "^0.6.0",
"uuid": "^3.1.0"
}
},
"request-promise": {
@@ -920,10 +926,10 @@
"resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.2.tgz",
"integrity": "sha1-0epG1lSm7k+O5qT+oQGMIpEZBLQ=",
"requires": {
"bluebird": "3.5.1",
"bluebird": "^3.5.0",
"request-promise-core": "1.1.1",
"stealthy-require": "1.1.1",
"tough-cookie": "2.3.4"
"stealthy-require": "^1.1.0",
"tough-cookie": ">=2.3.3"
}
},
"request-promise-core": {
@@ -931,7 +937,7 @@
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz",
"integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=",
"requires": {
"lodash": "4.17.10"
"lodash": "^4.13.1"
}
},
"resolve": {
@@ -940,7 +946,7 @@
"integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==",
"dev": true,
"requires": {
"path-parse": "1.0.5"
"path-parse": "^1.0.5"
}
},
"safe-buffer": {
@@ -970,14 +976,14 @@
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz",
"integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=",
"requires": {
"asn1": "0.2.3",
"assert-plus": "1.0.0",
"bcrypt-pbkdf": "1.0.1",
"dashdash": "1.14.1",
"ecc-jsbn": "0.1.1",
"getpass": "0.1.7",
"jsbn": "0.1.1",
"tweetnacl": "0.14.5"
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"bcrypt-pbkdf": "^1.0.0",
"dashdash": "^1.12.0",
"ecc-jsbn": "~0.1.1",
"getpass": "^0.1.1",
"jsbn": "~0.1.0",
"tweetnacl": "~0.14.0"
}
},
"stable": {
@@ -996,7 +1002,7 @@
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"requires": {
"safe-buffer": "5.1.1"
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
@@ -1005,7 +1011,7 @@
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
"ansi-regex": "2.1.1"
"ansi-regex": "^2.0.0"
}
},
"supports-color": {
@@ -1019,7 +1025,7 @@
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz",
"integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==",
"requires": {
"punycode": "1.4.1"
"punycode": "^1.4.1"
}
},
"tsconfig-lint": {
@@ -1028,11 +1034,11 @@
"integrity": "sha1-rVKxNGEjnRaYA56TrR3TS93WzUs=",
"dev": true,
"requires": {
"exit": "0.1.2",
"glob": "7.1.2",
"resolve": "1.4.0",
"stable": "0.1.6",
"tslint": "3.15.1"
"exit": "^0.1.2",
"glob": "^7.0.3",
"resolve": "^1.1.7",
"stable": "^0.1.5",
"tslint": "^3.6.0"
},
"dependencies": {
"tslint": {
@@ -1041,13 +1047,13 @@
"integrity": "sha1-2hZcqT2P3CwIa1EWXuG6y0jJjqU=",
"dev": true,
"requires": {
"colors": "1.1.2",
"diff": "2.2.3",
"findup-sync": "0.3.0",
"glob": "7.1.2",
"optimist": "0.6.1",
"resolve": "1.4.0",
"underscore.string": "3.3.4"
"colors": "^1.1.2",
"diff": "^2.2.1",
"findup-sync": "~0.3.0",
"glob": "^7.0.3",
"optimist": "~0.6.0",
"resolve": "^1.1.7",
"underscore.string": "^3.3.4"
}
}
}
@@ -1064,18 +1070,18 @@
"integrity": "sha1-EeJrzLiK+gLdDZlWyuPUVAtfVMM=",
"dev": true,
"requires": {
"babel-code-frame": "6.26.0",
"builtin-modules": "1.1.1",
"chalk": "2.4.1",
"commander": "2.15.1",
"diff": "3.5.0",
"glob": "7.1.2",
"js-yaml": "3.12.0",
"minimatch": "3.0.4",
"resolve": "1.4.0",
"semver": "5.5.0",
"tslib": "1.9.2",
"tsutils": "2.27.1"
"babel-code-frame": "^6.22.0",
"builtin-modules": "^1.1.1",
"chalk": "^2.3.0",
"commander": "^2.12.1",
"diff": "^3.2.0",
"glob": "^7.1.1",
"js-yaml": "^3.7.0",
"minimatch": "^3.0.4",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tsutils": "^2.12.1"
},
"dependencies": {
"diff": {
@@ -1092,7 +1098,7 @@
"integrity": "sha512-AE/7uzp32MmaHvNNFES85hhUDHFdFZp6OAiZcd6y4ZKKIg6orJTm8keYWBhIhrJQH3a4LzNKat7ZPXZt5aTf6w==",
"dev": true,
"requires": {
"tslib": "1.9.2"
"tslib": "^1.8.1"
}
},
"tunnel-agent": {
@@ -1100,7 +1106,7 @@
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"requires": {
"safe-buffer": "5.1.1"
"safe-buffer": "^5.0.1"
}
},
"tweetnacl": {
@@ -1110,9 +1116,9 @@
"optional": true
},
"typescript": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==",
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
"dev": true
},
"underscore.string": {
@@ -1121,8 +1127,8 @@
"integrity": "sha1-LCo/n4PmR2L9xF5s6sZRQoZCE9s=",
"dev": true,
"requires": {
"sprintf-js": "1.1.1",
"util-deprecate": "1.0.2"
"sprintf-js": "^1.0.3",
"util-deprecate": "^1.0.2"
}
},
"universalify": {
@@ -1145,9 +1151,9 @@
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"requires": {
"assert-plus": "1.0.0",
"assert-plus": "^1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "1.3.0"
"extsprintf": "^1.2.0"
}
},
"wordwrap": {
@@ -1167,8 +1173,8 @@
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"requires": {
"sax": "1.2.4",
"xmlbuilder": "9.0.4"
"sax": ">=0.6.0",
"xmlbuilder": "~9.0.1"
}
},
"xmlbuilder": {

View File

@@ -15,13 +15,14 @@
"engines": {
"node": ">=5.0"
},
"version": "1.3.1",
"version": "1.3.4",
"bin": {
"crunchy": "./bin/crunchy",
"crunchy.sh": "./bin/crunchy.sh"
},
"dependencies": {
"big-integer": "^1.6.30",
"@types/node": "^10.3.3",
"big-integer": "^1.6.31",
"bluebird": "^3.5.1",
"cheerio": "^0.22.0",
"cloudscraper": "^1.5.0",
@@ -36,14 +37,14 @@
"devDependencies": {
"@types/bluebird": "^3.5.20",
"@types/cheerio": "^0.22.7",
"@types/fs-extra": "^5.0.2",
"@types/fs-extra": "^5.0.3",
"@types/mkdirp": "^0.5.2",
"@types/request": "^2.47.0",
"@types/request": "^2.47.1",
"@types/request-promise": "^4.1.41",
"@types/xml2js": "^0.4.2",
"@types/xml2js": "^0.4.3",
"tsconfig-lint": "^0.12.0",
"tslint": "^5.10.0",
"typescript": "^2.9.1"
"typescript": "^2.9.2"
},
"scripts": {
"prepublishOnly": "npm run build",

View File

@@ -44,6 +44,17 @@ export default function(args: string[], done: (err?: Error) => void)
config.video_quality = resol_table['1080'].quality;
}
if (config.debug)
{
/* Ugly but meh */
const tmp = JSON.parse(JSON.stringify(config));
tmp.pass = 'obfuscated';
tmp.user = 'obfustated';
tmp.rawArgs = undefined;
tmp.options = undefined;
log.dumpToDebug('Config', JSON.stringify(tmp), true);
}
tasks(config, batchPath, (err, tasksArr) =>
{
if (err)
@@ -66,16 +77,18 @@ export default function(args: string[], done: (err?: Error) => void)
{
if (tasksArr[i].retry <= 0)
{
console.error(err.stack || err);
console.error(errin);
log.error('Cannot get episodes from "' + tasksArr[i].address + '", please rerun later');
/* Go to the next on the list */
i += 1;
}
else
{
if (config.verbose)
{
console.error(err.stack || err);
console.error(errin);
}
log.warn('Retrying to fetch episodes ' + tasksArr[i].retry + ' / ' + config.retry);
log.warn('Retrying to fetch episodes list from' + tasksArr[i].retry + ' / ' + config.retry);
tasksArr[i].retry -= 1;
}
}
@@ -190,9 +203,6 @@ function parse(args: string[]): IConfigLine
// Disables
.option('-c, --cache', 'Disables the cache.')
.option('-m, --merge', 'Disables merging subtitles and videos.')
// Filters
.option('-e, --episode <i>', 'The episode filter.')
.option('-v, --volume <i>', 'The volume filter.')
// Settings
.option('-f, --format <s>', 'The subtitle format. (Default: ass)')
.option('-o, --output <s>', 'The output path.')
@@ -204,6 +214,7 @@ function parse(args: string[]): IConfigLine
.option('-g, --rebuildcrp', 'Rebuild the crpersistant file.')
.option('-b, --batch <s>', 'Batch file', 'CrunchyRoll.txt')
.option('--verbose', 'Make tool verbose')
.option('--debug', 'Create a debug file. Use only if requested!')
.option('--retry <i>', 'Number or time to retry fetching an episode. Default: 5', 5)
.parse(args);
}

View File

@@ -26,7 +26,14 @@ batch(process.argv, (err: any) =>
{
if (err)
{
console.error(err.stack || err);
if (err.stack)
{
console.error(err.stack || err);
}
else
{
console.error(err);
}
process.exit(-1);
}
console.info('Done!');

View File

@@ -100,6 +100,8 @@ function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, d
} while (fileExist(filePath + '.mkv'));
log.warn('Renaming to \'' + fileName + '\'...');
config.filename = fileName;
}
if (config.rebuildcrp)
@@ -184,7 +186,7 @@ function downloadSubtitle(config: IConfig, player: IEpisodePlayer, filePath: str
const formats = subtitle.formats;
const format = formats[config.format] ? config.format : 'ass';
formats[format](data, (errF: Error, decodedSubtitle: string) =>
formats[format](config, data, (errF: Error, decodedSubtitle: string) =>
{
if (errF)
{

View File

@@ -5,9 +5,6 @@ interface IConfig {
// Disables
cache?: boolean;
merge?: boolean;
// Filters
episode?: number;
volume?: number;
// Settings
format?: string;
output?: string;
@@ -20,5 +17,6 @@ interface IConfig {
rebuildcrp?: boolean;
batch?: string;
verbose?: boolean;
debug?: boolean;
retry?: number;
}

View File

@@ -1,3 +1,3 @@
interface IFormatterTable {
[key: string]: (input: string|Buffer, done: (err: Error, subtitle?: string) => void) => void;
[key: string]: (config: IConfig, input: string|Buffer, done: (err: Error, subtitle?: string) => void) => void;
}

View File

@@ -1,7 +1,8 @@
'use strict';
import os = require('os');
import fs = require('fs-extra');
export function error(str: string)
export function error(str: string|Error)
{
/* Do fancy output */
console.error(' \x1B[1;31m* ERROR\x1B[0m: ' + str);
@@ -35,3 +36,20 @@ export function dispEpisode(name: string, status: string, addNL: boolean)
console.log('');
}
}
export function dumpToDebug(what: string, data: any, create = false)
{
if (create)
{
fs.writeFile('debug.txt', '>>>>>>>> ' + what + ':\n' + data + '\n<<<<<<<<\n', (err) =>
{
if (err) throw err;
});
return;
}
fs.appendFile('debug.txt', '>>>>>>>> ' + what + ':\n' + data + '\n<<<<<<<<\n', (err) =>
{
if (err) throw err;
});
}

View File

@@ -127,9 +127,15 @@ export function post(config: IConfig, options: request.Options, done: (err: Erro
*/
function authenticate(config: IConfig, done: (err: Error) => void)
{
if (isAuthenticated || !config.pass || !config.user)
if (isAuthenticated)
{
return done(null);
return done(null);
}
if (!config.pass || !config.user)
{
log.error('You need to give login/password to use Crunchy');
process.exit(-1);
}
startSession()
@@ -181,7 +187,8 @@ function authenticate(config: IConfig, done: (err: Error) => void)
if (isAuthenticated === false)
{
const error = $('ul.message, li.error').text();
return done(new Error('Authentication failed: ' + error));
log.error('Authentication failed: ' + error);
process.exit(-1);
}
if (isPremium === false)
@@ -190,7 +197,7 @@ function authenticate(config: IConfig, done: (err: Error) => void)
}
else
{
log.info('You have a premium account! Good!');
log.info('You have a premium account! Good!');
}
done(null);
});

View File

@@ -1,8 +1,8 @@
'use strict';
import cheerio = require('cheerio');
import episode from './episode';
import fs = require('fs');
import fse = require('fs-extra');
// import fs = require('fs');
import fs = require('fs-extra');
import my_request = require('./my_request');
import path = require('path');
import url = require('url');
@@ -34,7 +34,7 @@ export default function(config: IConfig, address: string, done: (err: Error) =>
/* Make a backup of the persistent file in case of */
if (fileExist(persistentPath))
{
fse.copySync(persistentPath, persistentPath + '.backup');
fs.copySync(persistentPath, persistentPath + '.backup');
}
fs.readFile(persistentPath, 'utf8', (err: Error, contents: string) =>
@@ -58,15 +58,25 @@ export default function(config: IConfig, address: string, done: (err: Error) =>
{
if (page.episodes[i].retry <= 0)
{
console.error(err.stack || err);
log.dispEpisode(config.filename, 'Error...', true);
log.error(errD);
log.error('Cannot fetch episode "s' + page.episodes[i].volume + 'e' + page.episodes[i].episode +
'", please rerun later');
/* Go to the next on the list */
i += 1;
}
else
{
if (config.verbose)
log.dispEpisode(config.filename, 'Error...', true);
if ((config.verbose) || (config.debug))
{
console.error(errD.stack || errD);
if (config.debug)
{
log.dumpToDebug('series address', address);
log.dumpToDebug('series error', errD.stack || errD);
log.dumpToDebug('series data', JSON.stringify(page));
}
log.error(errD);
}
log.warn('Retrying to fetch episode "s' + page.episodes[i].volume + 'e' + page.episodes[i].episode +
'" - Retry ' + page.episodes[i].retry + ' / ' + config.retry);
@@ -109,11 +119,6 @@ function download(cache: {[address: string]: number}, config: IConfig,
baseAddress: string, item: ISeriesEpisode,
done: (err: Error, ign: boolean) => void)
{
if (!filter(config, item))
{
return done(null, false);
}
const address = url.resolve(baseAddress, item.address);
if (cache[address])
@@ -133,30 +138,6 @@ function download(cache: {[address: string]: number}, config: IConfig,
});
}
/**
* Filters the item based on the configuration.
*/
function filter(config: IConfig, item: ISeriesEpisode)
{
// Filter on chapter.
const episodeFilter = config.episode;
// Filter on volume.
const volumeFilter = config.volume;
const currentEpisode = parseInt(item.episode, 10);
const currentVolume = item.volume;
if ( ( (episodeFilter > 0) && (currentEpisode <= episodeFilter) ) ||
( (episodeFilter < 0) && (currentEpisode >= -episodeFilter) ) ||
( (volumeFilter > 0) && (currentVolume <= volumeFilter ) ) ||
( (volumeFilter < 0) && (currentVolume >= -volumeFilter ) ) )
{
return false;
}
return true;
}
/**
* Requests the page and scrapes the episodes and series.
*/
@@ -186,6 +167,11 @@ function page(config: IConfig, address: string, done: (err: Error, result?: ISer
const title = $('span[itemprop=name]').text();
if (!title) {
if (config.debug)
{
log.dumpToDebug('inval page addr', address);
log.dumpToDebug('inval page data', $);
}
return done(new Error('Invalid page.(' + address + ')'));
}

View File

@@ -24,8 +24,8 @@ export default function(id: number, iv: Buffer|string, data: Buffer|string,
*/
function decrypt(id: number, iv: Buffer|string, data: Buffer|string)
{
const ivBuffer = typeof iv === 'string' ? new Buffer(iv, 'base64') : iv;
const dataBuffer = typeof data === 'string' ? new Buffer(data, 'base64') : data;
const ivBuffer = typeof iv === 'string' ? Buffer.from(iv, 'base64') : iv;
const dataBuffer = typeof data === 'string' ? Buffer.from(data, 'base64') : data;
const decipher = crypto.createDecipheriv('aes-256-cbc', key(id), ivBuffer);
decipher.setAutoPadding(false);
@@ -53,7 +53,7 @@ function decompress(data: Buffer, done: (err: Error, result?: Buffer) => void)
function key(subtitleId: number): Buffer
{
const hash = secret(20, 97, 1, 2) + magic(subtitleId);
const result = new Buffer(32);
const result = Buffer.allocUnsafe(32);
result.fill(0);
crypto.createHash('sha1').update(hash).digest().copy(result);

View File

@@ -4,7 +4,7 @@ import xml2js = require('xml2js');
/**
* Converts an input buffer to a SubStation Alpha subtitle.
*/
export default function(input: string|Buffer, done: (err: Error, subtitle?: string) => void)
export default function(config: IConfig, input: string|Buffer, done: (err: Error, subtitle?: string) => void)
{
xml2js.parseString(input.toString(), {
explicitArray: false,
@@ -18,9 +18,9 @@ export default function(input: string|Buffer, done: (err: Error, subtitle?: stri
try
{
done(null, script(xml) + '\n' +
done(null, script(config, xml) + '\n' +
style(xml.styles) + '\n' +
event(xml.events));
event(config, xml.events));
} catch (err)
{
done(err);
@@ -31,7 +31,7 @@ export default function(input: string|Buffer, done: (err: Error, subtitle?: stri
/**
* Converts the event block.
*/
function event(block: ISubtitleEvent): string
function event(config: IConfig, block: ISubtitleEvent): string
{
const format = 'Layer,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text';
@@ -51,10 +51,11 @@ function event(block: ISubtitleEvent): string
/**
* Converts the script block.
*/
function script(block: ISubtitle): string
function script(config: IConfig, block: ISubtitle): string
{
return '[Script Info]\n' +
'Origin: Downloaded from Crunchyroll.com by ' + config.user + '\n' +
'Title: ' + block.$.title + '\n' +
'ScriptType: v4.00+\n' +
'WrapStyle: ' + block.$.wrap_style + '\n' +

View File

@@ -4,7 +4,7 @@ import xml2js = require('xml2js');
/**
* Converts an input buffer to a SubRip subtitle.
*/
export default function(input: Buffer|string, done: (err: Error, subtitle?: string) => void)
export default function(config: IConfig, input: Buffer|string, done: (err: Error, subtitle?: string) => void)
{
const options = {explicitArray: false, explicitRoot: false};