Skip to main content

Неофициальное API «разговоров о важном».

Project description

conversations-about-important-api

Неофициальное API "разговоров о важном", на деле простой парсер.

Быстрый старт

  1. Устанавливаем библиотеку:
pip install conversations-about-important-api
  1. Запустите код ниже:
"""Пример взаимодествия с библиотекой."""  # noqa: RUF002

import datetime as dt

from conversations_about_important_api import CAIParser


def get_next_date() -> str:
    """Получаем ссылку для парсинга."""
    # Получаем текущую дату
    now = dt.datetime.now()  # noqa: DTZ005

    # Меняем дату на следующий понедельник
    now += dt.timedelta(days=7 - now.weekday())

    # Переводим дату в строку и возвращаем её
    return now.strftime("%d-%m-%Y")


if __name__ == "__main__":
    parser = CAIParser()
    data = parser.get_info(get_next_date())
    print(data)

Выдаёт такой ответ:

{
    "title": "Массовый спорт в России",
    "str_date": "10 марта 2025",
    "image_url": "https://разговорыоважном.рф/img/2025/10-03-2025.jpg",
    "plakat_url": "https://разговорыоважном.рф/10-03-2025/plakat.jpg",
    "videos_urls": [
        "https://разговорыоважном.рф/10-03-2025/1.mp4",
        "https://разговорыоважном.рф/10-03-2025/2.mp4",
        "https://разговорыоважном.рф/10-03-2025/3.mp4",
        "https://разговорыоважном.рф/10-03-2025/4.mp4",
        "https://разговорыоважном.рф/10-03-2025/5.mp4"
    ]
}

Подробнее

  1. Создаём и активируем виртуальное окружение (venv):

Использование виртуального окружения (venv) является лучшей практикой.

python3 -m venv venv
. venv/bin/activate

ВАЖНО!

Вторая команда для Windows выглядит так:

venv\Scripts\activate.bat
  1. Устанавливаем библиотеку:
pip install conversations-about-important-api
  1. Далее используйте код из "Быстрого старта" 🤗

Made with ❤️ by iamlostshe.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conversations_about_important_api-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

conversations_about_important_api-0.1.0-py2.py3-none-any.whl (5.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file conversations_about_important_api-0.1.0.tar.gz.

File metadata

File hashes

Hashes for conversations_about_important_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6581fc836f4a6f10bad755a443a3784a33e913857ddd99efa6af1ef769684f03
MD5 5166502868064e366c834235633354a0
BLAKE2b-256 579138975a94266c865c429bffc9986e0b32967a4a5296a7037e85629f7fe41e

See more details on using hashes here.

File details

Details for the file conversations_about_important_api-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for conversations_about_important_api-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a3b597ee697c25c3043b5bb1953fed845e6d5276cad6652faf7e45f716d2a8d8
MD5 1393af9ff3fbf0a51cca26758b14e571
BLAKE2b-256 be89ef04ebbd62b4da9e966904f9aa6d885950aee83179693f18d613c799bf40

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page