Created
June 21, 2017 02:58
-
-
Save irvin373/01044b8d9e020222f215147c7d85b203 to your computer and use it in GitHub Desktop.
is a ruby scrapper for page https://wall.alphacoders.com downloader images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cocaine' | |
require 'open-uri' | |
require 'nokogiri' | |
$iterator = 0 | |
def getName(link) | |
$iterator+=1 | |
link.to_s.split('/').last + "#{$iterator}.png" | |
end | |
def download(url) | |
doc = Nokogiri::HTML(open(url)) | |
links = doc.css('.btn btn-primary', '.download-button') | |
links = links.map{|button| button.attr('data-href')} | |
comands = links.map {|link| Cocaine::CommandLine.new("curl", "-o #{getName(link)} #{link}")} | |
comands.each{|comand| comand.run} | |
end | |
url = 'https://wall.alphacoders.com/search.php?search=raichu' | |
download(url) | |
#for i in 2..8 | |
# url = "https://wall.alphacoders.com/tags.php?tid=142&page=#{i}" | |
# puts url | |
# download(url) | |
#end | |
# comands = links.map {|link| Cocaine::CommandLine.new("wget"," #{link}")} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In line 20 is for pages result indexer and url in line 18 is the url of search replace for download