def get_title(url): """ Return the title of the passed URL. """ ydl_opts = {"quiet": True} ydl = youtube_dl.YoutubeDL(ydl_opts) data = ydl.extract_info(url, False) try: return stringutils.remove_yt_words(data["title"]) except KeyError: logger.error("Wasn't able to extract the name of the song.") return ""
def __get_title_from_yt(url, ytdl_config: str = None): """ Return the title of the passed URL. """ ydl_opts = ydl_opts_with_config(ytdl_config=ytdl_config) logger.debug(url) ydl = yt_dlp.YoutubeDL(ydl_opts) try: data = ydl.extract_info(url, False) return stringutils.remove_yt_words(data["title"]) except DownloadError: raise ExtractError(url) except KeyError: logger.error("Wasn't able to extract the name of the song.") return ""
def get_title(url): """ Return the title of the passed URL. """ ydl_opts = { "quiet": True, 'nocheckcertificate': True, 'source_address': '0.0.0.0' } logger.debug(url) ydl = youtube_dl.YoutubeDL(ydl_opts) data = ydl.extract_info(url, False) try: return stringutils.remove_yt_words(data["title"]) except KeyError: logger.error("Wasn't able to extract the name of the song.") return ""