Add rule34hentai.net

pull/2/head
neobooru 2020-01-04 16:59:20 +01:00
parent 8cd94d53b6
commit c55d10d7e5
1 changed files with 10 additions and 2 deletions

View File

@ -4,7 +4,10 @@ export default class Shimmie2 implements ScrapeEngine {
name = "shimmie2"; name = "shimmie2";
canImport(url: Location): boolean { canImport(url: Location): boolean {
return url.host == "rule34.paheal.net"; return (
url.host == "rule34.paheal.net" ||
url.host == "rule34hentai.net"
);
} }
scrapeDocument(document: Document): ScrapeResult { scrapeDocument(document: Document): ScrapeResult {
@ -19,6 +22,11 @@ export default class Shimmie2 implements ScrapeEngine {
if (originalImageElements.length > 0) { if (originalImageElements.length > 0) {
post.imageUrl = originalImageElements[0].href; post.imageUrl = originalImageElements[0].href;
} else {
const dowloadBtnEl = document.querySelector("a[download]") as HTMLAnchorElement;
if (dowloadBtnEl) {
post.imageUrl = dowloadBtnEl.href;
}
} }
// Set safety // Set safety
@ -32,7 +40,7 @@ export default class Shimmie2 implements ScrapeEngine {
post.tags = Array.from(document.querySelectorAll("a.tag_name")) post.tags = Array.from(document.querySelectorAll("a.tag_name"))
.map(x => (x as HTMLAnchorElement).innerText.toLowerCase()) .map(x => (x as HTMLAnchorElement).innerText.toLowerCase())
.map(x => new ScrapedTag(x)); .map(x => new ScrapedTag(x));
if (post.imageUrl) { if (post.imageUrl) {
result.posts.push(post); result.posts.push(post);
} }