作為一個經常買東西的人,上淘寶選商品也是一件麻煩事
曾經做過淘寶,知道里面一些門路,那就是說dsr3紅的商品,一般來說都會比三綠靠譜很多
dsr是質量,服務,快遞3個方向的評分,紅色代表行業持平或者超過行業平均,都是買家打評分統計出來的

所以過濾掉有綠色的商品,只要3紅,能節省不少時間,也不容易買到差的商品
首先就是分析紅和綠是怎么個情況
打開開發者模式,可以看到綠色的class是dsr lessthan,就是dsr低於行業平均,所以判斷這個class就行

商品列表也可以通過class來獲取

所以只要先獲取這些item,然后一個個循環判斷dsr是不是lessthan就行
最后給綠色的item加上一個style,item.setAttribute('style', 'display: none !important');
之前發現單獨設置display:none無法過濾廣告,要加一個import才能屏蔽
效果如下,開啟前

開啟后,需要等3秒鍾(等待頁面加載完成,會有彈窗提示)

代碼如下
// ==UserScript== // @name 淘寶dsr過濾 // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @include *://s.taobao.com/* // @grant none // ==/UserScript== (function() { 'use strict'; function Toast(msg,duration){ duration=isNaN(duration)?3000:duration; var m = document.createElement('div'); m.innerHTML = msg; m.style.cssText="max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 10%;left: 90%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;"; document.body.appendChild(m); setTimeout(function() { var d = 0.5; m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; m.style.opacity = '0'; setTimeout(function() { document.body.removeChild(m) }, d * 1000); }, duration); } setTimeout(function () { var items = document.getElementsByClassName('item J_MouserOnverReq'); if(items.length > 0){ for (let index = 0; index < items.length; index++) { var item = items[index]; var dsrs = item.getElementsByClassName('dsr'); if(dsrs[0].getAttribute('class') == 'dsr lessthan'){ item.setAttribute('style', 'display: none !important'); continue } if(dsrs[1].getAttribute('class') == 'dsr lessthan'){ item.setAttribute('style', 'display: none !important'); continue } if(dsrs[2].getAttribute('class') == 'dsr lessthan'){ item.setAttribute('style', 'display: none !important'); continue } } } Toast('過濾完成',2000); }, 3000); })();
新建一個腳本,復制進去就行
