抓取 img src 输出到 base64

Scraped img src outputting into base64

我正在尝试只抓取 https:// link:

src ="https://static.daraz.com.bd/p/apple-1088-5942-1-catalog.jpg"

从下面的代码使用 BeautifulSoup4 Python 库 .

<div class="image-wrapper default-state">
      <img class="lazy image -loaded" alt="Macbook Air (MD711ZA/B) - Aluminum - Laptop - Dual-Core Intel Core i5 - 4GB RAM - 128GB HDD - 11.6&amp;#039;&amp;#039; LED - Intel HD Graphics 5000 - Mac OS X Mountain Lion 10.8" data-image-vertical="1" width="176" height="220" src="https://static.daraz.com.bd/p/apple-1088-5942-1-catalog.jpg" data-sku="AP113ELAA1XBNAFAMZ" data-placeholder="placeholder_daraz.jpg" style="display: inline-block;">
      <noscript>&lt;img src="https://static.daraz.com.bd/p/apple-1088-5942-1-catalog.jpg" width="176" height="220" class="image" /&gt;
      </noscript>
</div>

但我得到的输出是这样的:

data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7

有什么办法可以得到原版 src link 吗?

BeautifulSoup 代码:

for image in soup.findAll('div', attrs={'class': 'image-wrapper default-state'}):
            print image.img['src']

相同的代码在其他网站上运行并获取 src link。但只有在这里它输出成base64格式。

将整个 img 标签转换为 string 然后我发现他们使用的 tag<data-img src=" ">

所以我只是简单地使用了那个 tag 并得到了我预期的输出。

for image in soup.findAll('div', attrs={'class': 'image-wrapper'}):
    print image.img['data-src']