Skip to content

Instantly share code, notes, and snippets.

@bugproof
Last active February 24, 2025 06:59
Show Gist options
  • Select an option

  • Save bugproof/98d634b868b2909b47f84b30cbc2e766 to your computer and use it in GitHub Desktop.

Select an option

Save bugproof/98d634b868b2909b47f84b30cbc2e766 to your computer and use it in GitHub Desktop.
ViolentMonkey script to force original quality on Douyin (Chinese TikTok) without being logged in
// ==UserScript==
// @name Stream Quality Override
// @namespace Douyin
// @version 1.0
// @description Maintains high quality stream URLs
// @match https://live.douyin.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const originalFetch = window.fetch;
window.fetch = async (...args) => {
if (args[0].includes('stream-')) {
console.log("Forcing origin quality")
const streamQuality = JSON.parse(__pace_f[7][1])
console.log(streamQuality)
const origin = streamQuality.data.origin.main.flv.replace("http:", "https:")
console.log(origin)
args[0] = origin
}
const response = await originalFetch(...args);
return response;
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment