• Windows Mac Android Linux
    Tools News Blog How To
  • Articles (current)
  • Submit Software
    • Register Login

    How to get youtube channel video list?

    • paksoft2009
    • 2018-03-01 18:19:37
    • 2,425

    In this tutorial How to get youtube channel video list, we will use C# to get list of all the videos uploaded on a youtube channel. This comes handy when we need to audit our youtube channel or doing some research, or anything sneaky. :)

    To make sure we aren't re-inventing the wheel here, we will use opensource downloader utilities like youtube-dl and NewtonSoft.Json for this purpose. So go ahead and install NewtonSoft.Json using nugget and download youtube-dl's binary.

    Follow these steps to create a new project in Visula Studio

    1. Create new project and select Console Apllication

      Create new Visual Studio Project

      image

    2. Install NewtonSoft.Json using nugget manager.

      Install NewtonSoft.Json using nugget manager

      Search json in nugget manager

    3. Download youtube-dl and place it in debug folder.

      VS debug folder

    4. Now create these two classes

      public class Entry{ public string title { get; set; } public string id { get; set; } public string ie_key { get; set; } public string _type { get; set; } public string url { get; set; }
      }
      public class RootObject{ public string extractor_key { get; set; } public string extractor { get; set; } public string webpage_url_basename { get; set; } public string title { get; set; } public List entries { get; set; } public string webpage_url { get; set; } public string _type { get; set; } public string id { get; set; }
      }
    5. In main class Program.cs, place this code as is, you can change anything you like.

      public static void Main(string[] args)
      { string exePath = Environment.GetCommandLineArgs()[0]; string appPath = exePath.Replace("ConsoleApplication1.exe", ""); string youtubedl = ""; youtubedl = appPath + "youtube-dl.exe"; string log = appPath + "log.txt"; string youtubeUrl = ""; //We will create a bat file to send channel link to exe as argument so we dont have to compile our program again for another channel url. if (args.Length > 0) { youtubeUrl = args[0]; //string youtubeUrl = "https://www.youtube.com/channel/UCuReY4zNcUkX0T879HlGosg"; Console.WriteLine("Channel Url: "+youtubeUrl); Console.WriteLine("Process Started"); try { string youtubedlSource = ""; var startinfo = new ProcessStartInfo(youtubedl) { CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, Arguments = string.Format(" --flat-playlist --get-title --dump-single-json \"{0}\"", youtubeUrl) }; Process process = new Process { StartInfo = startinfo }; process.Start(); var reader = process.StandardOutput; youtubedlSource = process.StandardOutput.ReadToEnd(); process.WaitForExit(); if (youtubedlSource != null) { string json = youtubedlSource.Trim(); RootObject m = JsonConvert.DeserializeObject(json); foreach (var item in m.entries) { string line = "https://youtube.com/watch?v="+item.url + "," + item.title.Replace(","," "); Console.WriteLine(item.url + ":" + item.title); using (var sw = new StreamWriter(log, true)) { sw.Write(line+Environment.NewLine); } } } } catch {	//Catch exceptions here } Console.WriteLine("Process Finished"); Console.ReadLine(); }
      }
    6. Now build the project. It will create an exe in debug folder.

      Build Visual Studio Project

      Compiled Exe in debig folder

    7. Now create a run.bat file in same debug folder with following content.

      ConsoleApplication1.exe "YOUR YOUTUBE CHANNEL LINK HERE"

      Create BAT file

    8. Save and run this run.bat, it will create a log.txt containing all the youtube video links in that channel.

      Youtube channel video links


    Most Read
    • How to uninstall idm from windows 10?
    • How to Uninstall ‘Get forms online’ Malware?
    • How to turn on phone without power button?
    • How to get and save user input during installation using Advanced Installer?
    • How to protect your .net software code with ILProtector?
    • How to fix failed download in Youtube to Mp3 Pro?
    • How to Fix iPhone White Screen of Death?
    • How to Convert JPG to ICO
    • How to Convert JPG to SVG
    • How to Convert PNG to JPG
    Random Article Write An Article
    Standalone Installer

    Standalone Installer © 2022

    Our Projects
    • Free PDF Solutions
    • Media Freeware
    • Free Picture Solutions
    • Tiny Mini Tools
    • PDF Tools
    Standalone
    • Online Tools
    • News
    • Blog
    • How to
    Legal
    • Privacy Policy
    • Contact
    • Report