1.7 KiB
1.7 KiB
+++ title = "salatime" summary = "[OBSOLETE] Basic terminal script to print out daily prayer times for Birmingham, AL." date = 2019-05-09 authors = ["Abdullah Tarawneh"] tags = ["python", "web scraping", "scraping", "beautifulsoup", "salat", "prayer", "time"] categories = ["Code"] aliases = [ "/code/salatime", ] +++
The problem
While working in a terminal environment, I would like to know what the current active prayer is, how much time I have left to pray, time to next prayer, and other such information.
The research
The Birmingham Islamic Society provides tables of prayer times by month. This table can be scraped with Python Requests, then parsed with BeautifulSoup.
The solution
Source code is available at https://github.com/trwnh/salatime
Pseudocode is as follows:
- Get the current month, day, hour, and minute.
- Get the page for the current month.
- Get the times table out of this page.
- Parse this table for a list of prayer times.
- Parse this list for the current day's prayer times.
- Calculate and print information.