public override ScrapedPage ScrapeVideos(SearchParameters sparam = null)
        {
            var rootUrl = RootUrl;
            if (sparam != null )
            {
                if (!String.IsNullOrEmpty(sparam.Url))
                    rootUrl = sparam.Url;
                var ub = new Uri(rootUrl);
                if (!String.IsNullOrEmpty(sparam.Query))
                {
                    ub = ub.AddQuery("k", sparam.Query);
                    ub = ub.AddQuery("sort", sparam.SortBy == VideoSortby.Relevance ? "relevance"
                        : (sparam.SortBy == VideoSortby.Rating ? "rating" : "uploaddate"));
                    ub = ub.AddQuery("durf", sparam.Duration == VideoDuration.All ? "allduration" : (sparam.Duration == VideoDuration.Long ? "10min_more" :
                        (sparam.Duration == VideoDuration.Short ? "1-3min" : "3-10min")));
                    ub = ub.AddQuery("datef", sparam.Period == VideoPeriod.Anytime ? "all" : (sparam.Period == VideoPeriod.Today ? "today" :
                        ((sparam.Period == VideoPeriod.ThisWeek ? "week" : "month"))));
                    rootUrl = ub.AbsoluteUri;
                }
            }

            var page = new ScrapedPage();
            var elem = GotoUrl(rootUrl);
            page.Videos =  ScrapThumbnailVideos(elem);
            //get next page
            var pages = SelectItems(elem, ".pagination.small.top a").ToList();
            foreach (var p in pages)
            {
                bool selected = p.Attributes["class"] != null && p.Attributes["class"].Value == "sel";
                page.Links.Add(new PagingLink
                {
                    Url = selected? rootUrl : new Uri(new Uri(RootUrl), p.Attributes["href"].Value).AbsoluteUri,
                    IsSelected = selected,
                    Text = p.InnerText
                });
            }

               var showMore = SelectItem(elem, ".showMore a");
               if (showMore != null)
               {
                page.Links.Add(new PagingLink
                {
                    Url = String.Format("{0}{1}", RootUrl, showMore.Attributes["href"].Value),
                    Text = showMore.InnerText,
                });
               }

            return page;
        }
        public void ScrapVideosAsync(IScraperServiceCallback callback, SearchParameters sparam = null)
        {
            ThreadPool.QueueUserWorkItem(delegate
            {
                try
                {
                    callback.OnScrapVideoCompleted(new XVideoScraper().ScrapeVideos(sparam));
                }
                catch (Exception ex)
                {
                    callback.OnScrapError(ex);
                }

            });
        }
 public void TriggerSearch(SearchParameters param)
 {
     Program.SetBusy();
     this.verticalSingleColumnGalleryWidget1.ClearItems();
     new ScraperService().ScrapVideosAsync(this, param);
 }
 public void TriggerSearch(SearchParameters param)
 {
     Initialize(new ScrapedPage { Videos = DataService.Create().SearchVideos(param.Query) });
 }
 public void TriggerSearch(SearchParameters param)
 {
     throw new NotImplementedException();
 }
 public abstract ScrapedPage ScrapeVideos(SearchParameters sparam);
 public void TriggerSearch(SearchParameters param)
 {
     Program.SetBusy();
     new ScraperService().ScrapVideosAsync(this, param);
 }
 public SearchEventArgs(string query)
 {
     Params = new SearchParameters();
     Params.Query = query;
 }
 public ScrapedPage ScrapVideos(SearchParameters sparam = null)
 {
     var scraper = new XVideoScraper();
     return scraper.ScrapeVideos(sparam);
 }