The Movie Database Support

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.

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login