
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Parse social media attributes from url or construct url from attributes.
[:facebook, :github, :instagram, :github, :google, :linkedin, :medium, :pinterest, :qiita, :twitter, :vimeo, :youtube]
Add this line to your application's Gemfile:
gem 'social_parser'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install social_parser
The following code is an example of Twitter.
parser = SocialParser.parse 'https://www.twitter.com/hyde141421356'
=> #<SocialParser::Provider::Twitter:0x007fc57720a690 @url="https://www.twitter.com/hyde141421356">
parser.username
=> 'hyde141421356'
parser.provider
=> :twitter
parser.url
=> 'https://www.twitter.com/hyde141421356'
Facebook, Google+, LinkedIn, etc... as well.
parser = SocialParser.parse 'https://github.com/hyde2able'
=> #<SocialParser::Provider::Github:0x007fc5771e3c98 @url="https://github.com/hyde2able">
parser.username
=> 'hyde2able'
parser.provider
=> :github
parser.url
=> 'https://github.com/hyde2able'
An example of Youtube.
parser = SocialParser.parse 'https://www.youtube.com/watch?v=WOvdMz4yM9U'
=> #<SocialParser::Provider::Youtube:0x007faa5e26fd58 @url="https://www.youtube.com/watch?v=WOvdMz4yM9U", @type="video">
parser.id # alias parser.username
=> 'WOvdMz4yM9U'
parser.embed_url
=> 'https://www.youtube.com/embed/WOvdMz4yM9U'
When an embedded URL is not provided
parser = SocialParser.parse 'https://github.com/hyde2able'
=> #<SocialParser::Provider::Github:0x007faa5e06d7a8 @url="https://github.com/hyde2able">
parser.embed_url
# SocialParser::InvalidURIError: SocialParser::InvalidURIError
Excute this code
bundle exec rspec
The gem is available as open source under the terms of the MIT License.
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.