获取up主投稿页所有视频

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();
  });
})();