RestUri
Installation
Add this line to your application's Gemfile:
gem 'rest_uri'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rest_uri
Usage
Simply,
tweet_url = RestUri.parse('https://twitter.com/jack/statuses/761304654147784704/photo/1')
tweet_url.status_id #=> 761304654147784704
tweet_url.photo_id #=> 1
To handle URL containing multibyte chars, run gem install addressable
and
require 'addressable/uri'
require 'rest_uri'
rest_uri = RestUri.parse(
'https://こんにちは.com/people/755950562227605504#foo',
parser: Addressable::URI)
rest_uri.person_id #=> 755950562227605504