File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ import rp from 'request-promise';
4
4
import cheerio from 'cheerio' ;
5
5
import querystring from 'querystring' ;
6
6
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
+
7
9
const getLinksByUrl = ( uri ) => {
8
10
const validRegex = / h t t p : \/ \/ j k a n i m e \. n e t \/ ( [ \w \d - _ ] + ) \/ ( \d + ) / ;
9
11
const options = {
10
12
uri : uri ,
11
13
transform : cheerio . load ,
12
- headers : { 'User-Agent' : 'anime-dl' }
14
+ headers : { 'User-Agent' : userAgent }
13
15
} ;
14
16
return rp ( options )
15
17
. then ( $ => {
@@ -28,7 +30,7 @@ const getLastChapter = (name) => {
28
30
const options = {
29
31
uri : `http://jkanime.net/${ name } ` ,
30
32
transform : cheerio . load ,
31
- headers : { 'User-Agent' : 'anime-dl' }
33
+ headers : { 'User-Agent' : userAgent }
32
34
} ;
33
35
return rp ( options )
34
36
. then ( $ => {
@@ -41,7 +43,7 @@ const searchAnime = (keyword) => {
41
43
const options = {
42
44
uri : `http://jkanime.net/buscar/${ querystring . escape ( keyword ) } ` ,
43
45
transform : cheerio . load ,
44
- headers : { 'User-Agent' : 'anime-dl' }
46
+ headers : { 'User-Agent' : userAgent }
45
47
} ;
46
48
return rp ( options )
47
49
. then ( $ => {
You can’t perform that action at this time.
0 commit comments