Userscript for PornoLab.Net
So I ran into at least 2 more fastpic issues due to them having multiple hyperlink formats
This updated code resolves at least 3 versions of fastpic hyperlinks...
const Handlers = {
"fastpic.": async (href, src) => {
let pageUrl = href;
if (!pageUrl.includes("/view/")) {
if (!src || !src.includes("/thumb/")) {
throw new Error("Cannot handle FastPic link without a valid thumbnail src.");
}
// This is the final, corrected regex. It now correctly ignores the extra path segment (e.g., /a3/).
const parts = /i(\d+)\.[^/]+\/thumb(\/\d+\/\d+)\/[^/]+\/([^.]+)\..+$/.exec(src);
if (parts) {
const [, number, datePath, filename] = parts;
// The URL is now reconstructed correctly, building the path piece by piece.
pageUrl = `https://fastpic.org/view/${number}${datePath}/${filename}.jpg.html`;
} else {
throw new Error("Could not reconstruct page URL from thumbnail src with the new regex.");
}
}
const response = await new Promise((resolve, reject) => {
GM_xmlhttpRequest({ method: "GET", url: pageUrl, onload: resolve, onerror: reject });
});
const pageHtml = response.responseText;
const match = /src="(?<url>https[^"]+)" class="image(?: img-fluid)?"/.exec(pageHtml);
const finalImageUrl = match?.groups?.url;
if (!finalImageUrl) {
throw new Error(`Could not find image via regex on the processed page: ${pageUrl}`);
}
return finalImageUrl;
},
a few other image hosting domains have similar issues that still need resolving. I've only seen two so far, but there are probably more(imagevenue.com and imagebox.com) i'll try to fix them if and when i got time.
Hey, appreciate the "ok" rating lol, meanwhile the AI code you sent back is breaking other links. If you actually want to help, go to "Settings → Debug upgrade", click Copy-to-clipboard in the top-right, and send me that data.
Hello, I was testing out your code and encountered a bug with fastpic images loading as enlarged thumbnails instead of the higher quality image. After some tinkering around with some help from gemini, I was able to resolve the issue.
Current code (line#6524):
Revised Code
Hopefully this helps, Thanks for script, very useful!