stole RegEx from https://gist.github.com/niquepa/4c59b7d52a15dde2367a
-
Add the dependency to your
shard.yml
:dependencies: get-youtube-id: github: iomcr/get-youtube-id
-
Run
shards install
require "get-youtube-id"
# get first youtube_id as String | Nil from a string where you expect exactly 0 or 1 youtube ids.
puts Iom::GetYoutubeId::get_youtube_id "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# "dQw4w9WgXcQ"
# get youtube_id as Set{String} from a string where you expect 0 or more youtube ids.
puts Iom::GetYoutubeId::get_youtube_ids "string with list of videos https://www.youtube.com/watch?v=dQw4w9WgXcQ https://www.youtube.com/watch?v=qEkB_SQXl20"
# Set{"dQw4w9WgXcQ","qEkB_SQXl20"}
- Fork it (https://github.com/iomcr/get-youtube-id/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Pass tests (
crystal spec --error-trace
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- IOM - creator and maintainer