{"id":19893001,"url":"https://github.com/kevinfjiang/nbatextalerts","last_synced_at":"2026-06-12T15:31:07.116Z","repository":{"id":53551387,"uuid":"350946110","full_name":"kevinfjiang/NBATextAlerts","owner":"kevinfjiang","description":"Notifies user when Ben Simmons (or any player) shoots a 3 (or any other statistic)","archived":false,"fork":false,"pushed_at":"2022-01-01T19:31:33.000Z","size":359,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-28T02:57:57.412Z","etag":null,"topics":["alert","bot","fun","nba","notification-service","webscraper","webscraping"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevinfjiang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-24T04:31:41.000Z","updated_at":"2022-01-01T19:31:36.000Z","dependencies_parsed_at":"2022-09-09T09:51:01.848Z","dependency_job_id":null,"html_url":"https://github.com/kevinfjiang/NBATextAlerts","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"purl":"pkg:github/kevinfjiang/NBATextAlerts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinfjiang%2FNBATextAlerts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinfjiang%2FNBATextAlerts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinfjiang%2FNBATextAlerts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinfjiang%2FNBATextAlerts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinfjiang","download_url":"https://codeload.github.com/kevinfjiang/NBATextAlerts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinfjiang%2FNBATextAlerts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34251774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alert","bot","fun","nba","notification-service","webscraper","webscraping"],"created_at":"2024-11-12T18:26:45.222Z","updated_at":"2026-06-12T15:31:07.095Z","avatar_url":"https://github.com/kevinfjiang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NBATextAlerts  \n**Notifies user when Ben Simmons (or any player) shoots a 3 (or any other statistic)**\n\nHi r/NBA,\n\nTL:DR; I created a program that automatically texts you \nwhenever Ben Simmons makes a 3 and it runs every 76ers game. Last week Ben Simmons made\na 3, and I don't have time to watch every 76ers game waiting \nfor him to hit another. Thus, I created a bot that will automatically\ntext me ~~when~~ if he makes a 3 again. I created this at the request of my brother.\n\n\u003cspan style=\"background-color: #FFFF00\"\u003eThis code only works for Mac, sorry!\u003c/span\u003e\n\n## 0. Install packages, Run:\nDownload the entire repository and unzip. Place the folder NBATextAlerts whereever you typicall put your code\n\n    terraform init\n    terraaform apply\n    pip install -r requirements.txt\n\nAlso, install [chromedriver](https://chromedriver.chromium.org/downloads) for the latest version of chrome\n\n## 1. Text Messaging Set Up: \n[Twilio Link](https://www.twilio.com/)  \nFirst sign up for a Twilio account, input \nyour email and phone number.   \nYou can fill out random stuff for the information about \nthe project. You can only text one number per account,\nso to text multiple people, you gotta sign up multiple times\n\n\nNote: You have a limit to the number of texts. You get allocated 14 dollars and each text \"costs\"\n.07 cents, so you get 200 texts per account (more than enough for me)\n\nNow after you sign up go to the home tab in the top left and click Dashboard. \nCreate a new phone number, and you should see something similar. Then open \u003cspan style=\"background-color: #FFFF00\"\u003eAlerts.py\u003c/span\u003e,\nin the NBATextAlerts Folder and add the \u003cspan style=\"background-color: #FFFF00\"\u003eACCOUNT SID\u003c/span\u003e, \u003cspan style=\"background-color: #FFFF00\"\u003eAUTH TOKEN\u003c/span\u003e, and \u003cspan style=\"background-color: #FFFF00\"\u003ePHONE NUMBER\u003c/span\u003e \naccording to Alerts.py. See below for more information\n\n\u003cp align=\"center\"\u003e \n    \u003cimg src=\"https://github.com/kevinjiang019/NBATextAlerts/blob/c300dd4abe7a7df69d9a21f65be7e16ef8a1c795/Twilio%20%202.png\" height=\"480\" width=\"520\" /\u003e\n\u003c/p\u003e   \n\n## 2. Player and Event set up:\nOpen \u003cspan style=\"background-color: #FFFF00\"\u003ePATH.py\u003c/span\u003e in NBATextAlerts. Add the full name (with proper capitalization) and the event\nto happen (ie 3 pointer, rebounds etc). Add to the dictionary for custom events based on the espn play by play text so check you have to check\nout prior espn play-by-plays. Check out later in the text to figure find what the connstants that the web scraper will be searched for labled \n\u003cspan style=\"background-color: #FFFF00\"\u003ePLAYER\u003c/span\u003e, \u003cspan style=\"background-color: #FFFF00\"\u003eEVENT\u003c/span\u003e, \u003cspan style=\"background-color: #FFFF00\"\u003eTEAM\u003c/span\u003e in \u003cspan style=\"background-color: #FFFF00\"\u003ePATH.py\u003c/span\u003e.\n\n\n## 3. Schedule Set Up:\nOnce all that is taken care of, and you're in the NBATextAlerts directory run: \n\n    python setup.py  \nHere's what it does:  \n\n1. Runs a web scraper(spider) that collects all nba team schedules and start and approximate end times and puts them in a folder on the desktop called \"Nba Schedules\"\n2. Creates a cronjob to update these schedules weekly (On sunday at 11 am, which is changeable)\n3. Creates a cronjob to run gameCheckBot.py daily at 11 am.\n\n\n## 3b. Inputs during game day:\nWhile the code is running, it will ask you if you wanna \"break loop\" in the new opened terminal. Input yes to manually terminate the program.\nOtherwise, it will auto terminate after the expected end game time.\n\nIf all you want are text alerts and you set everything up. You're all done. Assuming you set up Twilio properly, you will receive automated text alerts whenever your \nplayer does the specified action. Essentially if you let it run daily and your computer isn't off during a scheduled run time, you will always receive texts.\n\n## π. How it works:\nI'm a student, so I will explain my design decisions by file going by file.\nI used crontab to automate this task mostly. This will be less in depth and more about the design philosophies\n\n**PATH.py**  \n  Houses all the constants(player name, event)used and paths to files. For certain files, such as python or the directory location,\nPATH.py will run a function to find the path, so you can store NBATextAlerts theoretically anywhere.\n\n**setup.py**    \nsetup.py just creates the cronjobs aforementioned. It also runs a spider that collects NBA schedules which we will discuss next\n\n**NBA.NBA.spiders.espn_spidery.py**  \nThis scrapes all \"https://www.espn.com/nba/team/schedule/_/name/\" for all teams and creates a folder of csvs\non your desktop of all schedules. It does this using scrapy and since the espn site is well formatted, grabs rows\nand puts the locations into the csv cells. The start time, date, and link are self-explanatory, but the end time is\nthe start time + 2h45m since that's the length of a basketball game + overtime.\n\n**botHelper.py**  \nsetup.py also runs botHelper.py daily. Everyday, botHelper.py checks if there's a game for the specified team.\nIf there is based on the csv file for the team, it collects the row for today's game and processes the info. It then will \ncreate a cronjob for the start time of the game. It then closes. Then, when it's time for the game, the cronjob will use botHelper.py\nand will see the game has started, thus deploying gameCheckBot.py. It will also remove the cronjob when the bot deploys so every day, the only cronjobs\nare the ones from **setup.py**. The cronjob will open a new terminal as cronjob doesn't handle input/outputs well, so don't be surprised.\n\n**gameCheckBot.py**  \nHere's the bulk. So this bot uses selenium and begins by getting the path to chrome driver. Then it opens the page for the \nplay-by-play tab of tonights game. Since the gameid is predetermined, you can always access the play-by-play tab, although \nit may be empty. If it is empty, the scraper won't return anything and the program will sleep for 10 seconds and try again.  \n\nThe webscraper mechanism is controlled using threading, running 3 simultaneous programs. The most important is loopEvent()\n\n1. **loopEvent()**: constantly checks the latest game detail. It then compares the latest to the criteria stataed in PATH.py.\nIf it matches, it records the time-stamp and the combined-score, if all 3, the text, time, and score, are new, it will add it \n   to a previously seen list and notify you the criteria have been met. Otherwise, it ignores it. \n2. **manualTerminate()**: it constantly checks for the input. If 'yes' is input, it will terminate, otherwise it loops\n3. **ScheduledTerminate()**: if the actual time passes expected game end time, the program will terminate. Feel free to \n   change expected game end time in the CSV or in espn_spider.py\n   \nWhen either **2.** or **3.** meet their end condition, they end the loop of **loopEvent()** and exit the bot.\n\n## 4. Closing Thoughts\nIf you made it this far, thank you so much for reading this. I appreciate anyone who took the time to look. \nI'd like to thank primarily my brother who gave me the idea. I'd also like to thank my stats grade for sacrificing \nitself for this project. Once again, I am a student, so I appreciate any and all constructive feedback, nor will I claim \nI am the only person with this silly idea. I have considrered creating a bot that tweets at Simmons everytime he makes a 3.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinfjiang%2Fnbatextalerts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinfjiang%2Fnbatextalerts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinfjiang%2Fnbatextalerts/lists"}