The Movie Database サポート

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.

映画やテレビ番組が見つかりませんか?ログインして作成してください。

全般

s 検索バーに移動する
p プロファイルメニューを開く
esc 開いているウィンドウを閉じる
? キーボードショートカットウィンドウを開く

メディアのページ

b 戻る(または該当する場合は親に)
e 編集ページに行く

テレビ番組のシーズンのページ

(右矢印)次のシーズンに行く
(左矢印)前のシーズンに戻る

テレビ番組のエピソードのページ

(右矢印)次のエピソードに進む
(左矢印)前のエピソードに戻る

全ての画像のページ

a 画像追加ウィンドウを開く

全ての編集ページ

t 翻訳選択を開く
ctrl+ s フォームを送信する

ディスカッションのページ

n 新しいディスカッションを作成する
w 監視ステータスを切り替える
p 公開/非公開を切り替える
c 閉じる/開くを切り替える
a アクティビティを開く
r ディスカッションに返信
l 最後の返事に行く
ctrl+ enter メッセージを送信する
(右矢印)次のページ
(左矢印)前のページ

設定

このアイテムを評価したり、リストに追加したりしたいですか?

ログイン

メンバーではありませんか?

登録してコミュニティに参加