Greasy Fork

Greasy Fork is available in English.

Pixeldrain unlimited download

8/24/2025, 1:10:16 PM

当前为 2025-08-24 提交的版本,查看 最新版本

// ==UserScript==
// @name        Pixeldrain unlimited download
// @namespace   Violentmonkey Scripts
// @match       https://pixeldrain.com/u/*
// @match       https://pixeldrain.com/l/*
// @grant       none
// @version     1.4
// @author      -
// @description 8/24/2025, 1:10:16 PM
// @license MIT
// ==/UserScript==

function add_ddl_zip() {
  const file_id = document.location.href.split("/").pop().split("#")[0];

  const link = document.createElement('a');
  link.href = `https://cdn.pd1.workers.dev/api/list/${file_id}/zip`;
  link.innerHTML = '<button class="toolbar_button svelte-jngqwx" title="Download all files in this album as a zip archive, from cloudflare"><i class="icon">download</i> <span class="svelte-jngqwx">DDL all files</span></button>';

  const aria2_input = document.createElement('a');
  aria2_input.href = "data:text/plain;base64,"+btoa(Array.from(document.querySelectorAll("a.file.svelte-zfpa77 > div")).map(div => "https://cdn.pd1.workers.dev/api/file/" + div.style["background-image"].split("/")[3]).join("\n") + "\n");
  aria2_input.download = `${file_id}.txt`;
  aria2_input.innerHTML = '<button class="toolbar_button svelte-jngqwx" title="export DDL links as an aria2 input file"><i class="icon">download</i> <span class="svelte-jngqwx">Aria2 input</span></button>';

  const toolbar = document.querySelector(".toolbar");
  const button = toolbar.querySelector("button.button.svelte-1bj9uys");
  toolbar.insertBefore(link, button);
  toolbar.insertBefore(aria2_input, button);
}

function add_ddl_button() {
  const file_id = document.location.href.split("/").pop().split("#")[0];

  // Create the anchor element
  const link = document.createElement('a');
  link.href = `https://cdn.pd1.workers.dev/api/file/${file_id}`;
  link.innerHTML = '<button class="button_highlight"><i class="icon">download</i> <span>Direct Download</span></button>';

  const description = document.querySelector("div.description");
  description.appendChild(link);
}

window.addEventListener('load', () => {
  if (
    document.location.pathname.startsWith("/u/")
  ) {
    add_ddl_button();
  }
  else if (
    document.location.pathname.startsWith("/l/")
  ) {
    add_ddl_zip();
  }

}, false);