Skip to main content

Реализация Api для сервиса kinopoisk.dev

Project description

Kinopoisk Dev Api

Python-модуль для взаимодействия с неофициальным API КиноПоиска

Установка

Pip

pip install kinopoisk-dev

Poetry

poetry add kinopoisk-dev

Получение токена

Для получения токена необходимо перейти kinopoisk.dev и написать по контактам.

Методы взаимодействия

Random

Получить рандомный тайтл из базы

Async

import asyncio
from kinopoisk_dev import KinopoiskDev

kp = KinopoiskDev(token=TOKEN)
item = asyncio.run(kp.arandom())

Sync

from kinopoisk_dev import KinopoiskDev

kp = KinopoiskDev(token=TOKEN)
item = kp.random()

Possible values by field

Получить все возможные значения полей

Async

import asyncio
from kinopoisk_dev import KinopoiskDev, PossValField

kp = KinopoiskDev(token=TOKEN)
item = asyncio.run(kp.apossible_values_by_field(params=PossValField.GENRES))

Sync

from kinopoisk_dev import KinopoiskDev, PossValField

kp = KinopoiskDev(token=TOKEN)
item = kp.possible_values_by_field(params=PossValField.GENRES)

Movies

Поиск тайтлов

Async

import asyncio
from kinopoisk_dev import KinopoiskDev, MovieParams, MovieField

kp = KinopoiskDev(token=TOKEN)
items = asyncio.run(kp.afind_many_movies(params=[
    MovieParams(keys=MovieField.name, value="Аватар"),
    MovieParams(keys=MovieField.page, value="1"),
    MovieParams(keys=MovieField.limit, value="1000")
]))

Sync

from kinopoisk_dev import KinopoiskDev, MovieParams, MovieField

kp = KinopoiskDev(token=TOKEN)
items = kp.find_many_movies(params=[
    MovieParams(keys=MovieField.name, value="Аватар"),
    MovieParams(keys=MovieField.page, value="1"),
    MovieParams(keys=MovieField.limit, value="1000")
])

Movie

Поиск по id

Async

from kinopoisk_dev import KinopoiskDev

kp = KinopoiskDev(token=TOKEN)
item = asyncio.run(kp.afind_one_movie(666))

Sync

from kinopoisk_dev import KinopoiskDev

kp = KinopoiskDev(token=TOKEN)
item = kp.find_one_movie(666)

Season

Async

import asyncio
from kinopoisk_dev import KinopoiskDev, SeasonParams, SeasonField

kp = KinopoiskDev(token=TOKEN)
item = asyncio.run(kp.aseasons(params=[
    SeasonParams(keys=SeasonField.PAGE, value=1),
    SeasonParams(keys=SeasonField.LIMIT, value=100)
]))

Sync

from kinopoisk_dev import KinopoiskDev, SeasonParams, SeasonField

kp = KinopoiskDev(token=TOKEN)
item = kp.seasons(params=[
    SeasonParams(keys=SeasonField.PAGE, value=1),
    SeasonParams(keys=SeasonField.LIMIT, value=100)
])

Review

Async

import asyncio

from kinopoisk_dev import KinopoiskDev, ReviewParams, ReviewField

kp = KinopoiskDev(token=TOKEN)
item = asyncio.run(kp.areview(params=[
    ReviewParams(keys=ReviewField.PAGE, value=1),
    ReviewParams(keys=ReviewField.LIMIT, value=100)
]))

Sync

from kinopoisk_dev import KinopoiskDev, ReviewParams, ReviewField

kp = KinopoiskDev(token=TOKEN)
item = kp.review(params=[
    ReviewParams(keys=ReviewField.PAGE, value=1),
    ReviewParams(keys=ReviewField.LIMIT, value=100)
])

Persons

Async

import asyncio
from kinopoisk_dev import KinopoiskDev, PersonParams, PersonField

kp = KinopoiskDev(token=TOKEN)
item = asyncio.run(kp.afind_many_person(params=[
    PersonParams(keys=PersonField.PAGE, value=1),
    PersonParams(keys=PersonField.LIMIT, value=100)
]))

Sync

from kinopoisk_dev import KinopoiskDev, PersonParams, PersonField

kp = KinopoiskDev(token=TOKEN)
item = kp.find_many_person(params=[
    PersonParams(keys=PersonField.PAGE, value=1),
    PersonParams(keys=PersonField.LIMIT, value=100)
])

Person

Async

import asyncio
from kinopoisk_dev import KinopoiskDev

kp = KinopoiskDev(token=TOKEN)
item = asyncio.run(kp.afind_one_person(24262))

Sync

from kinopoisk_dev import KinopoiskDev

kp = KinopoiskDev(token=TOKEN)
item = kp.find_one_person(24262)

Image

Async

import asyncio
from kinopoisk_dev import KinopoiskDev, ImageParams, ImageField

kp = KinopoiskDev(token=TOKEN)
item = asyncio.run(kp.aimage(params=[
    ImageParams(keys=ImageField.PAGE, value=1),
    ImageParams(keys=ImageField.LIMIT, value=100)
]))

Sync

from kinopoisk_dev import KinopoiskDev, ImageParams, ImageField

kp = KinopoiskDev(token=TOKEN)
item = kp.image(params=[
    ImageParams(keys=ImageField.PAGE, value=1),
    ImageParams(keys=ImageField.LIMIT, value=100)
])

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

kinopoisk_dev-0.2.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

kinopoisk_dev-0.2.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file kinopoisk_dev-0.2.0.tar.gz.

File metadata

  • Download URL: kinopoisk_dev-0.2.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.0 Windows/10

File hashes

Hashes for kinopoisk_dev-0.2.0.tar.gz
Algorithm Hash digest
SHA256 33469d9ae2e75447af61eb40cd963387beaad1a32aca693d1f7287e862aa25ae
MD5 c8376da37091738c52fa50014e6476fb
BLAKE2b-256 6014122bfd0437b1f3aaf36b3afc1e27086ff36ec736d0197af0e033198b3120

See more details on using hashes here.

File details

Details for the file kinopoisk_dev-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: kinopoisk_dev-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.0 Windows/10

File hashes

Hashes for kinopoisk_dev-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 030b425f0e0902f494335e8d4be7a13909dd61c9f2f9e5677230cf0f2324e0e5
MD5 788c61d7b8c0536b13be6109bbc5f3d8
BLAKE2b-256 6eb43ad022f23884724e16577d1a6925b8327f3d18570b9741d0dd189f69942a

See more details on using hashes here.

Supported by

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