To scrape daily motivational quotes, you would typically use a Python script with libraries such as requests, BeautifulSoup, or even automation tools like Selenium if the site is JavaScript-heavy. Here’s a basic example using requests and BeautifulSoup to scrape quotes from https://www.brainyquote.com:
What this script does:
-
Accesses the “Quote of the Day” page.
-
Parses the page HTML.
-
Extracts the
altattribute of the main quote image, which contains the quote text.
To run this daily:
-
Set it up in a cron job (Linux/macOS) or Task Scheduler (Windows).
-
Or integrate it into a web app or automation service like Zapier or Integromat using webhooks and APIs.
Let me know if you’d like a version that sends the quote via email, stores it in a file/database, or posts it to social media automatically.