Fck Twitter

F**k twitter!

  1. // ==UserScript==
  2. // @name Fck Twitter
  3. // @license MIT
  4. // @namespace zam157.fck-twit
  5. // @version 0.1.1
  6. // @run-at document-start
  7. // @description F**k twitter!
  8. // @author Zam157
  9. // @homepageURL https://github.com/zam157/tamper/tree/master/scripts/fck-twit
  10. // @supportURL https://github.com/zam157/tamper/tree/master/scripts/fck-twit
  11. // @match https://twitter.com/**
  12. // ==/UserScript==
  13.  
  14. (() => {
  15. function injectXHRResponse(thisArg, prop = 'response') {
  16. const getter = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, prop).get
  17. Object.defineProperty(thisArg, prop, {
  18. get: () => {
  19. const result = getter.call(thisArg)
  20. if (!result)
  21. return
  22.  
  23. const json = JSON.parse(result)
  24. const instructions = json.data.home.home_timeline_urt.instructions
  25.  
  26. const _instructions = instructions.map((instruction) => {
  27. if (instruction.type !== 'TimelineAddEntries')
  28. return instruction
  29.  
  30. instruction.entries = instruction.entries.filter(entry => !entry.entryId.includes('promoted-tweet'))
  31. return instruction
  32. })
  33.  
  34. json.data.home.home_timeline_urt.instructions = _instructions
  35. const _result = JSON.stringify(json)
  36. return _result
  37. },
  38. })
  39. }
  40.  
  41. XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, {
  42. apply(target, thisArg, args) {
  43. if (/HomeTimeline|HomeLatestTimeline/.test(args[1])) {
  44. injectXHRResponse(thisArg, 'response')
  45. injectXHRResponse(thisArg, 'responseText')
  46. }
  47.  
  48. return target.apply(thisArg, args)
  49. },
  50. })
  51. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址