Cleanup + version bump
parent
d1a6be0079
commit
b270d8d710
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "neo-scraper",
|
"name": "neo-scraper",
|
||||||
"version": "0.4.6",
|
"version": "0.4.7",
|
||||||
"description": "Scrape a booru-like post object from the DOM.",
|
"description": "Scrape a booru-like post object from the DOM.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.js",
|
"types": "dist/index.d.js",
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
import { ScrapeEngine, ScrapeResult, ScrapedPost } from "../ScrapeEngine";
|
import { ScrapeEngine, ScrapeResult, ScrapedPost } from "../ScrapeEngine";
|
||||||
import { guessContentType } from "../Utility";
|
|
||||||
|
|
||||||
export function getOriginalImageUrl(image: HTMLImageElement) {
|
export function getOriginalImageUrl(image: HTMLImageElement) {
|
||||||
// if the link includes a resolution, change it to orig:
|
// if the link includes a resolution, change it to orig:
|
||||||
// https://pbs.twimg.com/media/stuff?format=jpg&name=900x900
|
// https://pbs.twimg.com/media/stuff?format=jpg&name=900x900
|
||||||
// -> https://pbs.twimg.com/media/stuff?format=jpg&name=orig
|
// -> https://pbs.twimg.com/media/stuff?format=jpg&name=orig
|
||||||
let img_url = new URL((image as HTMLImageElement).src);
|
let img_url = new URL((image as HTMLImageElement).src);
|
||||||
if (img_url.searchParams.has('name') && img_url.searchParams.get('name') != 'orig') {
|
if (img_url.searchParams.has("name") && img_url.searchParams.get("name") != "orig") {
|
||||||
img_url.searchParams.set('name', 'orig');
|
img_url.searchParams.set("name", "orig");
|
||||||
}
|
}
|
||||||
return img_url;
|
return img_url;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue