This Python script scrapes the latest news headlines from the Ekantipur website. It uses the requests
library to fetch the webpage content and BeautifulSoup
from the bs4
library to parse the HTML.
- Major Headlines: Extracts and prints the major headlines from the homepage.
- Banner Section: Extracts and prints articles from the banner section.
- Samachar Section: Extracts and prints articles from the Samachar section.
- Python 3.x
requests
librarybeautifulsoup4
library
Install the required libraries using pip:
pip install requests beautifulsoup4
Run the script to print the latest news headlines:
python news_scraper.py
Major Headlines:
गुल्मीमा पहिरोले घर बगाउँदा ४ जनाको मृत्यु
More: https://ekantipur.com/pradesh-5/2024/08/06/4-members-of-the-same-family-died-when-the-house-was-swept-away-by-a-landslide-in-gulmi-01-24.html
--------------------------------------------------------------
सरकारले श्वास फेर्ने हावामा कर लगाउने कानुन ल्याउन मात्रै बाँकी छ : सांसद शर्मा:
कांग्रेस सांसद डा. सुनिल शर्माले सरकारले जनताले सास फेर्ने हावामा कर लगाउने कानुन ल्याउन मात्रै बाँकी रहेको बताएका छन् ।
More: https://ekantipur.com/news/2024/08/06/all-that-is-left-for-the-government-is-to-bring-a-law-to-tax-breathing-air-mp-sharma-23-56.html
...
This project is licensed under the MIT License.