如何仅获取图片网址,而不从google_images_download中获取内容?

问题描述 投票:0回答:1

我正在尝试开发一个discord机器人,当我从discord收到一个特定的关键字时,我会使用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。任何指针表示赞赏。

python discord.py
1个回答
0
投票

您需要在参数中添加"no_download": True。可能的参数的完整列表可以在here

中找到。
arguments = {"keywords":"yuzu figure skater","limit":10,"print_urls":True, "no_download": True}
© www.soinside.com 2019 - 2024. All rights reserved.