Greasy Fork

Greasy Fork is available in English.

去除广告模块

过滤掉响应体中未关注的用户(不包括快转)

当前为 2021-06-23 提交的版本,查看 最新版本

// ==UserScript==
// @name            去除广告模块
// @name:zh         去除广告模块
// @namespace       Violentmonkey Scripts
// @match            *://*.weibo.com/*
// @include          *://weibo.com/*
// @grant            none
// @version          1.9
// @author          fbz
// @description     过滤掉响应体中未关注的用户(不包括快转)
// @description:zh  过滤掉响应体中未关注的用户(不包括快转)
// @require         https://unpkg.com/[email protected]/dist/ajaxhook.min.js
// ==/UserScript==
(function(){
  ah.proxy({
      //请求成功后进入
      onResponse: (response, handler) => {
          const url = response.config.url
          let res = response.response
          
          if (url.includes('unreadfriendstimeline') && res){
            res = JSON.parse(res)
            res.statuses = res.statuses.filter(item => item.user.following || item.screen_name_suffix_new)
            response.response = JSON.stringify(res)
          }
          handler.next(response)
      }
  })
})()