Repository is archived
No commit activity in last 3 years
No release in over 3 years
Need to dynamically embed videos from YouTube or Facebook? Extract the video ID easily
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 2.12
~> 5.7
~> 10.0
 Project Readme

VideoURLParser

Parse out information from a web video URL. Want information about a YouTube or Facebook video?

Installation

Add this line to your application's Gemfile:

gem 'video_url_parser'

And then execute:

$ bundle

Or install it yourself as:

$ gem install video_url_parser

Usage

VideoURLParser.parse('http://youtube.com/watch?v=5Qg6G7I4RS4#t=2m32s
# => { id: '5Qg6G7I4RS4', provider: :youtube }

VideoURLParser.parse('https://www.facebook.com/McLaren.Racing/videos/vb.12254981412/10153309389781413')
# => { id: '10153309389781413', provider: :facebook }

VideoURLParser.parse('https://example.com')
# => nil

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Contributing

If you have a false negative, I would love to hear it. If you would like support for other video providers, please ask as well.

Bug reports and pull requests are welcome on GitHub at https://github.com/mkenyon/video_url_parser.

License

The gem is available as open source under the terms of the MIT License.