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
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by robbie3999
on July 15, 2023 at 10:23 AM
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.
Reply by supercc708
on July 15, 2023 at 10:32 AM
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.