Skip to content

Commit

Permalink
Fix userAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaticaq committed Mar 20, 2016
1 parent 107b457 commit c5b6502
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import rp from 'request-promise';
import cheerio from 'cheerio';
import querystring from 'querystring';

const userAgent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36';

const getLinksByUrl = (uri) => {
const validRegex = /http:\/\/jkanime\.net\/([\w\d-_]+)\/(\d+)/;
const options = {
uri: uri,
transform: cheerio.load,
headers: {'User-Agent': 'anime-dl'}
headers: {'User-Agent': userAgent}
};
return rp(options)
.then($ => {
Expand All @@ -28,7 +30,7 @@ const getLastChapter = (name) => {
const options = {
uri: `http://jkanime.net/${name}`,
transform: cheerio.load,
headers: {'User-Agent': 'anime-dl'}
headers: {'User-Agent': userAgent}
};
return rp(options)
.then($ => {
Expand All @@ -41,7 +43,7 @@ const searchAnime = (keyword) => {
const options = {
uri: `http://jkanime.net/buscar/${querystring.escape(keyword)}`,
transform: cheerio.load,
headers: {'User-Agent': 'anime-dl'}
headers: {'User-Agent': userAgent}
};
return rp(options)
.then($ => {
Expand Down

0 comments on commit c5b6502

Please sign in to comment.