Greasy Fork镜像 is available in English.

YouTube H.264 (h264ify)

https://github.com/erkserkserks/h264ify

2023/11/19のページです。最新版はこちら。

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name YouTube H.264 (h264ify) 
// @name:ru YouTube H.264 (h264ify)
// @namespace https://www.youtube.com
// @version 2023.11.19.1
// @description https://github.com/erkserkserks/h264ify
// @description:ru https://github.com/erkserkserks/h264ify
// @match *://*.youtube.com/*
// @match *://*.youtube-nocookie.com/*
// @match *://*.youtubekids.com/*
// @license MIT
// @grant none
// @run-at document-start
// ==/UserScript==

const block60fps = true;

function modifyVideoTypeChecker() {
  const mediaSource = window.MediaSource;

  if (mediaSource === undefined) return;
  const originalIsTypeSupported = mediaSource.isTypeSupported.bind(mediaSource);
  mediaSource.isTypeSupported = makeModifiedTypeChecker(originalIsTypeSupported);
}

const makeModifiedTypeChecker = (originalChecker) => (type) => {
  if (typeof type !== 'string') return '';
  const disallowedTypes = ['webm', 'vp8', 'vp9', 'av01'];

  for (const disallowedType of disallowedTypes) {
    if (type.includes(disallowedType)) return '';
  }

  if (block60fps) {
    const match = /framerate=(\d+)/.exec(type);
    if (match && match[1] > 30) return '';
  }

  return typeof originalChecker === 'function' ? originalChecker(type) : '';
};

modifyVideoTypeChecker(); 
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元