简体   繁体   English

使用 python 从 Flickr 下载给定 ID 的照片统计信息

[英]Download photo Stats for a given ID from Flickr with python

I am trying to download some photos from Flickr.我正在尝试从 Flickr 下载一些照片。 With My KEY and Secret, I am able to search and download using these lines of code使用 My KEY 和 Secret,我可以使用这些代码行进行搜索和下载

image_tag = 'seaside'
extras = ','.join(SIZES[0])
flickr = FlickrAPI(KEY, SECRET)
photos = flickr.walk(text=image_tag,  # it will search by image title and image tags
                            extras=extras,  # get the urls for each size we want
                            privacy_filter=1,  # search only for public photos
                            per_page=50,
                            sort='relevance',
                            safe_search = 1 )

Using this I am able to acquire the url and the photo ID but I would like to download photostats too (likes, views), but I can't find an appropriate command that starting from the ID of the photo allows me to download the stats.使用这个我可以获得 url 和照片 ID,但我也想下载照片统计(喜欢,视图),但我找不到合适的命令,从照片的 ID 开始允许我下载统计.

You can find what you are looking for exactly on Flickr web page, in the API's documentation:您可以在 API 文档中的 Flickr web 页面上准确找到您要查找的内容:

https://www.flickr.com/services/api/flickr.stats.getPhotoStats.html https://www.flickr.com/services/api/flickr.stats.getPhotoStats.html

Calling the method:调用方法:

flickr.stats.getPhotoStats

with arguments:使用 arguments:

api_key, date, photo_id

You will receive what you look for in the following format:您将收到以下格式的所需内容:

<stats views="24" comments="4" favorites="1" />

Remember to generate before your authentication token, there is a link in this same page on how to generate it, if you still didn't.请记住在您的身份验证令牌之前生成,如果您仍然没有生成它,同一页面中有一个关于如何生成它的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM