Code Monkey home page Code Monkey logo

latest-news-gatherer's Introduction

Latest News Gatherer

With this gatherer, user will be able to receive the latest news in the category of the news source user wants.

In this version, only Turkish news sources are available. These are:

  • CnnTürk - general, sport, economy, magazine
  • NTV - general, sport, economy
  • Hürriyet - general, sport, economy, magazine
  • Milliyet - general, economy, magazine
  • Sabah - general, sport, economy
  • Cumhuriyet - general
  • HaberTürk - general, sport, economy, magazine
  • AHaber - general, sport, economy, magazine
  • TRTHaber - general, sport, economy
  • BBCTürkçe - general, economy
  • Sözcü - general
  • Sputniknews - general
  • Beinsports - sport

When the system is started, latest news is received with a thread running in parallel and saved to the file.


Installation

In order to clone the complete content of this folder use the command:

git clone [email protected]:redrussianarmy/latest-news-gatherer.git

Create virtual environment:

cd latest-news-gatherer/
pipenv install -r requirements.txt 
pipenv shell

Try if it works:

python3 get_news.py

Enter the source and category respectively as the following:

  1. Input 1: cnntürk
  2. Press Enter
  3. Input 2: economy
  4. Press Enter
  5. See the gathered latest news of given source and category.

news


Usage

root  
└── get_news.py  
└── sources.py  
└── ...

Here is the sample code:

from get_news import News
from queue import Queue
from threading import Thread

q1 = Queue()
q2 = Queue()
news = News() 
th1 = Thread(target=news.load_news, args=())
th2 = Thread(target=news.run, args=(q1,q2))
th1.start()
th2.start()
while True:
    q1.put({"source":input(), "category":input()})
    print(q2.get())

NOTE

The character limit for the news received is set at 250. You can increase or decrease this by changing the char_limit variable in the get_news.py file.


latest-news-gatherer's People

Contributors

redrussianarmy avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.