Skip to content

Instantly share code, notes, and snippets.

@0xOsprey
Created August 6, 2024 01:47
Show Gist options
  • Save 0xOsprey/2be68e0559add37c459978f63140d873 to your computer and use it in GitHub Desktop.
Save 0xOsprey/2be68e0559add37c459978f63140d873 to your computer and use it in GitHub Desktop.
Archive.is Opener - Raycast Script
#!/usr/bin/python3
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Archive Opener
# @raycast.mode compact
# Optional parameters:
# @raycast.icon 🤖
# Documentation:
# @raycast.description Open copied urls on Archive.is to help remove paywalls
# @raycast.author Joe Coll
# @raycast.authorURL https://raycast.com/Osprey
import pyperclip, webbrowser
from urllib.parse import urlparse
def is_valid_url(url):
try:
result = urlparse(url)
return all([result.scheme, result.netloc])
except ValueError:
return False
# Check if the clipboard content is a valid URL
if is_valid_url(pyperclip.paste()):
webbrowser.open(f"https://archive.is/{pyperclip.paste()}")
else:
print("Invalid URL in clipboard")
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment