Simple package to get information about meetups
Project description
Meetup-Notifier
Meetup-Notifier is a simple Python script that collects events from Meetup.com and sends notifications to several platforms. The package is designed to be used as a CLI tool, but it can also be used as a library. It works by scraping the Meetup.com events page and extracting the relevant information from the HTML.
Installation
uv pip install meetup-notifier
Usage
The CLI tool can be used to get a json list of events from a Meetup.com page.
$ meetup-notifier events https://www.meetup.com/generative-ai-on-aws/events/
[{"link": "https://www.meetup.com/generative-ai-on-aws/events/303452518/", "name": "AWS Loft Event: Building Agentic Workflows on AWS (Hands-On Workshop!) (Repeat)", "description": "Hands-on workshop!...
Library
As a library, you can use the get_events
function to get a list of MeetupEvent
objects.
And then send notification to a platform of your choice.
The following example shows how to send notifications to a Telegram chat.
from meetup_notifier import MeetupEvent, get_events
import typer
from typing_extensions import Annotated
from datetime import datetime, timedelta
import requests
from rich.console import Console
app = typer.Typer()
console = Console()
def notify_telegram(event: MeetupEvent, telegram_token: str, telegram_chat_id: str):
url = f"https://api.telegram.org/bot{telegram_token}/sendPhoto"
text = (
f"{time_until_event(event)}\n"
f"📝 [Apúntate aqui]({event.link})\n"
f"📍 [{event.venue}]({event.location_link})\n"
f"🗺️ {event.location}"
)
message_payload = {
"chat_id": telegram_chat_id,
"caption": text,
"photo": event.image,
"parse_mode": "Markdown",
}
response = requests.post(url, data=message_payload)
response.raise_for_status()
console.print(f"📢 Evento enviado a Telegram: {event.name}")
def time_until_event(event: MeetupEvent):
now = datetime.now(event.date.tzinfo) # Use event date timezone
tomorrow_start = (now + timedelta(days=1)).replace(
hour=0, minute=0, second=0, microsecond=0
)
day_after_tomorrow_start = (now + timedelta(days=2)).replace(
hour=0, minute=0, second=0, microsecond=0
)
time_diff = event.date - now
event_time_str = event.date.strftime("%H:%M")
if event.date < now:
return f"❗️ **El evento ya ocurrió** el {event.date.strftime('%Y-%m-%d')} a las {event_time_str} 🕒"
elif now < event.date < tomorrow_start:
return f"🎉 **¡El evento es hoy a las** {event_time_str}**!**"
elif tomorrow_start <= event.date < day_after_tomorrow_start:
return f"⏰ **¡El evento es mañana a las** {event_time_str}**!**"
else:
return f"📅 **El evento será dentro de {time_diff.days} días**"
@app.command()
def notify(
events_url: str = typer.Argument(..., help="URL de la página de eventos de Meetup"),
telegram_token: Annotated[str, "Token de Telegram"] = typer.Option(
help="Token de Telegram",
envvar="TELEGRAM_TOKEN",
),
telegram_chat_id: Annotated[str, "Chat ID de Telegram"] = typer.Option(
help="Chat ID de Telegram",
envvar="TELEGRAM_CHAT_ID",
),
):
if not telegram_token or not telegram_chat_id:
console.print(
"❌ Debes proporcionar un token y un chat ID de Telegram para enviar notificaciones"
)
events = get_events(events_url)
for event in events:
notify_telegram(event, telegram_token, telegram_chat_id)
if __name__ == "__main__":
typer.run(notify)
To run the script, you need to provide the Telegram token and chat ID as environment variables.
uv run --with meetup-notifier example.py "https://www.meetup.com/hiking-valencia/?eventOrigin=event_home_page" --telegram-chat-id TELEGRAM_CHAT_ID --telegram-token TELEGRAM_TOKEN
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file meetup_notifier-0.1.0.tar.gz
.
File metadata
- Download URL: meetup_notifier-0.1.0.tar.gz
- Upload date:
- Size: 69.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44712e2a0a193dfd7cae4433bf69d3a0d479cfa2a16fa1701983dbb569b85543 |
|
MD5 | a35b40f44e1cb785cede6df477852415 |
|
BLAKE2b-256 | e0dc6c3b7ad181320be974739dcdeba19ca9e012535d3e0dc893842a852f4160 |
File details
Details for the file meetup_notifier-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: meetup_notifier-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d062a6a5d7188d3615582a205a05b3a6af2bee03389351ad49fe68a85d36a43c |
|
MD5 | fd54bf4e8fb55698f80f9fe2b8f21bd2 |
|
BLAKE2b-256 | 27b86ee40d9a79c0f97438ffc788b7b7d732573f04356007dab7b1b895e5b2b2 |