Package: kinopoisk-dev
Kinopoisk Dev ApiPython-модуль для взаимодействия с неофициальнымAPI КиноПоискаУстановкаPippip install kinopoisk-devPoetrypoetry add kinopoisk-devПолучение токенаДля получения токена необходимо перейтиkinopoisk.devи написать по
контактам.Методы взаимодействияRandomПолучить рандомный тайтл из базыEndpoint -/v1/movie/randomПримерыAsyncimportasynciofromkinopoisk_devimportKinopoiskDevkp=KinopoiskDev(token=TOKEN)item=asyncio.run(kp.arandom())Syncfromkinopoisk_devimportKinopoiskDevkp=KinopoiskDev(token=TOKEN)item=kp.random()Possible values by fieldПолучить все возможные значения полейEndpoint -/v1/movie/possible-values-by-fieldПримерыAsyncimportasynciofromkinopoisk_devimportKinopoiskDev,PossValFieldkp=KinopoiskDev(token=TOKEN)item=asyncio.run(kp.apossible_values_by_field(params=PossValField.GENRES))Syncfromkinopoisk_devimportKinopoiskDev,PossValFieldkp=KinopoiskDev(token=TOKEN)item=kp.possible_values_by_field(params=PossValField.GENRES)MoviesПоиск тайтловЕндпоинт -/v1/movie/ПримерыAsyncimportasynciofromkinopoisk_devimportKinopoiskDev,MovieParams,MovieFieldkp=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")]))Syncfromkinopoisk_devimportKinopoiskDev,MovieParams,MovieFieldkp=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Ендпоинт -/v1/movie/{id}ПримерыAsyncfromkinopoisk_devimportKinopoiskDevkp=KinopoiskDev(token=TOKEN)item=asyncio.run(kp.afind_one_movie(666))Syncfromkinopoisk_devimportKinopoiskDevkp=KinopoiskDev(token=TOKEN)item=kp.find_one_movie(666)SeasonЕндпоинт -/v1/seasonПримерAsyncimportasynciofromkinopoisk_devimportKinopoiskDev,SeasonParams,SeasonFieldkp=KinopoiskDev(token=TOKEN)item=asyncio.run(kp.aseasons(params=[SeasonParams(keys=SeasonField.PAGE,value=1),SeasonParams(keys=SeasonField.LIMIT,value=100)]))Syncfromkinopoisk_devimportKinopoiskDev,SeasonParams,SeasonFieldkp=KinopoiskDev(token=TOKEN)item=kp.seasons(params=[SeasonParams(keys=SeasonField.PAGE,value=1),SeasonParams(keys=SeasonField.LIMIT,value=100)])ReviewЕндпоинт -/v1/reviewПримерAsyncimportasynciofromkinopoisk_devimportKinopoiskDev,ReviewParams,ReviewFieldkp=KinopoiskDev(token=TOKEN)item=asyncio.run(kp.areview(params=[ReviewParams(keys=ReviewField.PAGE,value=1),ReviewParams(keys=ReviewField.LIMIT,value=100)]))Syncfromkinopoisk_devimportKinopoiskDev,ReviewParams,ReviewFieldkp=KinopoiskDev(token=TOKEN)item=kp.review(params=[ReviewParams(keys=ReviewField.PAGE,value=1),ReviewParams(keys=ReviewField.LIMIT,value=100)])PersonsЕндпоинт -/v1/personПримерAsyncimportasynciofromkinopoisk_devimportKinopoiskDev,PersonParams,PersonFieldkp=KinopoiskDev(token=TOKEN)item=asyncio.run(kp.afind_many_person(params=[PersonParams(keys=PersonField.PAGE,value=1),PersonParams(keys=PersonField.LIMIT,value=100)]))Syncfromkinopoisk_devimportKinopoiskDev,PersonParams,PersonFieldkp=KinopoiskDev(token=TOKEN)item=kp.find_many_person(params=[PersonParams(keys=PersonField.PAGE,value=1),PersonParams(keys=PersonField.LIMIT,value=100)])PersonЕндпоинт -/v1/person/{id}ПримерAsyncimportasynciofromkinopoisk_devimportKinopoiskDevkp=KinopoiskDev(token=TOKEN)item=asyncio.run(kp.afind_one_person(24262))Syncfromkinopoisk_devimportKinopoiskDevkp=KinopoiskDev(token=TOKEN)item=kp.find_one_person(24262)ImageЕндпоинт -/v1/imageПримерAsyncimportasynciofromkinopoisk_devimportKinopoiskDev,ImageParams,ImageFieldkp=KinopoiskDev(token=TOKEN)item=asyncio.run(kp.aimage(params=[ImageParams(keys=ImageField.PAGE,value=1),ImageParams(keys=ImageField.LIMIT,value=100)]))Syncfromkinopoisk_devimportKinopoiskDev,ImageParams,ImageFieldkp=KinopoiskDev(token=TOKEN)item=kp.image(params=[ImageParams(keys=ImageField.PAGE,value=1),ImageParams(keys=ImageField.LIMIT,value=100)])