ruby - How to scrape "data:image" URIs; Encountering Errno::ENAMETOOLONG? -


i having been trying write script scrapes page images way has been outlined in "save image files website".

i tested method page , worked fine, when inserting link scrape data:image uris, like:

data:image/jpg;base64,/9j/4fejfoiejnfoejoiad//gaqtgfgrgregg2ljewmad/2wbdaagebaqeregrewgrwegufbqygbgygbgygb... 

i error beginning initialize': file name long , ending in (errno::enametoolong).

has found way deal situations this?

data:image urls contain image inline base 64. need grab data , decode it:

require 'base64'  file.open(file.basename(uri),'wb'){ |f| f.write(base64.decode64(url[/base64,(.*)/, 1])) } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -