The Movie Database atbalsts

I edited the pyhon script to use the API, search for video resources in the telegram bot, and return the poster and Introduction to the telegram bot. Now the problem I have is that some also capture the poster and some don't.The main problem is that the poster_url is wrong.

Attach a part of the relevant code:

url = f"https://api.themoviedb.org/3/{resource_type}/{resource_id}/images?api_key={API_KEY}"
response = requests.get(url)
data = response.json()
posters = data.get("posters", [])
if posters:

    poster_path = posters[0].get("file_path")
    poster_url = f"https://image.tmdb.org/t/p/original{poster_path}"
    try:
        context.bot.send_photo(update.effective_chat.id, photo=poster_url, caption=f"{resource_name}\n\n简介:{overview}")
    except Exception as e:
        print(f"Error sending photo: {e}")
        query.message.reply_text(f"{resource_name}\n\n简介:{overview}")
else:
    query.message.reply_text(f"{resource_name}\n\n简介:{overview}")

query.answer()

Please someone help me, thank you

2 replies (on page 1 of 1)

Jump to last post

Hi @supercc708, one thing you should consider is that some lessor known movies don't have a poster. These will return an empty array for posters. If this isn't your problem then please provide a list of some of the {resource_id} (tmdb_id) numbers that don't work so someone can investigate.

Thanks for the reply, but it's not that lesser known movies can't get posters. This is a random event, some caught and some not. Especially the latest film and television,Apparently there was a poster, but it couldn't be captured.

Nevari atrast filmu vai TV pārraidi? Jāpiesakās, lai to izveidotu.

Vispārējs

s fokusēties uz meklēšanas joslu
p atvērt profila izvēlni
esc aizvērt atvērtu logu
? atvērt īsinājumtaustiņu logu

Informācijas nesēju lapās

b atgriezties (vai pie vecākiem, ja nepieciešams)
e doties uz labošanas lapu

TV sezonas lapās

(labā bultiņa) pāriet uz nākamo sezonu
(kreisā bultiņa) pāriet uz iepriekšējo sezonu

TV sērijas lapās

(labā bultiņa) pāriet uz nākamo sēriju
(kreisā bultiņa) pāriet uz iepriekšējo sēriju

Visās attēlu lapās

a atvērt attēla pievienošanas logu

Visās labošanas lapās

t atvērt tulkošanas atlasītāju
ctrl+ s iesniegt veidlapu

Diskusiju lapās

n radīt jaunu diskusiju
w pārslēgt skatīšanās stāvokli
p pārslēgt publisko/privāto
c pārslēgt aizvērt/atvērt
a atklāta darbība
r atbilde uz diskusiju
l doties uz pēdējo atbildi
ctrl+ enter iesniegt savu ziņojumu
(labā bultiņa) nākamajā lapā
(kreisā bultiņa) iepriekšējā lapa

Iestatījumi

Vēlies novērtēt šo vienumu vai pievienot to sarakstam?

Pieteikties