Beispiel #1
0
        private void DownloadSubtitle(string vUrl, string vFileName)
        {
            var    subtitleUrl = GetEnglishSubtitleUrl(vUrl);
            string fileName;
            var    content = DownloadHelper.DownloadTxtFile(subtitleUrl, out fileName);

            fileName = Path.GetFileNameWithoutExtension(vFileName) + ".srt";
            var path = txbSaveFolder.Text + "\\" + fileName;

            WriteFile(path, content);
        }
Beispiel #2
0
        private void btnDownloadSubtitle_Click(object sender, EventArgs e)
        {
            string[] lines = richTextBox1.Text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string line in lines)
            {
                foreach (string url in GetVideoUrls(line))
                {
                    try
                    {
                        var    subtitleUrl = GetEnglishSubtitleUrl(url);
                        string fileName;
                        var    content = DownloadHelper.DownloadTxtFile(subtitleUrl, out fileName);
                        var    path    = txbSaveFolder.Text + "\\" + fileName;
                        WriteFile(path, content);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(url + " error:" + ex.Message);
                    }
                }
            }
            MessageBox.Show("OK");
        }