首页 > 其他分享 >解决stackoverflow.com网站下imgur站点的图片不显示问题

解决stackoverflow.com网站下imgur站点的图片不显示问题

时间:2023-01-29 16:02:23浏览次数:56  
标签:redirect frame stackoverflow imgur font com

缘由:是因为了我看了这个帖子和帖子评论,为了解决帖子里的问题,才搜到的解决办法,同时还包括下载浏览器扩展,还有想看看人家扩展是怎么写的!

办法来源参考: 图片镜像缓存服务—防盗链图片、imgur 等国内无法访问图片的解决方案

依据上述解决办法,简单加工改造写了4种解决办法(也就是4条规则)

说明: 办法仅供参考,自己用自己配置即可 (参考自定义规则)

规则1:

{
    "id": 1,
    "priority": 200,
    "action": {
      "type": "redirect",
      "redirect": {
        "regexSubstitution": "https://images.weserv.nl/?url=\\1"
      }
    },
    "condition": {
      "regexFilter": "(.*?)",
      "requestDomains": ["imgur.com"],
      "initiatorDomains": ["stackoverflow.com"],
      "resourceTypes": [
        "main_frame",
        "sub_frame",
        "stylesheet",
        "script",
        "image",
        "font",
        "object",
        "xmlhttprequest",
        "ping",
        "csp_report",
        "media",
        "websocket",
        "webtransport",
        "webbundle",
        "other"
      ]
    }
  }

规则2

[
    {
        "id": 2,
        "priority": 100,
        "action": {
          "type": "redirect",
          "redirect": {
            "regexSubstitution": "https://img.noobzone.ru/getimg.php?url=\\2"
          }
        },
        "condition": {
          "regexFilter": "(http[s]{0,1}://)(.*?)",
          "requestDomains": ["imgur.com"],
          "initiatorDomains": ["stackoverflow.com"],
          "resourceTypes": [
            "main_frame",
            "sub_frame",
            "stylesheet",
            "script",
            "image",
            "font",
            "object",
            "xmlhttprequest",
            "ping",
            "csp_report",
            "media",
            "websocket",
            "webtransport",
            "webbundle",
            "other"
          ]
        }
      },
      {
        "id": 3,
        "priority": 100,
        "action": {
          "type": "modifyHeaders",
          "requestHeaders": [
            {
              "header": "referer",
              "operation": "remove"
            }
          ]
        },
        "condition": {
          "urlFilter": "img.noobzone.ru/getimg.php",
          "requestDomains": ["img.noobzone.ru"],
          "initiatorDomains": ["stackoverflow.com"],
          "resourceTypes": [
            "main_frame",
            "sub_frame",
            "stylesheet",
            "script",
            "image",
            "font",
            "object",
            "xmlhttprequest",
            "ping",
            "csp_report",
            "media",
            "websocket",
            "webtransport",
            "webbundle",
            "other"
          ]
        }
      }
]

规则3

{
    "id": 4,
    "priority": 100,
    "action": {
      "type": "redirect",
      "redirect": {
        "regexSubstitution": "https://pic1.xuehuaimg.com/proxy/\\2"
      }
    },
    "condition": {
      "regexFilter": "(http[s]{0,1}://)(.*?)",
      "requestDomains": ["imgur.com"],
      "initiatorDomains": ["stackoverflow.com"],
      "resourceTypes": [
        "main_frame",
        "sub_frame",
        "stylesheet",
        "script",
        "image",
        "font",
        "object",
        "xmlhttprequest",
        "ping",
        "csp_report",
        "media",
        "websocket",
        "webtransport",
        "webbundle",
        "other"
      ]
    }
  }

规则4

{
    "id": 5,
    "priority": 100,
    "action": {
      "type": "redirect",
      "redirect": {
        "regexSubstitution": "https://search.pstatic.net/common?src=\\1"
      }
    },
    "condition": {
      "regexFilter": "(.*?)",
      "requestDomains": ["imgur.com"],
      "initiatorDomains": ["stackoverflow.com"],
      "resourceTypes": [
        "main_frame",
        "sub_frame",
        "stylesheet",
        "script",
        "image",
        "font",
        "object",
        "xmlhttprequest",
        "ping",
        "csp_report",
        "media",
        "websocket",
        "webtransport",
        "webbundle",
        "other"
      ]
    }
  }

以上规则全在这里

参考文档

标签:redirect,frame,stackoverflow,imgur,font,com
From: https://www.cnblogs.com/jingjingxyk/p/17072914.html

相关文章