Skip to content

Instantly share code, notes, and snippets.

View camAtGitHub's full-sized avatar
🥔

Cam camAtGitHub

🥔
  • [Redacted]
  • Australia
View GitHub Profile

Basic How-to

to can have multiple lines, every one of them will be converted to a result URL. If # is the first character in a line then it marks the URL as hi-res.

If # is not the first then it may be followed by space separated strings closed by a # sign again. This will generate URLs for every variant. E.g. some.url/path/full-image.#jpg png gif#, which will generate three URLs, testing them in order.

Also, at the end of the line you can add #{media_extension} eg: #jpg, so the the extension will recognize it as video or audio, instead of image (default). E.g., https://some.url/path/without/extension?id=13#mp4

Javascript RegExp is used (obviously). In the code it's simply RegExp('yourRegexInput'). The conversion happens with a simple URL.replace(yourRegex, rule.to).