Greasy Fork is available in English.

InvidiousNewPipeExport

Allows exporting Invidious subscriptions to NewPipe's new JSON format.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

作者のサイトでサポートを受ける。または、このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name               InvidiousNewPipeExport
// @name:de            InvidiousNewPipeExport
// @name:en            InvidiousNewPipeExport
// @namespace          sun/userscripts
// @version            1.0.12
// @description        Allows exporting Invidious subscriptions to NewPipe's new JSON format.
// @description:de     Ermöglicht den Export von Invidious-Abonnements in NewPipe's neues JSON-Format.
// @description:en     Allows exporting Invidious subscriptions to NewPipe's new JSON format.
// @compatible         chrome
// @compatible         edge
// @compatible         firefox
// @compatible         opera
// @compatible         safari
// @homepageURL        https://forgejo.sny.sh/sun/userscripts
// @supportURL         https://forgejo.sny.sh/sun/userscripts/issues
// @contributionURL    https://liberapay.com/sun
// @contributionAmount €1.00
// @author             Sunny <[email protected]>
// @include            *://*/data_control
// @include            *://*/data_control?*
// @match              *://*/data_control
// @match              *://*/data_control?*
// @connect            newpipe.net
// @run-at             document-end
// @inject-into        auto
// @grant              GM.xmlHttpRequest
// @grant              GM_xmlhttpRequest
// @noframes
// @require            https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @icon               https://forgejo.sny.sh/sun/userscripts/raw/branch/main/icons/InvidiousNewPipeExport.png
// @copyright          2022-present, Sunny (https://sny.sh/)
// @license            Hippocratic License; https://forgejo.sny.sh/sun/userscripts/src/branch/main/LICENSE.md
// ==/UserScript==

(() => {
  document
    .querySelector(
      "[href='/subscription_manager?action_takeout=1&format=newpipe']",
    )
    .parentElement.insertAdjacentHTML(
      "afterend",
      "<div class='pure-control-group'><a id='inpe-export' href='#'>Export subscriptions as JSON (for NewPipe)</a></div>",
    );

  document.getElementById("inpe-export").onclick = () => {
    const newpipe_subscriptions = {};

    GM.xmlHttpRequest({
      url: "https://newpipe.net/api/data.json",
      onload: (response) => {
        const data = JSON.parse(response.responseText);

        newpipe_subscriptions.app_version = data.flavors.fdroid.stable.version;
        newpipe_subscriptions.app_version_int =
          data.flavors.fdroid.stable.version_code;

        GM.xmlHttpRequest({
          url: `${document.location.origin}/subscription_manager`,
          onload: (response) => {
            let data = response.responseText;
            data = new DOMParser().parseFromString(data, "text/html");
            data = Array.from(data.querySelectorAll("a"))
              .filter((x) => x.getAttribute("href").startsWith("/channel/"))
              .map((x) => {
                return {
                  service_id: 0,
                  url: `https://www.youtube.com${x.getAttribute("href")}`,
                  name: x.textContent,
                };
              });

            newpipe_subscriptions.subscriptions = data;

            const download = document.createElement("a");
            download.setAttribute(
              "href",
              `data:text/plain;charset=utf-8,${encodeURIComponent(JSON.stringify(newpipe_subscriptions))}`,
            );
            download.setAttribute("download", "newpipe_subscriptions.json");
            download.click();
          },
        });
      },
    });
  };
})();