首页 > 解决方案 > 如何只获取图片 URL 而不是 google_images_download 的内容?

问题描述

我正在尝试开发一个不和谐机器人,当我从不和谐收到特定关键字时,我使用 google_images_download 搜索它。后来我想返回一个来自搜索结果的随机图片 url。

response = google_images_download.googleimagesdownload()
arguments = {"keywords":"yuzu figure skater","limit":10,"print_urls":True} #creating list of arguments
paths = response.download(arguments)   #passing the arguments to the function

但是,这样做会下载图像。但我只想要与图像关联的 url。不是图像本身。

我是使用 google_images_download 的新手。任何指针表示赞赏。

标签: pythondiscord.py

解决方案


您需要添加"no_download": True到您的论点。可以在此处找到可能参数的完整列表:

arguments = {"keywords":"yuzu figure skater","limit":10,"print_urls":True, "no_download": True}

推荐阅读