Extract user accounts from different urls: tumblr, facebook and others
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
specs
.gitignore
Gemfile
README.markdown
Rakefile
extractors.gemspec

README.markdown

Extract user accounts from different contexts...

Extractors(:twitter).sanitize("http://twitter.com/#!/programmingshit") # => "programmingshit"
Extractors(:twitter).sanitize("programmingshit") # => "programmingshit"

... and format them back

Extractors(:twitter).format("programmingshit") # => "http://twitter.com/#!/programmingshit"

Add your own extractors

Extractors.add :lookatme do
  username_regexp = '[a-zA-Z0-9_\\-]{3,20}'
  sanitizer [
    %r{^(?:http://)?(?:www\.)?lookatme\.ru/users/(#{username_regexp})},
    %r{^(#{username_regexp})$}
  ]
  formatter 'http://lookatme.ru/users/%s'
end

List of available extractors

  • :facebook
  • :googleplus
  • :gtalk
  • :lastfm
  • :livejournal
  • :lookatme
  • :moikrug
  • :myspace
  • :skype
  • :tumblr
  • :twitter
  • :vkontakte
  • :youtube

Credits

The code itself has been extracted from http://github.com/toy/contacts gem.