// 비주얼스튜디오 > 도구 > NuGet패키지관리자 > 솔류션용 NuGet패키지관리 > VideoLibrary 검색 설치 (프레임웍:4.7.2, VideoLibrary:3.1.9)
using System;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using VideoLibrary;
using System.Net;
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
char[] invalidChars = System.IO.Path.GetInvalidFileNameChars(); // 허용하지 않는 파일명을 찾기위해
public Form1()
{
InitializeComponent();
//cbbDownType.Items.Clear();
//cbbDownType.DisplayMember = "Text";
//cbbDownType.ValueMember = "Value";
//cbbDownType.Items.Add(new { Text = "MP4 And MP3", Value = "0" });
//cbbDownType.Items.Add(new { Text = "Only MP4", Value = "1" });
//cbbDownType.Items.Add(new { Text = "Only MP3", Value = "2" });
//cbbDownType.SelectedIndex = 0;
}
private void btnFolderSelect_Click(object sender, EventArgs e)
{
//folderDialog.ShowDialog();
}
private void button1_Click(object sender, EventArgs e)
{
string strUrl = "https://youtu.be/s3MiZJy4PLg?feature=shared";
//string strType = (cbbDownType.SelectedItem as dynamic).Value;
//if (string.IsNullOrEmpty(folderDialog.SelectedPath))
//{
// folderDialog.ShowDialog();
//}
//if (string.IsNullOrEmpty(folderDialog.SelectedPath) == false)
//{
// Thread trd = new Thread(() => YouTobeDown(strUrl, folderDialog.SelectedPath, strType));
// trd.Start();
//}
Thread trd = new Thread(() => YouTobeDown(strUrl, @"C:\Users\saengyeol_chun2\Desktop", ""));
trd.Start();
}
private async void YouTobeDown(string strUrl, string strSavePath, string strType)
{
try
{
WebRequest GetTitle = HttpWebRequest.Create(strUrl);
YouTube youtube = YouTube.Default;
YouTubeVideo video = await youtube.GetVideoAsync(strUrl);
string fileNm = "1111";
File.WriteAllBytes(strSavePath + @"\" + fileNm + ".mp4", await video.GetBytesAsync());
}
catch (Exception ex)
{
//throw;
}
//if (strType == "0" || strType == "2")
//{
//}
}
}
}
2025년 2월 5일 수요일
유튜브-변환
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기