You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Python爬取域名对应公司Logo时如何获取源URL?

获取Clearbit Logo接口的源URL解决方案
  • 当请求https://logo.clearbit.com/[域名]时,服务器会通过302重定向指向实际的图片源地址,你可以直接通过requests响应对象的属性获取这个最终URL。
  • 修改后的代码示例:
import requests

domain = "shopify.com"
url = f"https://logo.clearbit.com/{domain}"

# requests默认自动跟随重定向,直接获取最终响应
response = requests.get(url)

# 提取最终的图片源URL
logo_source_url = response.url
print(logo_source_url)
  • 额外验证方式:
    如果需要手动查看重定向地址,可以禁用自动跟随重定向,读取响应头中的Location字段:
    response = requests.get(url, allow_redirects=False)
    print(response.headers.get('Location'))
    

内容的提问来源于stack exchange,提问作者Sushmitha Krishnan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 01:25:25