public async Task EditVideo(VideoListAdminDTO vid) { Video = await AdminRep.GetVideoByIdAsync(vid.Id); Video.DatabaseCategories = await AdminRep.GetCategoriesAsync(); Video.IsEdited = true; }
public void GetRedTubeVideos(List <VideoListAdminDTO> Videos, string category) { using (var client = new WebClient()) { var html = ""; client.Headers.Add("user-agent", "Mozilla / 5.0(Windows NT 10.0; WOW64; Trident / 7.0; rv: 11.0) like Gecko"); if (string.IsNullOrWhiteSpace(category)) { html = client.DownloadString("https://redtube.com"); } else { try { html = client.DownloadString(ConvertCategoryRedtube(category)); } catch { html = client.DownloadString("https://redtube.com"); } } HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); var videoDivs = document.DocumentNode.SelectNodes("//div[@class='video_block_wrapper']").ToList(); int count = 0; Images = GetImages(category); foreach (HtmlNode item in videoDivs) { VideoListAdminDTO video = new VideoListAdminDTO(); var a = item.SelectSingleNode(".//a"); var img = a.SelectSingleNode(".//img"); video.Img = img.GetAttributeValue("data-thumb_url", string.Empty); if (!ImageExists(video.Img, Images)) { var duration = item.SelectSingleNode(".//span[@class='duration']").InnerText.Replace(" ", "").Replace("\n", ""); if (duration.Substring(0, 2) == "HD") { video.HD = true; video.Duration = duration.Substring(2); } else { video.Duration = duration; } video.Id = count; count = count + 1; video.Preview = img.GetAttributeValue("data-mediabook", string.Empty); video.Title_en = img.GetAttributeValue("alt", string.Empty); video.Url = "https://redtube.com" + a.GetAttributeValue("href", string.Empty); if (!string.IsNullOrWhiteSpace(video.Img) && !string.IsNullOrWhiteSpace(video.Preview)) { Videos.Add(video); } } } } }
public void GetPornHubVideos(List <VideoListAdminDTO> Videos, string category) { using (var client = new WebClient()) { var html = ""; client.Headers.Add("user-agent", "Mozilla / 5.0(Windows NT 10.0; WOW64; Trident / 7.0; rv: 11.0) like Gecko"); if (string.IsNullOrWhiteSpace(category)) { html = client.DownloadString("https://www.pornhub.com/"); } else { html = client.DownloadString(ConvertToCategoryId(category)); } HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); var wraps = document.DocumentNode.SelectNodes("//div[@class='phimage']").ToList(); int count = 0; Images = GetImages(category); foreach (HtmlNode item in wraps) { VideoListAdminDTO video = new VideoListAdminDTO(); var a = item.SelectSingleNode(".//a"); var img = a.SelectSingleNode(".//img"); try { var durationHDdiv = item.SelectSingleNode(".//var[@class='duration']").ParentNode; if (durationHDdiv.SelectSingleNode(".//span[@class='hd-thumbnail']") != null) { video.HD = true; } video.Duration = durationHDdiv.SelectSingleNode(".//var[@class='duration']").InnerText; video.Title_en = img.GetAttributeValue("alt", string.Empty); video.Img = img.GetAttributeValue("data-mediumthumb", string.Empty); if (string.IsNullOrEmpty(video.Img)) { video.Img = img.GetAttributeValue("data-image", string.Empty); } if (!ImageExists(video.Img, Images)) { video.Preview = img.GetAttributeValue("data-mediabook", string.Empty); video.Url = "https://www.pornhub.com" + a.GetAttributeValue("href", string.Empty); video.Id = count; count = count + 1; Videos.Add(video); } } catch { } } } }
public void GetDrTuberVideos(List <VideoListAdminDTO> Videos, string category) { using (var client = new WebClient()) { var html = ""; client.Headers.Add("user-agent", "Mozilla / 5.0(Windows NT 10.0; WOW64; Trident / 7.0; rv: 11.0) like Gecko"); try { if (category == "ebony") { html = client.DownloadString("http://www.drtuber.com/black-and-ebony"); } else { html = client.DownloadString("http://www.drtuber.com/" + category); } } catch { html = client.DownloadString("http://www.drtuber.com/" + category + "s"); } HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); var videos = document.DocumentNode.SelectNodes("//a[@class='th ch-video']").ToList(); Images = GetImages(category); int count = 0; foreach (HtmlNode item in videos) { VideoListAdminDTO video = new VideoListAdminDTO(); var img = item.SelectSingleNode(".//img"); if (!ImageExists(img.GetAttributeValue("src", string.Empty), Images)) { var toolbar = item.SelectSingleNode("./strong"); var hd = toolbar.SelectSingleNode(".//i[@class='quality']"); if (hd != null) { video.HD = true; } video.Duration = toolbar.SelectSingleNode(".//em[@class='time_thumb']").InnerText.Replace(" ", ""); video.Img = img.GetAttributeValue("src", string.Empty); video.Preview = img.GetAttributeValue("data-webm", string.Empty); video.Title_en = img.GetAttributeValue("alt", string.Empty); video.Url = "http://www.drtuber.com" + item.GetAttributeValue("href", string.Empty); video.Id = count; count = count + 1; Videos.Add(video); } } } }
public async Task OpenModal(VideoListAdminDTO vid) { Video.Duration = vid.Duration; Video.HD = vid.HD; Video.Img = vid.Img; Video.Preview = vid.Preview; Video.Title = vid.Title; Video.Title_en = vid.Title_en; Video.Url = vid.Url; Video.Id = vid.Id; if (SelectedWebCategory == "gay") { Video.AllowMain = false; Video.CheckBoxEnabled = false; } if (Video.DatabaseCategories.Count() == 0) { Video.DatabaseCategories = await AdminRep.GetCategoriesAsync(); } if (SwitchWebsite == 0) { SpiderRep.GetCategoriesRedTube(Video); } else if (SwitchWebsite == 1) { SpiderRep.GetCategoriesXhamster(Video); } else if (SwitchWebsite == 2) { SpiderRep.GetCategoriesDrTuber(Video); } else if (SwitchWebsite == 3) { SpiderRep.GetCategoriesPornHub(Video); } }
public void GetXhamsterVideos(List <VideoListAdminDTO> Videos, string category) { using (var client = new WebClient()) { var html = ""; client.Headers.Add("user-agent", "Mozilla / 5.0(Windows NT 10.0; WOW64; Trident / 7.0; rv: 11.0) like Gecko"); if (string.IsNullOrEmpty(category)) { html = client.DownloadString("https://xhamster.com"); } else { try { html = client.DownloadString("https://xhamster.com/categories/" + category); } catch { html = client.DownloadString("https://xhamster.com/categories/" + category + "s"); } } HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); IEnumerable <HtmlNode> videoDivsDate; IEnumerable <HtmlNode> videoDivsProm = document.DocumentNode.SelectNodes("//div[@class='thumb-list__item video-thumb']").ToList(); try { videoDivsDate = document.DocumentNode.SelectNodes("//div[@class='thumb-list__item video-thumb video-thumb--dated']").ToList(); } catch { videoDivsDate = null; } IEnumerable <HtmlNode> videosConc; if (videoDivsDate != null) { videosConc = videoDivsProm.Concat(videoDivsDate); } else { videosConc = videoDivsProm; } Images = GetImages(category); int count = 0; foreach (HtmlNode item in videosConc) { VideoListAdminDTO video = new VideoListAdminDTO(); var a = item.SelectSingleNode(".//a"); video.Img = a.ChildNodes[3].GetAttributeValue("src", string.Empty); if (!ImageExists(video.Img, Images)) { var hd = a.SelectSingleNode(".//i[@class='thumb-image-container__icon thumb-image-container__icon--hd']"); if (hd != null) { video.HD = true; } video.Preview = a.GetAttributeValue("data-previewvideo", string.Empty); video.Url = a.GetAttributeValue("href", string.Empty); video.Title_en = a.SelectSingleNode(".//img").GetAttributeValue("alt", string.Empty); video.Duration = a.SelectSingleNode(".//div[@class='thumb-image-container__duration']").InnerText; video.Id = count; count = count + 1; Videos.Add(video); } } } }