module Ranker
Extended Modules
Defined in:
search/ranking.crConstant Summary
-
GARBAGE_PHRASES =
["cover", "album", "live", "clean", "version", "full", "full album", "row", "at", "@", "session", "how to", "npr music", "reimagined", "version", "trailer"]
-
GOLDEN_PHRASES =
["official video", "official music video"]
Instance Method Summary
-
#rank_videos(spotify_metadata : JSON::Any, yt_metadata : YT_METADATA_CLASS, query : String) : Array(Hash(String, Int32))
Will rank videos according to their title and the user input, returns a sorted array of hashes of the points a song was assigned and its original index spotify_metadata is the metadate (from spotify) of the song that you want yt_metadata is an array of hashes with metadata scraped from the youtube search result page query is the query that you submitted to youtube for the results you now have ``` Ranker.rank_videos(spotify_metadata, yt_metadata, query) => [ {"points" => x, "index" => x}, ...
Instance Method Detail
Will rank videos according to their title and the user input, returns a sorted array of hashes of the points a song was assigned and its original index spotify_metadata is the metadate (from spotify) of the song that you want yt_metadata is an array of hashes with metadata scraped from the youtube search result page query is the query that you submitted to youtube for the results you now have
Ranker.rank_videos(spotify_metadata, yt_metadata, query)
=> [
{"points" => x, "index" => x},
...
]
"index" corresponds to the original index of the song in yt_metadata