恢復 YouTube 評論名稱

此腳本將 YouTube 評論部分中的“handle”替換為用戶名

目前為 2023-07-23 提交的版本,檢視 最新版本

// ==UserScript==
// @name Return YouTube Comment Username
// @name:ja YouTubeコメント欄の名前を元に戻す
// @name:zh-CN 恢復 YouTube 评论用户名
// @name:zh-TW 恢復 YouTube 評論名稱
// @version 0.3.8
// @author yakisova41
// @license MIT
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAADL1JREFUeJztnXtsVFUexz93mAJtsFChtTy1UgRBqlhqgqihPggBCbtmfbCuCoi7fxglRhYwyvpK3OAbHzHiYmQTVoEFdtWIPFUUUXC7vJt1eSlQYctTKGVaOr/942x3pnPvPO+r7ZxPcpLOnDPn/ub+vvM7555XDREhbQzDAAYDlcAtwBXpV+I4Apz02wiPOQ2sB9YBXyPSmG4FRsoCMIwgMBq4B7gZ6JHuxTSu8jOwGlgK/DVVMSQXgHL8b4EngJ72bNR4xA/ADEQWJyuYWACG0Q/4CzDSMdM0XvIxcB8ix+MViC8Aw7gcWIv+1bd19gO/QGSrVaa1AAxjMMr5xW5apvGMk8B4RL6KzQiYihrGEFSvUju//dANWIlh3Bib0TICGMZFQBXQyzPTNF7yH+BKRA43vxGJAIbRAdXh085vvxQB86PfiG4CHgVMIULT7hiLYdzT/EI1AYZxIbAX6OqfXRoPOQqUIHKmOQJMRjs/m+gB3AeRJmCyf7ZofOLXAIZAKfBvn43ReE8Y6BUAxvtticYXAsCIAHqcP5u5JgD089sKjW8M1gLIbgYYohYSXOC3JRpfqA8AOX5bofGNTgEg6LcVGv8IAh38NkITQ0EBXHQRnDoFR45AOOzapQKA4VrtmtQZORLmz4faWjh+HKqroaYG6uthxQqYNAmCLgRrAdHJx1RUJLJsmaREdbXIDTc4ef0mLQA/0+DBIvv2peb8ZkIhkUmTH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PAEdRyY00bJ1MBPG61yUDT9shEANuA95w3ReMHmQjg94g48F+LNa2BdDuBKxBZ5ZYxGu9JJwI0ATNctEXjA+lEgD8hssNNYzTek+oZQaeBp1y0Q+MTqTYBf0TksNvGaLwnlSbgIDDXA1s0PpBKBJgV73ABTdsnmQD+CbzvkS0aH0gmgOmxhwpp2heJBLAckXVeGqPxnnidwEZglse2aHwgXgR4C5HvvTZG4z1WAjgJPOODLRofsBKAPtUji4gVwD7gTZ9s0fhAbCdQn+qRZURHgG+ApT7aovGBZgHoUz2ylGYBLEJEH+aYhQRQZ8s+4bchGn8wBCoR+cxvQzT+8F/HY9h040De8wAAAABJRU5ErkJggg==
// @namespace https://yt-returnname-api.pages.dev/extension/
// @description This script replaces the "handle" in the YouTube comments section to user name
// @description:ja YouTubeのコメント欄の名前をハンドル(@...)からユーザー名に書き換えます。
// @description:zh-TW 此腳本將 YouTube 評論部分中的“handle”替換為用戶名
// @description:zh-CN 此脚本将 YouTube 评论部分中的“handle”替换为用户名
// @match https://www.youtube.com/*
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==

const inject = ()=>{// src/utils/isCommentRenderer.ts
function isCommentRenderer(continuationItems) {
  if (continuationItems.length > 0) {
    if (continuationItems[0].hasOwnProperty("commentThreadRenderer")) {
      return false;
    }
    if (continuationItems[0].hasOwnProperty("commentRenderer")) {
      return true;
    }
  }
  return false;
}

// src/utils/findElementByTrackingParams.ts
function findElementByTrackingParams(trackingParams, elementSelector) {
  let returnElement = null;
  const elems = document.querySelectorAll(elementSelector);
  for (let i = 0; i < elems.length; i++) {
    if (elems[i].trackedParams === trackingParams) {
      returnElement = elems[i];
      break;
    }
  }
  return returnElement;
}
async function reSearchElement(trackingParams, selector) {
  const timeOut = 1e4;
  return await new Promise((resolve) => {
    let isFinding = true;
    const search = () => {
      const el = findElementByTrackingParams(trackingParams, selector);
      if (el !== null) {
        resolve(el);
        isFinding = false;
      }
      if (isFinding) {
        setTimeout(() => {
          search();
        }, 100);
      }
    };
    search();
    setTimeout(() => {
      if (isFinding) {
        isFinding = false;
        throw new Error(`Research Timeout trackingParams: ${trackingParams}`);
      }
    }, timeOut);
  });
}
function findElementAllByCommentId(commnetId, elementSelector) {
  const returnElements = [];
  const elems = document.querySelectorAll(elementSelector);
  elems.forEach((elem) => {
    if (elem.__data.data.commentId === commnetId) {
      returnElements.push(elem);
    }
  });
  return returnElements;
}
async function reSearchElementAllByCommentId(commnetId, selector) {
  return await new Promise((resolve) => {
    let isFinding = true;
    const search = () => {
      const el = findElementAllByCommentId(commnetId, selector);
      if (el !== null) {
        resolve(el);
        isFinding = false;
      }
      if (isFinding) {
        setTimeout(() => {
          search();
        }, 100);
      }
    };
    search();
  });
}

// src/utils/debugLog.ts
function debugLog(message, value = "") {
  console.log(`[rycu] ${message} %c${value}`, "color:cyan;");
}
function debugErr(message) {
  console.error(`[rycu] ${message}`);
}

// src/utils/escapeString.ts
function escapeString(text) {
  return text.replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll(`"`, `&quot;`).replaceAll(`'`, `&apos;`);
}

// src/utils/getUserName.ts
async function getUserName(id) {
  debugLog("Get name");
  const data = await fetch(
    `https://www.youtube.com/feeds/videos.xml?channel_id=${id}`,
    {
      method: "GET",
      cache: "default",
      keepalive: false
    }
  ).then(async (res) => {
    if (res.status !== 200)
      throw new Error(`API Status is ${res.status}`);
    return await res.text();
  }).then((text) => {
    const match = text.match("<title>([^<].*)</title>");
    if (match !== null) {
      return match[1];
    } else {
      throw new Error("XML title not found");
    }
  });
  return data;
}

// src/rewrites/rewriteOfCommentRenderer/nameRewriteOfCommentRenderer.ts
function nameRewriteOfCommentRenderer(commentRenderer, isNameContainerRender, userId) {
  const commentRendererBody = commentRenderer.__shady_native_children[2];
  let nameElem = commentRendererBody.querySelector(
    "#main > #header > #header-author > h3 > a > span"
  );
  if (isNameContainerRender) {
    nameElem = commentRendererBody.__shady_native_children[1].querySelector(
      "#header > #header-author > #author-comment-badge > ytd-author-comment-badge-renderer > a > #channel-name > #container > #text-container > yt-formatted-string"
    );
  }
  void getUserName(userId).then((name) => {
    if (nameElem !== null) {
      if (isNameContainerRender) {
        nameElem.__shady_native_innerHTML = escapeString(name);
      } else {
        nameElem.textContent = escapeString(name);
      }
    } else {
      debugErr("Name element is null");
    }
  }).catch((e) => {
    debugErr(e);
  });
}

// src/rewrites/comment.ts
function rewriteCommentNameFromContinuationItems(continuationItems) {
  debugLog("Comment Rewrite");
  continuationItems.forEach((continuationItem) => {
    const { commentThreadRenderer } = continuationItem;
    if (commentThreadRenderer !== void 0) {
      const { trackingParams } = commentThreadRenderer;
      void getCommentElem(trackingParams).then((commentElem) => {
        reWriteCommentElem(commentElem, commentThreadRenderer);
      });
    }
  });
}
function reWriteCommentElem(commentElem, commentThreadRenderer) {
  const commentRenderer = commentElem.__shady_native_children[0];
  if (commentRenderer !== null && commentRenderer !== void 0) {
    let isContainer = commentThreadRenderer.comment.commentRenderer.authorIsChannelOwner;
    if (commentThreadRenderer.comment.commentRenderer.authorCommentBadge !== void 0) {
      isContainer = true;
    }
    nameRewriteOfCommentRenderer(
      commentRenderer,
      isContainer,
      commentThreadRenderer.comment.commentRenderer.authorEndpoint.browseEndpoint.browseId
    );
  }
}
async function getCommentElem(trackingParams) {
  return await new Promise((resolve) => {
    const commentElem = findElementByTrackingParams(
      trackingParams,
      "#comments > #sections > #contents > ytd-comment-thread-renderer"
    );
    if (commentElem !== null) {
      resolve(commentElem);
    } else {
      void reSearchElement(trackingParams, "ytd-comment-thread-renderer").then((commentElem2) => {
        resolve(commentElem2);
      }).catch((e) => {
        debugErr(e);
      });
    }
  });
}

// src/rewrites/rewriteOfCommentRenderer/mentionRewriteOfCommentRenderer.ts
function mentionRewriteOfCommentRenderer(commentRenderer) {
  const commentRendererBody = commentRenderer.__shady_native_children[2];
  const main2 = commentRendererBody.__shady_native_children[1];
  const aTags = main2.querySelectorAll(
    "#comment-content > ytd-expander > #content > #content-text > a"
  );
  aTags.forEach((aTag) => {
    if (aTag.textContent?.match("@.*") !== null) {
      const href = aTag.getAttribute("href");
      if (href !== null) {
        void getUserName(href.split("/")[2]).then((name) => {
          aTag.textContent = `@${escapeString(name)} `;
        }).catch((e) => {
          debugErr(e);
        });
      } else {
        debugErr("Mention Atag is have not Href attr");
      }
    }
  });
}

// src/rewrites/reply.ts
function rewriteReplytNameFromContinuationItems(continuationItems) {
  debugLog("Reply Rewrite");
  continuationItems.forEach((continuationItem) => {
    const { commentRenderer } = continuationItem;
    if (commentRenderer !== void 0) {
      void getReplyElem(commentRenderer.trackingParams).then((replyElem) => {
        reWriteReplyElem(replyElem, commentRenderer);
      });
    }
  });
}
function reWriteReplyElem(replyElem, rendererData) {
  let isContainer = rendererData.authorIsChannelOwner;
  if (rendererData.authorCommentBadge !== void 0) {
    isContainer = true;
  }
  nameRewriteOfCommentRenderer(
    replyElem,
    isContainer,
    rendererData.authorEndpoint.browseEndpoint.browseId
  );
  mentionRewriteOfCommentRenderer(replyElem);
}
async function getReplyElem(trackedParams) {
  return await new Promise((resolve) => {
    const selector = "#replies > ytd-comment-replies-renderer > #expander > #expander-contents > #contents > ytd-comment-renderer";
    const commentRenderer = findElementByTrackingParams(
      trackedParams,
      selector
    );
    if (commentRenderer !== null) {
      resolve(commentRenderer);
    } else {
      void reSearchElement(trackedParams, selector).then((commentRenderer2) => {
        resolve(commentRenderer2);
      });
    }
  });
}
function rewriteTeaserReplytNameFromContinuationItems(continuationItems) {
  continuationItems.forEach((continuationItem) => {
    const { commentRenderer } = continuationItem;
    if (commentRenderer !== void 0) {
      void reSearchElementAllByCommentId(
        commentRenderer.commentId,
        "ytd-comment-replies-renderer > #teaser-replies > ytd-comment-renderer"
      ).then((replyElems) => {
        replyElems.forEach((replyElem) => {
          reWriteReplyElem(replyElem, commentRenderer);
        });
      });
      void reSearchElementAllByCommentId(
        commentRenderer.commentId,
        "ytd-comment-replies-renderer > #expander > #expander-contents > #contents > ytd-comment-renderer"
      ).then((replyElems) => {
        replyElems.forEach((replyElem) => {
          reWriteReplyElem(replyElem, commentRenderer);
        });
      });
    }
  });
}

// src/handlers/handleYtAppendContinuationItemsAction.ts
function handleYtAppendContinuationItemsAction(detail) {
  const continuationItems = detail.args[0].appendContinuationItemsAction.continuationItems;
  if (isCommentRenderer(continuationItems)) {
    const replyDetail = detail;
    setTimeout(() => {
      rewriteReplytNameFromContinuationItems(
        replyDetail.args[0].appendContinuationItemsAction.continuationItems
      );
    }, 1);
  } else {
    const commentDetail = detail;
    setTimeout(() => {
      rewriteCommentNameFromContinuationItems(
        commentDetail.args[0].appendContinuationItemsAction.continuationItems
      );
    }, 10);
  }
}

// src/handlers/handleYtCreateCommentAction.ts
function handleYtCreateCommentAction(detail) {
  const createCommentDetail = detail;
  const continuationItems = [
    {
      commentThreadRenderer: createCommentDetail.args[0].createCommentAction.contents.commentThreadRenderer
    }
  ];
  setTimeout(() => {
    rewriteCommentNameFromContinuationItems(continuationItems);
  }, 100);
}

// src/handlers/handleYtCreateCommentReplyAction.ts
function handleYtCreateCommentReplyAction(detail) {
  const createReplyDetail = detail;
  const continuationItems = [
    {
      commentRenderer: createReplyDetail.args[0].createCommentReplyAction.contents.commentRenderer
    }
  ];
  setTimeout(() => {
    rewriteTeaserReplytNameFromContinuationItems(continuationItems);
  }, 100);
}

// src/rewrites/highlightedReply.ts
function rewriteHighlightedReply(trackedParams, isContainer, userId) {
  const elem = findElementByTrackingParams(
    trackedParams,
    "ytd-comment-renderer"
  );
  const rewriteHighlightedReplyElem = (elem2) => {
    nameRewriteOfCommentRenderer(elem2, isContainer, userId);
  };
  if (elem === null) {
    void reSearchElement(trackedParams, "ytd-comment-renderer").then((elem2) => {
      rewriteHighlightedReplyElem(elem2);
    });
  } else {
    rewriteHighlightedReplyElem(elem);
  }
}

// src/handlers/handleYtGetMultiPageMenuAction.ts
function handleYtGetMultiPageMenuAction(detail) {
  const getMultiPageMenuDetail = detail;
  const continuationItems = getMultiPageMenuDetail.args[0].getMultiPageMenuAction.menu.multiPageMenuRenderer.sections[1].itemSectionRenderer?.contents;
  const highLightedTeaserContents = getMultiPageMenuDetail.args[0]?.getMultiPageMenuAction?.menu?.multiPageMenuRenderer.sections[1].itemSectionRenderer?.contents[0]?.commentThreadRenderer.replies?.commentRepliesRenderer?.teaserContents;
  if (continuationItems !== void 0) {
    setTimeout(() => {
      rewriteCommentNameFromContinuationItems(continuationItems);
      if (highLightedTeaserContents !== void 0) {
        const highLightedReplyRenderer = highLightedTeaserContents[0]?.commentRenderer;
        let isContainer = highLightedReplyRenderer.authorIsChannelOwner;
        if (highLightedReplyRenderer.authorCommentBadge !== void 0) {
          isContainer = true;
        }
        rewriteHighlightedReply(
          highLightedReplyRenderer.trackingParams,
          isContainer,
          highLightedReplyRenderer.authorEndpoint.browseEndpoint.browseId
        );
      }
    }, 100);
  }
}

// src/handlers/handleYtHistory.ts
function handleYtHistory(detail) {
  const historyDetail = detail;
  const continuationItems = historyDetail.args[1].historyEntry?.rootData.response.contents.twoColumnWatchNextResults?.results?.results?.contents[3]?.itemSectionRenderer?.contents;
  if (continuationItems !== void 0) {
    setTimeout(() => {
      rewriteCommentNameFromContinuationItems(continuationItems);
    }, 100);
  }
}

// src/handlers/handleYtReloadContinuationItemsCommand.ts
function handleYtReloadContinuationItemsCommand(detail) {
  const reloadDetail = detail;
  const { slot } = reloadDetail.args[0].reloadContinuationItemsCommand;
  if (slot === "RELOAD_CONTINUATION_SLOT_BODY") {
    const continuationItems = reloadDetail.args[0].reloadContinuationItemsCommand.continuationItems;
    if (continuationItems !== void 0) {
      setTimeout(() => {
        rewriteCommentNameFromContinuationItems(continuationItems);
      }, 100);
    }
  }
}

// src/index.ts
function main() {
  debugLog("Script start");
  const handleYtAction = (e) => {
    const { actionName } = e.detail;
    switch (actionName) {
      case "yt-append-continuation-items-action":
        handleYtAppendContinuationItemsAction(e.detail);
        break;
      case "yt-reload-continuation-items-command":
        handleYtReloadContinuationItemsCommand(e.detail);
        break;
      case "yt-history-load":
        handleYtHistory(e.detail);
        break;
      case "yt-get-multi-page-menu-action":
        handleYtGetMultiPageMenuAction(e.detail);
        break;
      case "yt-create-comment-action":
        handleYtCreateCommentAction(e.detail);
        break;
      case "yt-create-comment-reply-action":
        handleYtCreateCommentReplyAction(e.detail);
        break;
    }
  };
  document.addEventListener("yt-action", handleYtAction);
  document.addEventListener("yt-navigate-finish", ({ detail }) => {
    document.removeEventListener("yt-action", handleYtAction);
    document.addEventListener("yt-action", handleYtAction);
  });
}

// node_modules/ts-extension-builder/tmp/entry.ts
var args = {};
if (typeof GM_info !== "undefined" && GM_info.script.grant !== void 0) {
  GM_info.script.grant.forEach((propatyName) => {
    let keyName = propatyName.split("GM_")[1];
    if (keyName === "xmlhttpRequest") {
      keyName = "xmlHttpRequest";
    }
    args[propatyName] = GM[keyName];
  });
}
main(args);
}
const script = document.createElement("script");
script.innerHTML = `(${inject.toString()})()`
unsafeWindow.document.body.appendChild(script)

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址