python - 如何只获取图片 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 的新手。任何指针表示赞赏。
解决方案
您需要添加"no_download": True
到您的论点。可以在此处找到可能参数的完整列表:
arguments = {"keywords":"yuzu figure skater","limit":10,"print_urls":True, "no_download": True}
推荐阅读
- java - 如何使用spring boot / java将json对象存储在mysql的列中
- linux - 树莓派零蓝牙连接到设备失败
- macos - 如何在 macOS 上安装 bazelisk?
- java - 发布映射注释在springboot上不起作用
- python - 在 Pandas 中计算整个数据框中特定字符串的数量并将其值添加到新列中
- swift5 - ITMS-90429:无效的 Swift 支持 - 文件 libswiftDarwin.dylib、libswiftMetal.dylib、
- google-sheets - 在行中查找最大值
- websphere - 关于ejbs上xa和事务的问题
- python - 如何在消息中找到所有 Discord 邀请
- .net - EF Core 全局查询过滤器缓存第一个过滤器值