lib/nokaya/getter.rb in nokaya-0.0.6 vs lib/nokaya/getter.rb in nokaya-0.0.7
- old
+ new
@@ -20,18 +20,38 @@
page.xpath("//meta[@property='og:image']/@content").first
end
def get_favd page
page.css('#largeImage')[0]['src']
end
+ def get_deviantart page
+ refs = page.css('a.thumb')
+ links = []
+ refs.each {|li| links << li['data-super-img']}
+ links
+ end
+ def get_imageshack_user page
+ refs = page.css('a.hero-wrapper')
+ temp = []
+ links = []
+ refs.each {|li| temp << "https://imageshack.com#{li['href']}"}
+ puts Status.toresolve temp.length
+ temp.each do |p|
+ puts Status.resolving p
+ picpage = Nokogiri::HTML(open p)
+ ref = picpage.css('figure.image img')
+ links << "http:#{ref[0]['src']}"
+ end
+ links
+ end
def get_imgur_album page
refs = page.css('#imagelist .posts .post a')
links = []
refs.each {|l| links << "http:#{l['href']}"}
links
end
def get_tumblr_album page
- queries = ['img.photo', '.post .photo a img', '.entry img', 'article img', '.image img', '.item_content img', 'img.post-image', '.box img', '#allposts img', '.media img', '.wide img', '.big img', '.large img', '.gallery img', '.photos img', 'img']
+ queries = ['img.photo', '.post .photo a img', '.entry img', 'article img', '.image img', '.item_content img', 'img.post-image', '.box img', '#allposts img', '.media img', '.wide img', '.big img', '.large img', '.gallery img', '.photos img', '.content img', 'img']
queries.each do |query|
@refs = page.css query
next if @refs.empty?
break
end
@@ -46,9 +66,17 @@
end
def get_flickr_album page
refs = page.css('.pc_img')
links = []
refs.each {|l| links << l['data-defer-src']}
+ links
+ end
+ def get_photonet_album page
+ refs = page.css '.trp-top a'
+ links = []
+ refs.each do |lin|
+ links << "http://gallery.photo.net/photo/#{lin['href'].split("=").last}-lg.jpg"
+ end
links
end
def parse_page
Nokogiri::HTML(open @args.url)
end