Exemplo n.º 1
0
        public YouTubeTileData (Video video)
        {
            BansheePlaybackUri = GetPlaybackUri (video);
            BrowserPlaybackUri = video.WatchPage.AbsoluteUri;
            Title = video.Title;
            Uploader = video.Uploader;

            try {
                RatingValue = (int) Math.Round (video.RatingAverage);
            } catch (Exception e) {
                Log.DebugException (e);
            }

            try {
                DataFetch df = new DataFetch ();
                Thumbnail = df.DownloadContent (video.Thumbnails[0].Url, CacheDuration.Normal);
            } catch (Exception e) {
                Log.DebugException (e);
                Thumbnail = null;
            }
        }
Exemplo n.º 2
0
        private static string GetTParam (string yt_video_uri)
        {
            string t_param;
            DataFetch df = new DataFetch ();
            string watch_page_contents = df.GetWatchPageContents (yt_video_uri);

            if (String.IsNullOrEmpty (watch_page_contents)) {
                return null;
            }

            Regex regex = new Regex ("swfHTML = .*&t=([^&]+)&");
            Match match = regex.Match (watch_page_contents);

            if (!match.Success) {
                return null;
            }

            t_param = Regex.Unescape (match.Result ("$1"));
            if (t_param == null) {
                t_param = match.Result ("$1");
            }

            return t_param;
        }