get-youtube-id

get youtube id from string in crystal

get-youtube-id

Build Status

stole RegEx from https://gist.github.com/niquepa/4c59b7d52a15dde2367a

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      get-youtube-id:
        github: iomcr/get-youtube-id
    
  2. Run shards install

Usage

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"}

Contributing

  1. Fork it (https://github.com/iomcr/get-youtube-id/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Pass tests (crystal spec --error-trace)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Contributors

  • IOM - creator and maintainer
Repository

get-youtube-id

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • about 3 years ago
  • January 30, 2020
License

MIT License

Links
Synced at

Sun, 17 Nov 2024 19:40:07 GMT

Languages