module Youtube

Extended Modules

Defined in:

search/youtube.cr

Constant Summary

VALID_LINK_CLASSES = ["yt-simple-endpoint style-scope ytd-video-renderer", "yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2 yt-uix-sessionlink spf-link "]

Instance Method Summary

Instance Method Detail

def find_url(spotify_metadata : JSON::Any, flags = {} of String => String) : String | Nil #

Finds a youtube url based off of the given information. The query to youtube is constructed like this: "<song_name> <artist_name> " If download_first is provided, the first link found will be downloaded. If select_link is provided, a menu of options will be shown for the user to choose their poison

Youtube.find_url("Bohemian Rhapsody", "Queen")
=> "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

[View source]
def is_valid_url(url : String) : Bool #

Checks if the given URL is a valid youtube URL

Youtube.is_valid_url("https://www.youtube.com/watch?v=NOTANACTUALVIDEOID")
=> false

[View source]