去除广告模块

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

目前为 2021-06-28 提交的版本。查看 最新版本

// ==UserScript==
// @name            去除广告模块
// @name:zh         去除广告模块
// @namespace       Violentmonkey Scripts
// @match            *://*.weibo.com/*
// @include          *://weibo.com/*
// @exclude          *://weibo.com/tv*
// @grant            none
// @version          2.2
// @author          fbz
// @description     过滤掉响应体中未关注的用户(不包括快转)
// @description:zh  过滤掉响应体中未关注的用户(不包括快转)
// @require         https://unpkg.com/[email protected]/dist/ajaxhook.min.js
// ==/UserScript==
(function(){
  ah.proxy({
      //请求发起前进入
      onRequest: (config, handler) => {
          // console.log(config.url)
          handler.next(config);
      },
      //请求发生错误时进入,比如超时;注意,不包括http状态码错误,如404仍然会认为请求成功
      onError: (err, handler) => {
          // console.log(err.type)
          handler.next(err)
      },
      //请求成功后进入
      onResponse: (response, handler) => {
          const url = response.config.url
          let res = response.response
          
          if (url.includes('friendstimeline') && 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)
      }
  })
})()

QingJ © 2025

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