TweetdeckPlayerDisableHLS

Tweetdeck等の動画プレイヤーで画質が可変になるのをなんとかするやつ(なんとかできないときもある)

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         TweetdeckPlayerDisableHLS
// @namespace    https://rinsuki.net/
// @version      0.1
// @description  Tweetdeck等の動画プレイヤーで画質が可変になるのをなんとかするやつ(なんとかできないときもある)
// @author       rinsuki
// @match        https://twitter.com/i/videos/tweet/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    var params = location.search.slice(1).split("&").map(a => {
        a = a.split("=")
        var name = a[0]
        var value = a.slice(1).join("=")
        return [name, decodeURIComponent(value)]
    }).reduce((obj, [k, v]) => ({...obj, [k]: v}), {})
    var dom = document.getElementById("playerContainer")
    var attrName = "data-config"
    var json = JSON.parse(dom.getAttribute(attrName))
    console.log(params)
    if (!params.content_type || !params.video_url) return
    json.content_type = params.content_type
    json.video_url = params.video_url
    dom.setAttribute(attrName, JSON.stringify(json))
})();