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

Naver.net redirector plugin #140

Open
Shigeto1 opened this issue May 30, 2017 · 0 comments
Open

Naver.net redirector plugin #140

Shigeto1 opened this issue May 30, 2017 · 0 comments

Comments

@Shigeto1
Copy link

I'm trying to modify the following naver plugin to work with an alternate subdomain of naver.net:

{
	"type": "redirector",
	"author": "1z2x1z",
	"ns": "naver.net",
	"prefix": "naver.net_JPG",
	"match": "^https?://blogfiles.naver.net/[A-Za-z0-9._~-]+/[A-Za-z0-9._~-]+/[A-Za-z0-9._~%-]+.jpg\\?type=w[1-9]+",
	"pattern": "jpg\\?type=w[1-9]+",
	"replacement": "jpg"
}

The subdomain looks like this:

http://mimgnews1.naver.net/image/origin/433/2017/05/29/30725.jpg?type=wc318_q90
http://mimgnews2.naver.net/image/origin/433/2017/05/29/30730.jpg?type=wc318_q90
http://mimgnews1.naver.net/image/origin/117/2016/12/24/2856261.jpg?type=nfc135_124_q90
http://mimgnews2.naver.net/image/origin/011/2017/05/29/3041474.jpg?type=nfc135_124_q90
and
http://mimgnews1.naver.net/image/origin/433/2017/05/29/30732.jpg?type=m1920_1080
http://mimgnews2.naver.net/image/origin/433/2017/05/29/30733.jpg?type=m1920_1080

The url I'm trying to redirect to would be:

http://mimgnews[1-2].naver.net/image/origin/433/2017/05/29/30725.jpg

I don't know anything about regex or javascript but this was the best I could come up with:

{
	"type": "redirector",
	"author": "test",
	"ns": "naver.net",
	"prefix": "naver x dispatch HD",
	"match": "^https?://mimgnews[1-2]{1}.naver.net/image/origin/[0-9]{3}/[0-9]{4}/[0-9]{2}/[0-9]{2}/[A-Za-z0-9._~%-]+.jpg\\?type=[a-zA-Z0-9_]+",
	"pattern": "jpg\\?type=[a-zA-Z0-9_]+",
	"replacement": "jpg"
}

Ideally I would like the plugin to work for both types of links but for testing I'm only using the first type (http://mimgnews1.naver.net/image/origin/433/2017/05/29/30734.jpg?type=wc318_q90).

I'm not positive the regex string is even correct however I tested it with the following javascript:

    var str = "http://mimgnews1.naver.net/image/origin/433/2017/05/29/30734.jpg?type=wc318_q90";
    var patt = new RegExp("^https?://mimgnews[1-2]{1}.naver.net/image/origin/[0-9]{3}/[0-9]{4}/[0-9]{2}/[0-9]{2}/[A-Za-z0-9._~%-]+.jpg\\?type=[a-zA-Z0-9_]+");
    var res = patt.test(str);

The script returned a 'true' result which as far as I know indicates the regex pattern is a match, but the plugin does not work as intended. After opening the webpage I'm trying to rip with DTA, I can see the image links but the thumbnail ?type suffixes have not been removed as seen here:

output

This is all pretty new to me and I'm not sure what I'm doing wrong. Any help would be greatly appreciated.

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

1 participant