【发布时间】:2019-11-12 18:05:40
【问题描述】:
我正在尝试 scrape 网站上的图像,但这些图像是用 base 64 编码的。那么我该如何使用 python、beautifulsoup 来做到这一点。
我尝试了使用 python urllib 的代码,但它不起作用。
import urllib
import urllib.request
from bs4 import BeautifulSoup
import base64
import os
from string import ascii_lowercase
def make_soup(url):
thepage = urllib.request.urlopen(url)
soupdata = BeautifulSoup(thepage, "html.parser")
return soupdata
soup = make_soup("https://mahabhunakasha.mahabhumi.gov.in/bhunaksha/27/index.jsp")
soups = soup.decode('utf-8')
print(soups)
# for img in soup.findAll("src"):
# print(img)
我想下载所有区域的所有图像并存储在 mongo 数据库中。
【问题讨论】:
-
错误说明了什么?是
SSLCertVerificationError吗? -
@ ans2human :- 是的。 urllib.error.URLError:
-
仅供参考,它是 scrape(和 scraping、scraper、scraped)不是废品
标签: python html web-scraping beautifulsoup request