获取up主投稿页所有视频

自动生成you-get的bat下载脚本

目前為 2024-09-07 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         获取up主投稿页所有视频
// @namespace    get-bilibili-up-tougao-page-links
// @version      1.0
// @description  自动生成you-get的bat下载脚本
// @license     MIT
// @match        https://space.bilibili.com/*/video
// @grant        none
// ==/UserScript==


(function () {
  "use strict";

  // 创建按钮元素
  const button = document.createElement("button");
  // 设置按钮样式
  button.style.position = "fixed";
  button.style.right = "30px";
  button.style.bottom = "30px";
  button.style.width = "50px";
  button.style.height = "50px";
  button.style.borderRadius = "50%";
  button.style.backgroundColor = "#ff6699";
  button.style.border = "none";
  // 添加按钮文本
  button.textContent = "Down";
  button.style.color = "white";
  // 添加按钮到页面
  document.body.appendChild(button);

  // 按钮点击事件处理函数
  button.addEventListener("click", () => {
    // 获取所有链接并去重
  const links = [
      ...new Set(Array.from(document.querySelectorAll("ul.cube-list li a")).map(link => link.href))
    ].map(link => ({ href: link }));    // 处理链接
    const commands = links.map(
      (link) => `you-get ${link.href} -c cookie.txt`
    );
    // 将处理结果保存到文件
    const blob = new Blob([commands.join("\n")], { type: "text/plain" });
    const url = URL.createObjectURL(blob);
    // 下载文件
    const a = document.createElement("a");
    a.href = url;
    a.download = "youGetcommands.txt";
    a.click();
  });
})();