diff --git a/lib/Constants.js b/lib/Constants.js index be632d83..ecabe1fc 100644 --- a/lib/Constants.js +++ b/lib/Constants.js @@ -14,12 +14,19 @@ const SITE_LIST = { 3: { name: 'The Doujinshi & Manga Lexicon', backupURL: data => `http://doujinshi.mugimugi.org/index.php?P=BOOK&ID=${data.data.ddb_id}`, - URLRegex: /(?:http:\/\/)?doujinshi\.mugimugi\.org\/index\.php?P=BOOK&ID=\d+/i + URLRegex: /(?:http:\/\/)?doujinshi\.mugimugi\.org\/index\.php?P=BOOK&ID=\d+/i, + getRating: data => data.match(/.*?Adult:<\/b><\/td>(.*)<\/td>/i)[1] === 'No' ? 1 : 3 }, 5: { name: 'Pixiv', backupURL: data => `https://www.pixiv.net/member_illust.php?mode=medium&illust_id=${data.data.pixiv_id}`, - URLRegex: /(?:https?:\/\/)?(?:www\.)?pixiv\.net\/member_illust\.php\?mode=.+&illust_id=\d+/i + URLRegex: /(?:https?:\/\/)?(?:www\.)?pixiv\.net\/member_illust\.php\?mode=.+&illust_id=\d+/i, + getRating: data => { + let match = data.match(/

(.*?)<\/p>/i); + + if (!match) return 1; + else return match[1].toLowerCase().includes('r-18') ? 3 : 1; + } }, 8: { name: 'Nico Nico Seiga', @@ -68,7 +75,8 @@ const SITE_LIST = { 19: { name: '2D-Market', backupURL: data => `http://2d-market.com/Comic/${data.header.thumbnail.match(/2d_market\/(\d+)/i)[1]}-${data.data.source.replace(' ', '-')}`, - URLRegex: /(?:https?:\/\/)2d-market\.com\/Comic\/\d+/i + URLRegex: /(?:https?:\/\/)2d-market\.com\/Comic\/\d+/i, + getRating: () => RATINGS.NSFW }, 20: { name: 'MediBang', @@ -94,7 +102,8 @@ const SITE_LIST = { 26: { name: 'Konachan', backupURL: data => `https://konachan.com/post/show/${data.data.konachan_id}`, - URLRegex: /(?:http:\/\/)?konachan\.com\/post\/show\/\d{6}/i + URLRegex: /(?:http:\/\/)?konachan\.com\/post\/show\/\d+/i, + getRating: body => [null, 'Safe', 'Questionable', 'Explicit'].indexOf(body.match(/

  • Rating: (.*?)<\/li>/i)[1].split(' ')[0]) }, 27: { name: 'Sankaku Channel', @@ -114,7 +123,8 @@ const SITE_LIST = { 30: { name: 'Idol Complex', backupURL: data => `https://idol.sankakucomplex.com/post/show/${data.data.idol_id}`, - URLRegex: /(?:https?:\/\/)?idol\.sankakucomplex\.com\/post\/show\/\d+/i + URLRegex: /(?:https?:\/\/)?idol\.sankakucomplex\.com\/post\/show\/\d+/i, + getRating: body => [null, 'Safe', 'Questionable', 'Explicit'].indexOf(body.match(/
  • Rating: (.*?)<\/li>/gi).slice(-1)[0].split(' ')[1].slice(0, -5)) }, 31: { name: 'bcy.net Illust',