Created
May 12, 2024 22:30
-
-
Save 0xOsprey/fdfaff77fcde48fee7e40646771e5472 to your computer and use it in GitHub Desktop.
Creates a search url for tweets from 1 year ago on Twitter for a specific username
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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