revert changes
parent
6825c78a46
commit
8bd2a6000d
|
|
@ -20,8 +20,7 @@ export default class NeoScraper {
|
||||||
new engines.Shimmie2(),
|
new engines.Shimmie2(),
|
||||||
new engines.Shuushuu(),
|
new engines.Shuushuu(),
|
||||||
new engines.Twitter(),
|
new engines.Twitter(),
|
||||||
new engines.Zerochan(),
|
new engines.Zerochan()
|
||||||
new engines.FurAffinity()
|
|
||||||
);
|
);
|
||||||
this.fallbackEngine = new engines.Fallback();
|
this.fallbackEngine = new engines.Fallback();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
import { ScrapeEngine, ScrapeResult, ScrapedPost, ScrapedTag } from "../ScrapeEngine";
|
|
||||||
import { guessContentType } from "../Utility";
|
|
||||||
|
|
||||||
export default class e621 implements ScrapeEngine {
|
|
||||||
name = "FurAffinity";
|
|
||||||
|
|
||||||
canImport(url: Location): boolean {
|
|
||||||
return url.host == 'www.furaffinity.net';
|
|
||||||
}
|
|
||||||
|
|
||||||
scrapeDocument(document: Document): ScrapeResult {
|
|
||||||
let result = new ScrapeResult(this.name);
|
|
||||||
|
|
||||||
let post = new ScrapedPost();
|
|
||||||
post.pageUrl = document.location.href;
|
|
||||||
|
|
||||||
// Set image url
|
|
||||||
const downloadEl = document.querySelector("#submissionImg") as HTMLImageElement;
|
|
||||||
post.contentUrl = downloadEl?.src;
|
|
||||||
|
|
||||||
if (post.contentUrl == undefined) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set content type
|
|
||||||
post.contentType = guessContentType(post.contentUrl);
|
|
||||||
|
|
||||||
// Set rating
|
|
||||||
// TODO: not so sure about this? maybe there is a more elegant solution
|
|
||||||
const ratingEl = document.querySelectorAll("div.rating > span.font-large.rating-box.inline")[0] as HTMLSpanElement;
|
|
||||||
switch (ratingEl?.innerText) {
|
|
||||||
case "General":
|
|
||||||
post.rating = "safe";
|
|
||||||
break;
|
|
||||||
case "Mature":
|
|
||||||
post.rating = "sketchy";
|
|
||||||
break;
|
|
||||||
case "Adult":
|
|
||||||
post.rating = "unsafe";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set tags
|
|
||||||
// Shimmie2 doesn't support categories so we don't need to worry about those.
|
|
||||||
// They also use uppercase tags, so we toLowerCase() those.
|
|
||||||
// Tags might not match with other booru-likes, but that is for the user to figure out.
|
|
||||||
// For example by deleting 'wrong' tags or setting up some aliases in szurubooru.
|
|
||||||
post.tags = Array.from(document.querySelectorAll("section.tags-row > span.tags"))
|
|
||||||
.map((x) => (x as HTMLSpanElement).innerText)
|
|
||||||
.map((x) => new ScrapedTag(x));
|
|
||||||
|
|
||||||
// Set source
|
|
||||||
post.source = document.location.href;
|
|
||||||
|
|
||||||
result.tryAddPost(post);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -12,4 +12,3 @@ export { default as Shimmie2 } from "./Shimmie2";
|
||||||
export { default as Shuushuu } from "./Shuushuu";
|
export { default as Shuushuu } from "./Shuushuu";
|
||||||
export { default as Twitter } from "./Twitter";
|
export { default as Twitter } from "./Twitter";
|
||||||
export { default as Zerochan } from "./Zerochan";
|
export { default as Zerochan } from "./Zerochan";
|
||||||
export { default as FurAffinity } from "./FurAffinity";
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue