Module: OchibakoShare
- Defined in:
- lib/ochibako_share.rb
Constant Summary collapse
- VERSION =
'0.1.3'
- APP_KEY_FILE =
File.('~/.ochibako-share-app')
- ACCESS_TOKEN_FILE =
File.('~/.ochibako-share-auth')
Instance Method Summary collapse
Instance Method Details
#db_download_url(url) ⇒ Object
23 24 25 |
# File 'lib/ochibako_share.rb', line 23 def db_download_url(url) url.sub(/\?dl=0\z/, '?dl=1') end |
#follow_url(url, limit = 8) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ochibako_share.rb', line 12 def follow_url(url, limit = 8) raise RuntimeError, "Too many HTTP redirects" if limit == 0 res = Net::HTTP.get_response(URI.parse(url)) if Net::HTTPRedirection === res return follow_url(res['location'], limit - 1) else return url end end |