module Ranker

Extended Modules

Defined in:

search/ranking.cr

Constant 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

Instance Method Detail

def 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},
     ...
   ]

"index" corresponds to the original index of the song in yt_metadata


[View source]