【发布时间】:2019-01-21 08:47:54
【问题描述】:
我想自动从使用流的网络源下载图片,编码为Base 64 字符串。
我的Google Chrome 浏览器将源中的数据正确识别为JPG 图片并显示出来。
现在,此页面仅供注册用户访问。在这种情况下我应该使用Selenium 吗?
所以,基本上,我想生成大约 1000 个url 请求并将所有流式传输的图片保存在我的本地磁盘上。
我请求的 URL 示例:
https://ia800703.us.archive.org/BookReader/BookReaderImages.php?zip=/10/items/nortonreaderan6theast/nortonreaderan6theast_jp2.zip&file=nortonreaderan6theast_jp2/nortonreaderan6theast_1257.jp2&scale=1&rotate=0
响应是带有图片的html 文档:
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=0.1">
<title>BookReaderImages.php (2447×4005) </title>
</head>
<body style="margin: 0px; background: #0e0e0e;">
<img style="-webkit-user-select: none;cursor: zoom-in;" src="https://ia800703.us.archive.org/BookReader/BookReaderImages.php?zip=/10/items/nortonreaderan6theast/nortonreaderan6theast_jp2.zip&file=nortonreaderan6theast_jp2/nortonreaderan6theast_1257.jp2&scale=1&rotate=0" width="556" height="911">
</body>
</html>
图片流是Base 64字符串。
浏览器允许保存为nortonreaderan6theast_1257.jpg
有什么建议吗?
【问题讨论】:
-
没有。它不是重复的。在我的情况下,您不能使用快照。图像大小为 2447×4005,并调整大小以适合屏幕显示。正如你所看到的,图像源并不直接指向图片。我怀疑处理此流的最简单方法是使用
Chrome dev-tools API。但我不确定。
标签: selenium web-scraping google-chrome-devtools selenium-chromedriver