plab-ultra

Userscript for PornoLab.Net

< Părere la script-ul plab-ultra

Recenzie: OK - script works, but has bugs

§
Postat în: 25-08-2025
Editat în: 25-08-2025

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):

const Handlers = {
    "fastpic.": (href) => generic(href, "#imglink > img.image.img-fluid"),

Revised Code

const Handlers = {
    "fastpic.": async (href) => {
      // Step 1: Fetch the HTML of the 'fullview' page.
      const fullviewUrl = href.replace("/view/", "/fullview/");
      const pageResponse = await GM_fetch("GET", fullviewUrl, "text");
      const pageHtml = pageResponse.responseText;

      // Step 2: Use a Regular Expression to find the protected image URL in the HTML.
      const match = /src="(https:\/\/i\d+\.fastpic\.[^"]+)" class="image"/.exec(pageHtml);
      const protectedImageUrl = match?.[1];

      if (!protectedImageUrl) {
        throw new Error(`Could not find image src via regex on: ${fullviewUrl}`);
      }

      // Step 3: Download the found URL as a blob to bypass hotlinking.
      return getBlob(protectedImageUrl);
    },

Hopefully this helps, Thanks for script, very useful!

§
Postat în: 25-08-2025

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.

clangmoyaiAutor
§
Postat în: 25-08-2025

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.

Postează un raspuns

Autentifică-te pentru a posta un răspuns.