Skip to content

Commit

Permalink
Add rating detection to a few more sites
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovyerus committed Feb 9, 2018
1 parent 49427f7 commit 2e3eb10
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(/<td>.*?<b>Adult:<\/b><\/td><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(/<div class="introduction-modal"><p class="title">(.*?)<\/p>/i);

if (!match) return 1;
else return match[1].toLowerCase().includes('r-18') ? 3 : 1;
}
},
8: {
name: 'Nico Nico Seiga',
Expand Down Expand Up @@ -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',
Expand All @@ -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(/<li>Rating: (.*?)<\/li>/i)[1].split(' ')[0])
},
27: {
name: 'Sankaku Channel',
Expand All @@ -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(/<li>Rating: (.*?)<\/li>/gi).slice(-1)[0].split(' ')[1].slice(0, -5))
},
31: {
name: 'bcy.net Illust',
Expand Down

0 comments on commit 2e3eb10

Please sign in to comment.