EXTRACT NEWS FR
The "NEWS FR" module allows for the extraction of online press articles from over a hundred different sources.
Installation
To set up the module, follow the steps below:
Database Setup:
- Create a database and incorporate the two tables present in
database.sql
.
- Create a database and incorporate the two tables present in
Database Configuration:
- Update your MySQL connection information in the
config.py
file.
- Update your MySQL connection information in the
Dependencies Installation:
- Install it using pip install:
pip install aiohttp mysql-connector-python beautifulsoup4 chardet colorama pyquery
- Install it using pip install:
Usage
1_extract_rss.py:
This script fetches RSS feeds from various media outlets and adds URLs for further extraction.
python 1_extract_rss.py
2_extract_news.py:
This script retrieves the sources of articles for subsequent local processing.
python 2_extract_news.py
3_extract_news_txt.py:
This script extracts the text content of press articles and saves it (title + description + text) to a .txt
file.
python 3_extract_news_txt.py
After completing this step, you can use the Python script located at /dataset/2_cleaning_txt.py to standardize the text for your dataset.
4_extract_news_url.py:
This script allows for the extraction of links to other articles from local article sources. This ensures swift retrieval of numerous past articles, as opposed to fetching only the most recent ones.
php 4_extract_news_url.py
After using this script, you'll need to run 2_extract_news.py again to retrieve the sources of the new articles, as well as 3_extract_news_txt.py to extract the text from these articles.