public string GetVideoLink(string VidLiink, bool hd) { try { if (!VidLiink.Contains("www.vidlii.com")) { return("Not a Vidlii Link"); } if (IsVideo(VidLiink)) { string VideoLink = ""; using (var client = new GetClient()) { string ID = VidLiink.Substring(VidLiink.LastIndexOf("=") + 1); string FILEHTML = ID + ".lii"; System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; client.DownloadFile("https://www.vidlii.com/embed?v=" + ID + "&a=1", FILEHTML); VideoLink = ScanVideo(FILEHTML, hd); if (VideoLink == "No Video Found") { return("Not a Valid Video"); } return(VideoLink); } if (Check204(VidLiink)) { return("Not a Valid Video"); } return(VideoLink); } else { return("Not a Vidlii Video Link"); } } catch { return("Not a Vidlii Video Link (Error)"); } }
static void Main(string[] args) { Vidlib s = new Vidlib(); // DownLoadFileBG("https://i.r.worldssl.net/usfi/v/dGOn0zLQ9DK.3q8vaXQ5L9csuO7ed4OYhNaeTsLyJN-lkv2bYmmA6um5XzqCkx6js9IZiGAAC9_rOQLgCarvA-3HKLb6.mp4", "x\\Succ.mp4"); // Console.ReadLine(); if (ScreenArguments(args, "-get-thumb")) { Thumb = true; // Console.WriteLine("Tag"); } if (ScreenArguments(args, "-archive")) { Archivefile = args[ScreenArgumentsLoc(args, "-archive")]; saveprogress = true; if (File.Exists(Archivefile)) { using (StreamReader reader = new StreamReader(Archivefile)) { while (!reader.EndOfStream) { Archive.Add(reader.ReadLine()); } } } // if (!File.Exists(Archivefile)) File.Create(Archivefile); // Console.WriteLine("Tag"); } if (ScreenArguments(args, "-help")) { Metadata = true; const int pad = 15; // Console.WriteLine("Tag"); Console.WriteLine("Usage: \nVidlib.exe [misc arguments] [-archive <file>] -path <location>\n<Link/path to file with links> \n"); Console.WriteLine("Arguments:\n"); Console.Write(PadFormat("-HQ", pad)); Console.WriteLine("Downloads the 720p version of the video if possible"); Console.Write(PadFormat("-get-thumb", pad)); Console.WriteLine("Downloads the thumbnail"); Console.Write(PadFormat("-save-metadata", pad)); Console.WriteLine("Saves the json metadata of the video"); Console.Write(PadFormat("-no-video", pad)); Console.WriteLine("skips downloading the video file (useful for updating metadata)"); Console.Write(PadFormat("-path <file>", pad)); Console.WriteLine("A mandatory argument, followed by the path to the file,"); Console.Write(PadFormat(" ", pad)); Console.WriteLine("path takes special arguments to generate the file location"); Console.Write(PadFormat(" @[url]", pad + 5)); Console.WriteLine("video id"); Console.Write(PadFormat(" @[file]", pad + 5)); Console.WriteLine("CDN server file id"); Console.Write(PadFormat(" @[title]", pad + 5)); Console.WriteLine("video title"); Console.Write(PadFormat(" @[category]", pad + 5)); Console.WriteLine("Video Category"); Console.Write(PadFormat(" @[uploaded_by]", pad + 5)); Console.WriteLine("Uploader"); Console.Write(PadFormat(" @[uploaded_on]", pad + 5)); Console.WriteLine("Upload date"); Console.Write(PadFormat(" @[ext]", pad + 5)); Console.WriteLine("Extension (MANDATORY)\n"); Console.Write(PadFormat("-archive <filename>", pad + 5)); Console.WriteLine("saves the downloaded video id to a file so that you don't download it again."); Console.ReadLine(); return; } if (ScreenArguments(args, "-save-metadata")) { Metadata = true; // Console.WriteLine("Tag"); } if (ScreenArguments(args, "-HQ")) { HQ = true; // Console.WriteLine("Tag"); } if (ScreenArguments(args, "-no-video")) { Video = false; // Console.WriteLine("Tag"); } string UPath = ""; if (ScreenArguments(args, "-path")) { UPath = args[ScreenArgumentsLoc(args, "-path")]; path = UPath; Console.WriteLine(path); if (path.Contains("@[")) { path = path.Substring(0, path.IndexOf("@[")); } if (!Directory.Exists(path)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Location Does not exist"); Console.ReadLine(); } if (!UPath.Contains("@[ext]")) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("WARNING: PATH NEEDS @[ext] FOR THE PROGRAM TO WORK"); Console.ReadLine(); } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("WARNING: Program needs path argument to work"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Run with -help to print syntax"); Console.ReadLine(); } string link = args[args.Length - 1]; //console.ReadLine(); if (link.Contains("watch") || link.Contains("user")) { if (link.Contains("vidlii.com")) { if (link.Contains("watch") && link.Contains("=")) { path = UPath; Download(link, path, s); } else if (link.Contains("user")) { bool finished = false; int page = 0; while (!finished) { WebClient client = new WebClient(); System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; client.DownloadFile(link, "channelraw.html"); string extractedID = Scanforid("channelraw.html"); if (File.Exists(extractedID)) { File.Delete((extractedID)); } s.MakeRequest(extractedID, page.ToString()); // Console.ReadLine(); Console.WriteLine("Requesting Metadata"); while (!File.Exists(extractedID)) { Thread.Sleep(50); } if (error) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error Encountered while downloading json metadata"); } Console.WriteLine("File found"); foreach (string X in File.ReadAllLines(extractedID)) { if (X == "finished") { finished = true; break; } path = UPath; if (!string.IsNullOrWhiteSpace(X)) { Download("https://www.vidlii.com/watch?v=" + X, path, s); } } page++; } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("This type of vidlii link is not supported"); Console.ReadLine(); } } } else { Console.WriteLine(link); if (File.Exists(link)) { foreach (string fileline in File.ReadAllLines(link)) { if (!string.IsNullOrWhiteSpace(fileline)) { link = fileline; if (link.Contains("vidlii.com")) { if (link.Contains("watch") && link.Contains("=")) { path = UPath; Download(link, path, s); } else if (link.Contains("user")) { bool finished = false; int page = 0; while (!finished) { WebClient client = new WebClient(); System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; client.DownloadFile(link, "channelraw.html"); string extractedID = Scanforid("channelraw.html"); if (File.Exists(extractedID)) { File.Delete((extractedID)); } s.MakeRequest(extractedID, page.ToString()); // Console.ReadLine(); Console.WriteLine("Requesting Metadata"); while (!File.Exists(extractedID)) { Thread.Sleep(50); } if (error) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error Encountered while downloading json metadata"); } Console.WriteLine("File found"); foreach (string X in File.ReadAllLines(extractedID)) { if (X == "finished") { finished = true; break; } path = UPath; if (!string.IsNullOrWhiteSpace(X)) { Download("https://www.vidlii.com/watch?v=" + X, path, s); } } page++; } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("This type of vidlii link is not supported"); Console.ReadLine(); } } } } } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Not a vidlii link/cannotfind file"); Console.ReadLine(); } } Console.WriteLine("Download Finished"); if (debug) { s.MakeRequest("moonman", "0"); //s.MakeVideoRequest("X5rOJ7IVLaJ"); s.MakeRequest(Console.ReadLine(), Console.ReadLine()); string H2; H2 = Console.ReadLine(); return; using (var client = new GetClient()) { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; client.DownloadFile("https://www.vidlii.com/user/DhanesWara", "test"); } Console.WriteLine(s.GetThumbnailLink("https://www.vidlii.com/watch?v=7f9sXjsG4at")); Console.WriteLine(s.GetVideoLink("https://www.vidlii.com/watch?v=7f9sXjsG4at", false)); Console.ReadLine(); } return; }