TweetdeckPlayerDisableHLS

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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))
})();