python-3.x - 尝试从 TMDB 获取系列背景
问题描述
我有一个项目,我必须为系列的每个季节下载不同的背景(宽图像),我正在使用 TMDB API,我浏览了他们的 API 文档并使用了我发现的内容,但我最终得到了一个背景
我的代码
import requests
seriesname = 'Clarice'
seasnnumb = '1'
r = requests.get(f'https://api.themoviedb.org/3/search/tv?
api_key=apikey&page=1&query={seriesname}')
response = r.json()
result = response.get('results')
print(result)
响应
[{'backdrop_path': '/eSVvx8xys2NuFhl8fevXt41wX7v.jpg',
'first_air_date': '2021-02-11',
'genre_ids': [80, 18],
'id': 103302,
'name': 'Clarice',
'origin_country': ['US'],
'original_language': 'en',
'original_name': 'Clarice',
'overview': 'In 1993, six months after the events of The Silence of the Lambs, FBI Agent Clarice
Starling returns to the field to pursue serial murderers and sexual predators while navigating the
high stakes political world of Washington, D.C.',
'popularity': 24.836,
'poster_path': '/7OFxU0bBO0HDL4klXmM1ahJPbv8.jpg',
'vote_average': 7.5,
'vote_count': 67}]
我尝试了 get Image 方法,但它只返回海报
解决方案
https://image.tmdb.org/t/p/original/
将此附加到背景/海报路径。 例如: 'backdrop_path':'/eSVvx8xys2NuFhl8fevXt41wX7v.jpg'
https://image.tmdb.org/t/p/original/eSVvx8xys2NuFhl8fevXt41wX7v.jpg //这是原始尺寸
//您还可以指定图像的大小,例如:https ://image.tmdb.org/t/p/w{width}/eSVvx8xys2NuFhl8fevXt41wX7v.jpg 例如://要获取大小为 500px 的图像,您可以使用
https://image.tmdb.org/t/p/w500/eSVvx8xys2NuFhl8fevXt41wX7v.jpg //这是宽度500px的大小
推荐阅读
- reactjs - 使用 axios 获取的数据在页面加载时闪烁
- oauth-2.0 - SAPUI5/OpenUI5 没有“#”的路由可能吗?
- python - 从 Jaydebeapi Netezza 读取的 Pandas read_sql 非常慢
- javascript - 按特定属性组织/分组 HTML 表格
- selenium - Indiatimes 网站的标题打印失败
- qr-code - 二维码 8 种面具图案的 8 条规则是什么?
- pandas - Pandas 相对于另一列的填充方法
- reactjs - 如何使用由孩子设置的不同状态的useState(反应钩子)添加对象属性?
- javascript - 使用 firestore.FieldValue.increment(1) 时如何解决错误“参数“dataOrField”的值不是有效的 Firestore 文档”?
- javascript - 如何为反应制作新线