From 593c4cef0d9685af042e7db6a4edf15f7f48a726 Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Thu, 11 Jul 2024 22:55:02 +0200 Subject: [PATCH] yande.re hotlink protection workaround --- README.md | 15 ++++++++++++++- package.json | 2 +- src/engines/Moebooru.ts | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 72f25a8..4633f2c 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,17 @@ Scrape a booru-like post object from the DOM. | shuushuu | e-shuushuu.net | content, rating, resolution, tags, tag_category | Rating is assumed to be safe. | | twitter | twitter.com, mobile.twitter.com | content | | | zerochan | www.zerochan.net | content, resolution, tags, tag_category | Rating is assumed to be safe. | -| fallback | | content | Tries to find the largest image or video on the current page. | \ No newline at end of file +| fallback | | content | Tries to find the largest image or video on the current page. | + +## Development + +Build SzuruChrome with your local version of neo-scraper. + +```sh +cd neo-scraper +pnpm install +pnpm build # or pnpm watch in another terminal +pnpm link --global +cd ../SzuruChrome +pnpm dev +``` diff --git a/package.json b/package.json index 1e41801..e461d7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "neo-scraper", - "version": "0.9.0", + "version": "0.9.1", "description": "Scrape a booru-like post object from the DOM.", "type": "module", "main": "dist/index.js", diff --git a/src/engines/Moebooru.ts b/src/engines/Moebooru.ts index d337b34..32b7131 100644 --- a/src/engines/Moebooru.ts +++ b/src/engines/Moebooru.ts @@ -13,6 +13,10 @@ export default class Moebooru extends ScrapeEngineBase { const post = new ScrapedPost(); post.pageUrl = document.location.href; + if (document.location.host == "yande.re") { + post.uploadMode = "content"; + } + // Set image url const originalImageElement = document.querySelector("#highres") as HTMLAnchorElement; if (originalImageElement) {