Skip to content

A small project to get news from BBC - CNN - Telemundo - Euronews

Notifications You must be signed in to change notification settings

gaborgr/news-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

📰 News Scraper

About the APP

Welcome to News Scraper, an application I built to explore web scraping and understand its potential for automating data extraction. This tool fetches the top 5 news articles from popular sources like CNN, BBC, Telemundo, and Euronews, and displays them in a user-friendly interface using Python’s Tkinter library.

📋 Features

  • Interactive Interface: A simple graphical interface powered by Tkinter.
  • One-Click Scraping: Fetches and displays news headlines and clickable links with a single click.
  • Real-Time Updates: Clears old results and fetches fresh news on every scrape.
  • Cross-Platform Compatibility: Runs seamlessly on any system with Python installed.

🛠️ Requirements

Before running the application, ensure the following Python libraries are installed:

import tkinter as tk  
from tkinter import scrolledtext  
import requests  
from bs4 import BeautifulSoup  
from googletrans import Translator  
import threading  
import time  
import webbrowser

Use pip install <library_name> to install any missing dependencies.

🚀 How It Works

News Sources

The app targets specific news websites using a dictionary of URLs:

Scraper Engine

The scraper iterates through the dictionary to extract news headlines and links:

  1. Clear Previous Results: Clears the display area for new data.
  2. Fetch Content: Uses BeautifulSoup to parse the HTML of each site.
  3. Extract Data: Finds specific HTML tags to fetch titles and links for each article.
  4. Display Data: Outputs the news title and a clickable link in the result box.

Here’s an example:

🎨 Interface Customization

  • Button: Created with tk.Button to define its size, font, and label.
  • Scrollable Results Area: Built using scrolledtext.ScrolledText, allowing styled text display.
  • Styled Text: Configured with result_box.tag_config for bold headlines, title fonts, and clickable links.
  • Clock Widget: Displays the current time using tk.Label and updates every second via time.strftime. The clock runs on a separate thread to ensure smooth performance.

🌟 How to Run

  1. Clone the repository.
  2. Install the required libraries.
  3. Run the script using python app.py.
  4. Interact with the GUI to fetch and view news articles.

🤝 Contribution

I’m open to suggestions! Feel free to fork this repository, improve the code, and submit a pull request. Let’s make this tool even better together.

About

A small project to get news from BBC - CNN - Telemundo - Euronews

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages