Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created a redirector plugin but it did not work. #133

Open
thelastfantasy opened this issue Nov 15, 2016 · 2 comments
Open

Created a redirector plugin but it did not work. #133

thelastfantasy opened this issue Nov 15, 2016 · 2 comments

Comments

@thelastfantasy
Copy link

thelastfantasy commented Nov 15, 2016

My plugin:

{
	"type": "redirector",
	"ns": "nonymous",
	"author": "pks",
	"prefix": "tumblr large image",
	"match": "^http://\d+\\.media\\.tumblr\\.com/.*(?:jpg|png|gif)/i",
	"pattern": "_500\\.(jpg|png|gif)",
	"replacement": "_1280.$1"
}

Match URL: http://66.media.tumblr.com/6b667f014d83a46bc71d1e51827e99bd/tumblr_oglaj2Ytsp1sfv6buo1_500.jpg
Hoped Result: http://66.media.tumblr.com/6b667f014d83a46bc71d1e51827e99bd/tumblr_oglaj2Ytsp1sfv6buo1_1280.jpg

2016-11-15_01
But I only got this, I only know something about regular expression but nothing about coding, can you tell me where is the error?

@thelastfantasy
Copy link
Author

{
    "type": "redirector",
    "ns": "nonymous",
    "author": "pks",
    "prefix": "tumblr large image",
    "match": "^http://\\d+\\.media\\.tumblr\\.com/.*_[45]00\\.(?:jpg|png|gif)$",
    "static": true,
    "pattern": "_[45]00\\.(jpg|png|gif)",
    "replacement": "_1280.$1"
}

After some modifies it's OK now.

@MegaScience
Copy link
Contributor

Keep in mind not all images have a 1280 variant (at least older pages?), so this could toss errors. If I could reliably figure out the highest resolution image without expanding code noticeably, I'd add it to the post Javascript... Maybe it is possible. I do want the code adjusted eventually, anyway, since I'm unhappy with how it locates videos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants