Attempt to 'prettier' code

* Hopefully this is 'prettier'
pull/15/head
GlobalGit3 2023-07-01 14:24:08 -05:00
parent 3407ae2a8c
commit 4c0c790c0c
2 changed files with 35 additions and 25 deletions

View File

@ -16,7 +16,7 @@ export default class NeoScraper {
new engines.Gelbooru(),
new engines.Inkbunny(),
new engines.Moebooru(),
new engines.Philomena(),
new engines.Philomena(),
new engines.Pixiv(),
new engines.Reddit(),
new engines.Rule34us(),

View File

@ -5,7 +5,15 @@ export default class Philomena extends ScrapeEngineBase {
name = "Philomena";
features: ScrapeEngineFeature[] = ["content", "rating", "tags", "source"];
notes = [];
supportedHosts = ["derpibooru.org", "trixiebooru.org", "ponybooru.org", "furbooru.org", "ponerpics.org", "manebooru.art", "twibooru.org"];
supportedHosts = [
"derpibooru.org",
"trixiebooru.org",
"ponybooru.org",
"furbooru.org",
"ponerpics.org",
"manebooru.art",
"twibooru.org",
];
scrapeDocument(document: Document): ScrapeResult {
const result = new ScrapeResult(this.name);
@ -13,7 +21,9 @@ export default class Philomena extends ScrapeEngineBase {
post.pageUrl = document.location.href;
// Set image url
const downloadEl = document.querySelector("div[id^='image_meta_'] > div:nth-child(4) > a:nth-child(4)") as HTMLAnchorElement;
const downloadEl = document.querySelector(
"div[id^='image_meta_'] > div:nth-child(4) > a:nth-child(4)"
) as HTMLAnchorElement;
post.contentUrl = downloadEl?.href;
// Set content type
@ -22,30 +32,30 @@ export default class Philomena extends ScrapeEngineBase {
}
// Set default rating (Will be determined later)
post.rating = "unsafe";
post.rating = "unsafe";
// Set tags
const tagEls = Array.from(document.querySelectorAll("a.tag__name")).map((x) => x as HTMLLIElement);
for (const el of tagEls) {
const tagName = (el.innerText);
for (const el of tagEls) {
const tagName = el.innerText;
let category: TagCategory | undefined;
// Set rating (philomena uses tags for this)
switch (tagName) {
case "safe":
post.rating = "safe";
break;
case "suggestive":
post.rating = "sketchy";
break;
case "questionable":
post.rating = "sketchy";
break;
case "explicit":
post.rating = "unsafe";
break;
}
// Set rating (philomena uses tags for this)
switch (tagName) {
case "safe":
post.rating = "safe";
break;
case "suggestive":
post.rating = "sketchy";
break;
case "questionable":
post.rating = "sketchy";
break;
case "explicit":
post.rating = "unsafe";
break;
}
if (tagName) {
const tag = new ScrapedTag(tagName, category);