🏠 Home 

Fck Twitter

F**k twitter!

// ==UserScript==
// @name         Fck Twitter
// @license      MIT
// @namespace    zam157.fck-twit
// @version      0.1.1
// @run-at       document-start
// @description  F**k twitter!
// @author       Zam157
// @homepageURL  https://github.com/zam157/tamper/tree/master/scripts/fck-twit
// @supportURL   https://github.com/zam157/tamper/tree/master/scripts/fck-twit
// @match        https://twitter.com/**
// ==/UserScript==
(() => {
function injectXHRResponse(thisArg, prop = 'response') {
const getter = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, prop).get
Object.defineProperty(thisArg, prop, {
get: () => {
const r###lt = getter.call(thisArg)
if (!r###lt)
return
const json = JSON.parse(r###lt)
const instructions = json.data.home.home_timeline_urt.instructions
const _instructions = instructions.map((instruction) => {
if (instruction.type !== 'TimelineAddEntries')
return instruction
instruction.entries = instruction.entries.filter(entry => !entry.entryId.includes('promoted-tweet'))
return instruction
})
json.data.home.home_timeline_urt.instructions = _instructions
const _r###lt = JSON.stringify(json)
return _r###lt
},
})
}
XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, {
apply(target, thisArg, args) {
if (/HomeTimeline|HomeLatestTimeline/.test(args[1])) {
injectXHRResponse(thisArg, 'response')
injectXHRResponse(thisArg, 'responseText')
}
return target.apply(thisArg, args)
},
})
})()