public static string GetImageUrlFromId(YoutubeImageType type, string youtubeId)
    {
        if (youtubeId == "")
        {
            return("");
        }
        string urlFormat = "https://img.youtube.com/vi/{0}/{1}.jpg";

        switch (type)
        {
        case YoutubeImageType._0:
            return(string.Format(urlFormat, youtubeId, "0"));

        case YoutubeImageType._1:
            return(string.Format(urlFormat, youtubeId, "1"));

        case YoutubeImageType._2:
            return(string.Format(urlFormat, youtubeId, "2"));

        case YoutubeImageType._3:
            return(string.Format(urlFormat, youtubeId, "3"));

        case YoutubeImageType._hqdefault:
            return(string.Format(urlFormat, youtubeId, "hqdefault"));

        case YoutubeImageType._mqdefault:
            return(string.Format(urlFormat, youtubeId, "mqdefault"));

        case YoutubeImageType._maxresdefault:
            return(string.Format(urlFormat, youtubeId, "maxresdefault"));

        default:
            return("");
        }
    }
    public static IEnumerator DownloadImage(string youtubeId, YoutubeImageType type, TextureResult texture)
    {
        WWW www = new WWW(GetImageUrlFromId(type, youtubeId));

        yield return(www);

        texture.m_texture       = www.texture;
        texture.m_hasBeenLoaded = true;
    }
    internal static string GetImageUrlFromUrl(string url, YoutubeImageType type)
    {
        Debug.Log("ulr" + url + "  --  " + type);
        if (url == "")
        {
            return("");
        }
        string id = GetYoutubeId(url);

        if (id == "")
        {
            return("");
        }

        Debug.Log("id" + id + "  --  " + type);
        return(GetImageUrlFromId(type, id));
    }