admin管理员组文章数量:1403446
I am scraping image src, title, price etc from website but it gives base64 string in place of image src. When i'm appending all these scraped data to uri, it shows error long uri. How to slow this problem?
I am scraping image src, title, price etc from website but it gives base64 string in place of image src. When i'm appending all these scraped data to uri, it shows error long uri. How to slow this problem?
Share Improve this question edited Aug 17, 2015 at 8:25 Dal Hundal 3,32418 silver badges21 bronze badges asked Aug 17, 2015 at 8:03 chandnichandni 1691 silver badge7 bronze badges1 Answer
Reset to default 7If you're getting a base64 string as the img src, it sounds as though the image is encoded inline.
data: URIs are a very useful way to embed small items of data into a URL—rather than link to an external resource, the URL contains the actual encoded data.
An HTML fragment embedding a picture of small red dot:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
In the example above, if you were to base64 decode the string (minus the data:image/png,base64,
part), you would get the data of a PNG image which you could write to disk as a file.
- http://dopiaza/tools/datauri/examples/index.php
- https://en.wikipedia/wiki/Data_URI_scheme
本文标签: javascriptGetting base64 string on scraping image srcStack Overflow
版权声明:本文标题:javascript - Getting base64 string on scraping image src - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744369344a2602943.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论