Esempio n. 1
0
        public static string getTitle(string url)
        {
            string opts = "--get-title " + url;
            var    p    = CLI.runYouTubeCommand(binPath, opts);

            p.Start();
            return(p.StandardOutput.ReadToEnd().Trim());
        }
Esempio n. 2
0
        public static string getVersion()
        {
            string opts = "--version";
            var    p    = CLI.runYouTubeCommand(binPath, opts);

            p.Start();
            return(p.StandardOutput.ReadToEnd().Trim());
        }
Esempio n. 3
0
        public static string getExtractors()
        {
            string opts = "--list-extractors";
            var    p    = CLI.runYouTubeCommand(binPath, opts);

            p.Start();
            return(p.StandardOutput.ReadToEnd().Trim());
        }
Esempio n. 4
0
        public static MediaInfoData getMediaData(string url)
        {
            string opts = "-s --no-warnings --no-cache-dir --print-json " + url;
            var    p    = CLI.runYouTubeCommand(binPath, opts);
            string json = p.StandardOutput.ReadToEnd().Trim();

            return(JsonConvert.DeserializeObject <MediaInfoData>(json));
        }
Esempio n. 5
0
        private void FrameAbout_Load(object sender, EventArgs e)
        {
            labelVersion.Text = Common.getAppVersion();

            try
            {
                var p     = CLI.runYouTubeCommand(YouTubeDL.binPath, "--list-extractors");
                var lines = "* " + p.StandardOutput.ReadToEnd().Trim().Replace("\n", "\r\n* ");
                textExtractors.Text = lines;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                textExtractors.Text = "ERROR: Can't get list of supported services.";
            }
        }
Esempio n. 6
0
        public static List <PlaylistInfoItem> getPlaylistMetadata(string url)
        {
            string opts = "-i --no-warnings --no-cache-dir --dump-json --flat-playlist --skip-download --yes-playlist " + url;
            var    p    = CLI.runYouTubeCommand(binPath, opts);

            p.Start();

            string json = p.StandardOutput.ReadToEnd().Trim();

            // youtube-dl returns an individual json object per line
            json = "[" + json;
            int i = json.IndexOf('\n');

            while (i > -1)
            {
                json = json.Insert(i, ",");
                i    = json.IndexOf('\n', i + 2);
            }
            json += "]";
            return(JsonConvert.DeserializeObject <List <PlaylistInfoItem> >(json));
        }
Esempio n. 7
0
 public static Process run(string opts)
 {
     return(CLI.runYouTubeCommand(binPath, opts));
 }