deduce (owner)

Revisions

gist: 137022 Download_button fork
public
Public Clone URL: git://gist.github.com/137022.git
Embed All Files: show embed
Scraping images from twitpics #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'net/http'
require 'hpricot'
 
def rip_twitpic(url)
  begin
    code=url.match(/[\w]+$/).to_s
    unless code.blank?
      uri=URI.parse(url)
      resp=Net::HTTP.get_response(uri)
      html=Hpricot(resp.body)
      html.at("#photo-display")['src']
    end
  rescue Exception => e
    puts "Error extracting twitpic: #{e}"
    url
  end
end