包装meduza.io api的简单python模块。
meduza的Python项目详细描述
墨杜扎
包装meduza.ioAPI的简单Python模块(阅读Buzzfeed上的Meduza)
安装
pip install meduza
用法
获取文章:
>>>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"
获取此部分的最新文章:
# English version:>>>forarticleinmeduza.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:>>>forarticleinmeduza.section('news',n=3,lang='ru'):...print(f" - '{article['title']}'")-'Путина спросили про пенсионную реформу. Он ответил, что ему все не нравится'-'В Екатеринбурге открыли барельеф с «условными» Дзержинским и Сталиным (или Кагановичем)'-'Новая иллюзия: круги, раскрашенные в четыре разных цвета (на самом деле нет)'
您可以在常量中找到可用的标记和节:
>>>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('новости','истории','разбор','шапито','игры','подкасты','партнерский материал')