Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions TubeDl/App.config
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="TubeDl.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.net>
<defaultProxy >
<proxy autoDetect="false"/>
<defaultProxy>
<proxy autoDetect="false" />
</defaultProxy>
<connectionManagement>
<add address="*" maxconnection="100"/>
<add address="*" maxconnection="100" />
</connectionManagement>
</system.net>
<userSettings>
Expand All @@ -26,4 +26,20 @@
</setting>
</TubeDl.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Apis.Core" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.34.0.0" newVersion="1.34.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Apis" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.34.0.0" newVersion="1.34.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
6 changes: 3 additions & 3 deletions TubeDl/frmDownloadDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ public async void catchlink()
? "Audio" : TubeDlHelpers.video.Resolution.ToString() + "p";
lblsize.Text = TubeDlHelpers.GetFileSize(new Uri(TubeDlHelpers.video.DownloadUrl));
lblaudio.Text = TubeDlHelpers.video.AudioType.ToString() + " " + TubeDlHelpers.video.AudioBitrate.ToString() + "kHz";
var imgurl = "https://img.youtube.com/vi/" +
url_.Replace("http://", "").Replace("https://", "").Replace("www", "").Replace("youtube.com/watch?v=", "").Trim()
+ "/0.jpg";
var imgurl = "https://i.ytimg.com/vi/" +
url_.Replace("http://", "").Replace("https://", "").Replace("www", "").Replace("youtube.com/watch?v=", "").Trim()
+ "/default.jpg";
pictureBox1.ImageLocation = imgurl;
string vname = Unkdevt.StringHelpers.RemoveIllegalPathCharacters(TubeDlHelpers.video.Title)
+ " " + (TubeDlHelpers.video.Resolution == 0 ? "" : TubeDlHelpers.video.Resolution.ToString() + "p") + TubeDlHelpers.Extention();
Expand Down
273 changes: 149 additions & 124 deletions TubeDl/frmMain.Designer.cs

Large diffs are not rendered by default.

125 changes: 55 additions & 70 deletions TubeDl/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using System.Windows.Forms;
using YoutubeExtractor;
using Unkdevt;
using System.Text;

namespace TubeDl
{
public partial class frmMain : Form
Expand Down Expand Up @@ -156,7 +158,7 @@ void DisplayClipboardData()
catch (Exception e)
{
#if DEBUG
// MessageBox.Show(e.Message);
// MessageBox.Show(e.Message);
#endif
}
}
Expand Down Expand Up @@ -264,7 +266,7 @@ public void Download(string link, bool custome, string path, string filename)
catch (Exception ex)
{
#if DEBUG
MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
//MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
#endif
/// btndownload.Enabled = true;
//btnPause.Enabled = false;
Expand All @@ -285,65 +287,39 @@ private void OpenLocation()
#region Events
private void exButton1_Click(object sender, EventArgs e)
{
//////try
//////{
var add = new frmAddlink();
switch (add.ShowDialog())
try
{
case DialogResult.OK:
if (TubeDlHelpers.Combine)
{
var add = new frmAddlink();
switch (add.ShowDialog())
{
case DialogResult.OK:
if (TubeDlHelpers.Custome)
{
Download(TubeDlHelpers.downloadurl,
true, Path.GetDirectoryName(TubeDlHelpers.customSavePath), TubeDlHelpers.customeSavefileName);
Download(TubeDlHelpers.downloadurl,
true, Path.GetDirectoryName(TubeDlHelpers.customSavePath), TubeDlHelpers.customeSavefileName.Replace("mp4", "mp3"));
combineid++;
}
Download(TubeDlHelpers.downloadurl, true, Path.GetDirectoryName(TubeDlHelpers.customSavePath), TubeDlHelpers.customeSavefileName);
else
{

string vname = StringHelpers.RemoveIllegalPathCharacters(TubeDlHelpers.video.Title)
+ " " + (TubeDlHelpers.video.Resolution == 0 ? "" : TubeDlHelpers.video.Resolution.ToString() + "p") + "mp4";

string aname = StringHelpers.RemoveIllegalPathCharacters(TubeDlHelpers.video.Title)
+ " " + (TubeDlHelpers.video.Resolution == 0 ? "" : TubeDlHelpers.video.Resolution.ToString() + "p") + "mp3";

Download(TubeDlHelpers.downloadurl,
true, Path.GetDirectoryName(TubeDlHelpers.SavePath), vname);
Download(TubeDlHelpers.downloadurl,
true, Path.GetDirectoryName(TubeDlHelpers.SavePath), aname);
combineid++;
}
}
else if (TubeDlHelpers.Custome)
Download(TubeDlHelpers.downloadurl, true, Path.GetDirectoryName(TubeDlHelpers.customSavePath), TubeDlHelpers.customeSavefileName);
else
Download(TubeDlHelpers.downloadurl);
break;
Download(TubeDlHelpers.downloadurl);
break;

case DialogResult.Ignore:
if (TubeDlHelpers.Custome)
Download(TubeDlHelpers.downloadurl, true, Path.GetDirectoryName(TubeDlHelpers.customSavePath), TubeDlHelpers.customeSavefileName);
else
Download(TubeDlHelpers.downloadurl);
TubeDlHelpers.ldf[list_Items.Items.Count - 1].CancelDownload();
break;
case DialogResult.Ignore:
if (TubeDlHelpers.Custome)
Download(TubeDlHelpers.downloadurl, true, Path.GetDirectoryName(TubeDlHelpers.customSavePath), TubeDlHelpers.customeSavefileName);
else
Download(TubeDlHelpers.downloadurl);
TubeDlHelpers.ldf[list_Items.Items.Count - 1].CancelDownload();
break;

}
}
catch (Exception ex)
{
#if DEBUG
//MessageBox.Show(ex.Message);
#endif
}
// }
// catch (Exception ex)
// {
//#if DEBUG
// MessageBox.Show(ex.Message);

//#endif
// }
}

private void frmMain_Load(object sender, EventArgs e)
{

nextClipboardViewer = (IntPtr)SetClipboardViewer((int)this.Handle);
label1.Text = string.Format("{0} : {1}", "Default Download Location", TubeDlHelpers.savePath);
backgroundWorker1.RunWorkerAsync();
Expand Down Expand Up @@ -521,33 +497,34 @@ private void removeFromListToolStripMenuItem_Click(object sender, EventArgs e)

private void deletePermenatlyToolStripMenuItem_Click(object sender, EventArgs e)
{
//try
//{
// foreach (ListViewItem l in list_Items.SelectedItems)
if (list_Items.SelectedItems[0].SubItems[4].Text == "Completed" || list_Items.SelectedItems[0].SubItems[4].Text == "Paused")
try
{
if (MessageBox.Show("Are you sure, Do you want to move this file into recycle bin?", Text,
MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
try
foreach (ListViewItem l in list_Items.SelectedItems)
if (list_Items.SelectedItems[0].SubItems[4].Text == "Completed" || list_Items.SelectedItems[0].SubItems[4].Text == "Paused")
{
FileSystem.DeleteFile(Path.Combine(path_, list_Items.SelectedItems[0].SubItems[0].Text)
, UIOption.AllDialogs, RecycleOption.SendToRecycleBin, UICancelOption.ThrowException);
// File.Delete(Path.Combine(path_, list_Items.SelectedItems[0].SubItems[0].Text));
TubeDlHelpers.ldf.RemoveAt(list_Items.SelectedItems[0].Index);
list_Items.SelectedItems[0].Remove();

if (MessageBox.Show("Are you sure, Do you want to move this file into recycle bin?", Text,
MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
try
{
FileSystem.DeleteFile(Path.Combine(path_, list_Items.SelectedItems[0].SubItems[0].Text)
, UIOption.AllDialogs, RecycleOption.SendToRecycleBin, UICancelOption.ThrowException);
File.Delete(Path.Combine(path_, list_Items.SelectedItems[0].SubItems[0].Text));
TubeDlHelpers.ldf.RemoveAt(list_Items.SelectedItems[0].Index);
list_Items.SelectedItems[0].Remove();

}
catch { }
}
}
catch { }
}
Updatelist();
}
Updatelist();
//}
//catch { }
catch { }
}

private void btnStopDownload_Click(object sender, EventArgs e)
{

//try
//{
// foreach (ListViewItem l in list_Items.Items)
Expand Down Expand Up @@ -746,6 +723,8 @@ private void backgroundWorker2_RunWorkerCompleted(object sender, System.Componen
// MessageBox.Show(ex.Message);
//}
}


private void Process_Exited(object sender, EventArgs e)
{

Expand All @@ -762,5 +741,11 @@ private void list_Items_ItemMouseHover(object sender, ListViewItemMouseHoverEven
toolTip1.SetToolTip(this.list_Items, e.Item.Text);

}

private void button1_Click_1(object sender, EventArgs e)
{
PlaylistScrap.videoList("RDzoUBv75BC0I");
richTextBox1.Text = PlaylistScrap.ListInfo.Total;
}
}
}
61 changes: 61 additions & 0 deletions libYtd/PlaylistScrap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Script.Serialization;

namespace Unkdevt
{
public static class PlaylistScrap
{

//https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=RDzoUBv75BC0I&key=AIzaSyArc5H7bBtQAB7CR9kypwqoBjaA_wM4V_s


static string api = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=";
static string apiKey = "&key=AIzaSyArc5H7bBtQAB7CR9kypwqoBjaA_wM4V_s";
public static String ScrapPlaylist(string playlistID)
{
var request = WebRequest.Create(api + playlistID + apiKey);
var response = (HttpWebResponse)request.GetResponse();
request.ContentType = "application/json";
using (var sr = new StreamReader(response.GetResponseStream()))
{
return sr.ReadToEnd();
}
}

public static Task ScrapPlaylistasync(string playlistID)
{
return Task.Run(() => videoList(playlistID));
}

public static class ListInfo
{
public static string Total { get; set; }

}

public static void videoList(string playlistID)
{
try
{
JObject blogPostArray = JObject.Parse(ScrapPlaylist(playlistID));
ListInfo.Total = blogPostArray["pageInfo"]["totalResults"].ToString();
ListInfo.Total = blogPostArray["pageInfo"]["totalResults"].ToString();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
11 changes: 11 additions & 0 deletions libYtd/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 4 additions & 0 deletions libYtd/libYtd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -45,6 +47,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="PlaylistScrap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="YTD\AacAudioExtractor.cs" />
<Compile Include="YTD\AdaptiveType.cs" />
Expand All @@ -68,6 +71,7 @@
<Compile Include="YTD\YoutubeParseException.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down