public void getAllVideoId_goodData() { LinksFromPlaylist linksFromPlaylist = new LinksFromPlaylist(); UserGetSet.input(); UserGetSet.apiKey = "AIzaSyCBYx5nDeHanit6rpvzhZLSDy52diu7ecI"; List <string> list = linksFromPlaylist.getLinks("https://www.youtube.com/playlist?list=PLYQ21GguN2ssJfHlwxZxzepHaiu3t798Y"); CollectionAssert.AreEqual(list, linksFromPlaylist.getLinks("https://www.youtube.com/playlist?list=PLYQ21GguN2ssJfHlwxZxzepHaiu3t798Y")); }
public void addSongs(string playlistName, string url, string yesNo) { LinksFromPlaylist linksFromPlaylist = new LinksFromPlaylist(); GetTitles getTitles = new GetTitles(); List <string> videoId = linksFromPlaylist.getLinks(url); List <string> videoTitle = getTitles.getTitles(url); SQLiteConnection sqlite_conn = new SQLiteConnection("Data Source=YourTubeDB.db; Version = 3; New = True; Compress = True; "); sqlite_conn.Open(); SQLiteCommand sqlite_cmd; sqlite_cmd = sqlite_conn.CreateCommand(); for (int i = 0; i < videoId.Count; i++) { sqlite_cmd.CommandText = "INSERT INTO Titles (PlaylistID, VideoTitle, VideoId, DownloadedVideo) VALUES('" + playlistName + "' ,'" + videoTitle[i] + "' ,'" + videoId[i] + "', '" + yesNo + "'); "; sqlite_cmd.ExecuteNonQuery(); } }
public void addSongs(string playlistName, string url, string yesNo) { LinksFromPlaylist linksFromPlaylist = new LinksFromPlaylist(); GetTitles getTitles = new GetTitles(); List <string> videoId = linksFromPlaylist.getLinks(url); List <string> videoTitle = getTitles.getTitles(url); sqlite_conn.Open(); SQLiteCommand sqlite_cmd = sqlite_conn.CreateCommand(); for (int i = 0; i < videoId.Count; i++) { videoTitle[i] = videoTitle[i].Replace("\"", "").Replace("'", ""); sqlite_cmd.CommandText = "INSERT INTO Titles (PlaylistID, VideoTitle, VideoId, DownloadedVideo, VideoUrl) VALUES('" + playlistName + "' ,'" + videoTitle[i] + "' ,'" + videoId[i] + "', '" + yesNo + "', '" + url + "'); "; sqlite_cmd.ExecuteNonQuery(); } sqlite_cmd.CommandText = "INSERT INTO PlaylistInfo (PlaylistName, PlaylistID) VALUES('" + playlistName + "','" + url + "')"; sqlite_cmd.ExecuteNonQuery(); sqlite_conn.Close(); }