Skip to content

The News Aggregator project is a Django-based application that fetches news articles from an RSS feed, matches them with trending topics from Google Trends, and enriches the news articles with sentiment scores using OpenAI's GPT-3.5-turbo model. The application supports translation of trends into Ukrainian language.

Notifications You must be signed in to change notification settings

LIcsq/News-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News Aggregator Project Documentation

Table of Contents

  1. Introduction
  2. Project Structure
  3. Installation
  4. Configuration
  5. Running the Project
  6. Management Commands
  7. API Endpoints
  8. Tasks
  9. Models
  10. Utilities
  11. Logging

Introduction

The News Aggregator project is a Django-based application that fetches news articles from an RSS feed, matches them with trending topics from Google Trends, and enriches the news articles with sentiment scores using OpenAI's GPT-3.5-turbo model. The application supports translation of trends into Ukrainian language.

Project Structure

news_aggregator_project/
├── news_aggregator/
│ ├── migrations/
│ ├── init.py
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── tasks.py
│ ├── tests.py
│ ├── utils.py
│ ├── views.py
│ └── management/
│ └── commands/
│ ├── clear_news.py
│ └── init.py
├── news_aggregator_project/
│ ├── init.py
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── manage.py
└── requirements.txt

Installation

  1. Clone the repository:

    git clone https://github.com/LIcsq/News-Parser.git
    cd news_aggregator_project
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Apply the migrations:

    python manage.py makemigrations
    python manage.py migrate

Configuration

  1. API Keys:
    • Set your OpenAI API key in settings.py:
      OPENAI_API_KEY = 'your_openai_api_key'

Running the Project

  1. Start the development server:

    python manage.py runserver
  2. Start the Celery worker:

    celery -A news_aggregator_project worker --loglevel=info

Management Commands

Clear News

Custom command to delete all news entries:

python manage.py clear_news

API Endpoints

List of News

URL: /api/news/
Method: GET
Response: JSON list of news articles with title, link, published date, and sentiment score.

Tasks

Update News

Fetches RSS feed, matches news with Google Trends, and enriches news with sentiment scores.

Location: news_aggregator/tasks.py
Commands to run manually:
```sh
python manage.py celery -A news_aggregator_project worker --loglevel=info
```
```sh
celery -A djangoProject beat --loglevel=info 
```

About

The News Aggregator project is a Django-based application that fetches news articles from an RSS feed, matches them with trending topics from Google Trends, and enriches the news articles with sentiment scores using OpenAI's GPT-3.5-turbo model. The application supports translation of trends into Ukrainian language.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published