Skip to content

Commit c5b6502

Browse files
committed
Fix userAgent
1 parent 107b457 commit c5b6502

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import rp from 'request-promise';
44
import cheerio from 'cheerio';
55
import querystring from 'querystring';
66

7+
const userAgent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36';
8+
79
const getLinksByUrl = (uri) => {
810
const validRegex = /http:\/\/jkanime\.net\/([\w\d-_]+)\/(\d+)/;
911
const options = {
1012
uri: uri,
1113
transform: cheerio.load,
12-
headers: {'User-Agent': 'anime-dl'}
14+
headers: {'User-Agent': userAgent}
1315
};
1416
return rp(options)
1517
.then($ => {
@@ -28,7 +30,7 @@ const getLastChapter = (name) => {
2830
const options = {
2931
uri: `http://jkanime.net/${name}`,
3032
transform: cheerio.load,
31-
headers: {'User-Agent': 'anime-dl'}
33+
headers: {'User-Agent': userAgent}
3234
};
3335
return rp(options)
3436
.then($ => {
@@ -41,7 +43,7 @@ const searchAnime = (keyword) => {
4143
const options = {
4244
uri: `http://jkanime.net/buscar/${querystring.escape(keyword)}`,
4345
transform: cheerio.load,
44-
headers: {'User-Agent': 'anime-dl'}
46+
headers: {'User-Agent': userAgent}
4547
};
4648
return rp(options)
4749
.then($ => {

0 commit comments

Comments
 (0)