Login About Gallery
Clean Up URL
Accepts
Text, Rich Text and URLs
COMMENT
‎Clean Up URL v1.0 2022-08-21 https://routinehub.co/shortcut/12855/ This Shortcut cleans up URLs, removing tracking data and other useless attributes. When copying URLs from social platforms or search engines, those sites often include extra data in them to track users and where they got those addresses. This will remove all of the “query” or “search” params. In simpler terms, everything after the ‘?’ in the URL will be removed, including said punctuation. The only exception is the video ID in YouTube URLs. More exceptions may be added later. Be careful when initially using this Shortcut, as YMMV. It may do too much or too little for you. Change Log v1.0 2022-08-21 Initial release.
SCRIPTING
‎Get type of ‎Shortcut Input
SCRIPTING
‎If ‎Type ‎is ‎URL
VARIABLES
‎Get ‎Shortcut Input
SCRIPTING
‎Otherwise
SCRIPTING
‎Ask ‎Input URL
Input Type
‎URL
Default Answer
‎Text
SCRIPTING
‎End If
SCRIPTING
‎Get type of ‎If Result
SCRIPTING
‎If ‎Type ‎is ‎URL
DOCUMENTS
‎Replace ‎' ‎with ‎\' ‎in ‎If Result
Case Sensitive
Regular Expression
SCRIPTING
‎Otherwise
SCRIPTING
‎Show ‎Provided input is not a valid URL.
SCRIPTING
‎Exit shortcut with ‎Result
SCRIPTING
‎End If
TEXT
‎<!doctype html> <title>script</title> <div id="output"></div> <script> const cleanUpUrl = urlStr => { const url = new URL(urlStr) const { searchParams: params } = url const keep = [] switch (true) { case /(.+\.)?youtube\.com$/.test(url.hostname): keep.push('v') break } for (const key of params.keys()) { if (keep.includes(key)) continue params.delete(key) } return url.toString() } document.getElementById('output').innerHTML = cleanUpUrl(' ‎Updated Text ‎') </script>
SCRIPTING
‎Mode ‎Text ‎with base64
URL
‎data:text/html;base64, ‎Base64 Encoded
SAFARI
‎Get contents of web page at ‎URL
DOCUMENTS
‎Get text from ‎Contents of Web Page
SCRIPTING
‎If ‎WFInput? ‎is not ‎<value>
SHARING
‎Copy ‎Text ‎to clipboard
Local Only
Expire At
‎Today at 3 pm
SCRIPTING
‎Show ‎Text
SCRIPTING
‎End If
MISSING
‎output Under Construction

Showcuts

Magic Vars

Screenshot

Submitted Anonymously 2 years ago

Visit iCloud (iOS)

Copy iCloud Link

Scan QR Code

0