downthemall / anticontainer

DownThemAll! AntiContainer (Extension to a Firefox, Seamonkey extension)
Mozilla Public License 2.0
93 stars 41 forks source link

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

Open thelastfantasy opened 7 years ago

thelastfantasy commented 7 years ago

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 commented 7 years ago
{
    "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 commented 7 years ago

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.