Guest User

Untitled

a guest
Jul 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. 0a1,2
  2. > # -*- coding: utf-8 -*-
  3. >
  4. 96,97c98,119
  5. <
  6. < SERVICES = [Twitpic,Yfrog,Movapic]
  7. ---
  8. >
  9. > require 'net/http'
  10. > class Instagram < Base
  11. > SERVICE_NAME = 'instagram'
  12. > REGEXP = /(http:\/\/instagr\.am\/p\/[a-zA-Z0-9]+)/
  13. > IMAGE_REGEXP = /property=\"og:image\" content=\"([ :\/\.\w]*)\"/
  14. >
  15. > def image_url(size = 'thumb')
  16. > uri = URI(self.url)
  17. > response = Net::HTTP.get_response(uri)
  18. > if IMAGE_REGEXP =~ response.body
  19. > url = $1
  20. > if size.to_s == 'large'
  21. > url = $1.gsub("_7.","_5.")
  22. > end
  23. > url
  24. > end
  25. > end
  26. >
  27. > end
  28. >
  29. > SERVICES = [Twitpic,Yfrog,Movapic,Instagram]
Add Comment
Please, Sign In to add comment