Giter Site home page Giter Site logo

meduza's Introduction

Meduza

Build Status

A simple Python module that wraps the meduza.io API. (read about Meduza on Buzzfeed)

Installation

pip install meduza

Usage

Get an article:

>>> url = "https://meduza.io/en/brief/2018/07/16/the-real-russia-today"

>>> article = meduza.get(url)

>>> article["title"]
'The Real Russia. Today.'

>>> article["second_title"]
"Trump and Putin meet in Helsinki, the ‘Deep State’ consensus, and Pussy Riot's heart-to-heart with the police"

Get the latest articles on this section:

# English version:

>>> for article in meduza.section('news', n=3, lang='en'): 
...     print(f" - '{article['title']}'")
 - 'Chechnya’s ruler has a stable full of prize-winning race horses, but you’d never know it, looking at his income declarations'
 - 'Russian musicians are being forced to cancel their concerts across the country, which makes now the perfect time to listen to their music'
 - 'The Real Russia. Today.'


# Russian version:

>>> for article in meduza.section('news', n=3, lang='ru'):
...     print(f" - '{article['title']}'")
 - 'Путина спросили про пенсионную реформу. Он ответил, что ему все не нравится'
 - 'В Екатеринбурге открыли барельеф с «условными» Дзержинским и Сталиным (или Кагановичем)'
 - 'Новая иллюзия: круги, раскрашенные в четыре разных цвета (на самом деле нет)'

Search articles by key words:

# English version:

>>> for article in meduza.search('Indigenous', n=3, lang='en'):
...     print(f" - '{article['title']}'")
 - 'Indigenous scholar commits self-immolation in Ural city to protest language death'
 - '‘This is the land of our ancestors’'
 - 'Trial by fire'


# Russian version:

>>> for article in meduza.search('языка коренного', n=3, lang='ru'):
...     print(f" - '{article['title']}'")
 - 'Острова Кука собрались сменить название'
 - 'Последний аргумент в длинном споре'
 - 'При пожаре в Национальном музее Бразилии погиб архив языков коренных народов. Некоторые из них больше никто не знает'

You can find available tags and sections in constants:

>>> meduza.EN_SECTIONS
'news'

>>> meduza.EN_TAGS
('news', 'like it or not', 'games')

>>> meduza.RU_SECTIONS
('news', 'articles', 'shapito', 'razbor', 'games', 'podcasts')

>>> meduza.RU_TAGS
('новости', 'истории', 'разбор', 'шапито', 'игры', 'подкасты', 'партнерский материал')

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.