Skip to content

Instantly share code, notes, and snippets.

@0xOsprey
Created August 6, 2024 19:00
Show Gist options
  • Save 0xOsprey/23850b3b34a835757a5673f62a1a0a8e to your computer and use it in GitHub Desktop.
Save 0xOsprey/23850b3b34a835757a5673f62a1a0a8e to your computer and use it in GitHub Desktop.
Raycast Script to search for a Twitter users's tweets from a year ago - replace line 32 with the username you want to search for
#!/usr/bin/python3
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Rewind Twitter Search
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🦅
# @raycast.packageName Developer Util
# Documentation:
# @raycast.author Joe Coll
# @raycast.authorURL https://github.com/0xOsprey
import webbrowser
from datetime import date, timedelta
# Get the current date
today = date.today()
# Calculate the dates for one year ago
one_year_ago = today - timedelta(days=366)
start_date = one_year_ago
end_date = start_date + timedelta(days=1)
# Format the dates as strings in the required format
start_date_str = start_date.strftime('%Y-%m-%d')
end_date_str = end_date.strftime('%Y-%m-%d')
# Construct the Twitter search URL with the updated dates
twitter_search_url = f"https://twitter.com/search?q=(from%3A0x_Osprey)%20until%3A{end_date_str}%20since%3A{start_date_str}&src=typed_query"
# Open the URL in the default web browser
webbrowser.open(twitter_search_url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment