rewrite

package
v2.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PredefinedRefererRules = []RefererRule{
	{
		URLPattern: regexp.MustCompile(`^https://\w+\.sinaimg\.cn`),
		Referer:    "https://weibo.com",
	},
	{
		URLPattern: regexp.MustCompile(`^https://i\.pximg\.net`),
		Referer:    "https://www.pixiv.net",
	},
	{
		URLPattern: regexp.MustCompile(`^https://cdnfile\.sspai\.com`),
		Referer:    "https://sspai.com",
	},
	{
		URLPattern: regexp.MustCompile(`^https://(?:\w|-)+\.cdninstagram\.com`),
		Referer:    "https://www.instagram.com",
	},
	{
		URLPattern: regexp.MustCompile(`^https://sp1\.piokok\.com`),
		Referer:    "https://sp1.piokok.com",
	},
}

List of predefined referer rules

Functions

func GetRefererForURL added in v2.2.3

func GetRefererForURL(url string) string

GetRefererForURL returns the referer for the given URL if it exists, otherwise an empty string.

func Rewriter

func Rewriter(entryURL string, entry *model.Entry, customRewriteRules string)

Rewriter modify item contents with a set of rewriting rules.

Types

type RefererRule added in v2.2.3

type RefererRule struct {
	URLPattern *regexp.Regexp
	Referer    string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL