diff --git a/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/db.lock b/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/db.lock
new file mode 100644
index 0000000..e69de29
diff --git a/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide b/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide
new file mode 100644
index 0000000..56758a8
Binary files /dev/null and b/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide differ
diff --git a/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide-shm b/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide-shm
new file mode 100644
index 0000000..8a183e1
Binary files /dev/null and b/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide-shm differ
diff --git a/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide-wal b/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide-wal
new file mode 100644
index 0000000..92ab59c
Binary files /dev/null and b/YoutubeExtractor/.vs/YoutubeExtractor/v15/Server/sqlite3/storage.ide-wal differ
diff --git a/YoutubeExtractor/ExampleApplication.Portable/app.manifest b/YoutubeExtractor/ExampleApplication.Portable/app.manifest
new file mode 100644
index 0000000..4fddb8f
--- /dev/null
+++ b/YoutubeExtractor/ExampleApplication.Portable/app.manifest
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YoutubeExtractor/ExampleApplication/ExampleApplication.csproj b/YoutubeExtractor/ExampleApplication/ExampleApplication.csproj
index 2a54837..acbb6f6 100644
--- a/YoutubeExtractor/ExampleApplication/ExampleApplication.csproj
+++ b/YoutubeExtractor/ExampleApplication/ExampleApplication.csproj
@@ -17,7 +17,7 @@
true
- bin\Debug\
+ ..\YouTubeDownloader\bin\Debug\
DEBUG;TRACE
full
AnyCPU
@@ -32,7 +32,7 @@
true
- bin\Release\
+ ..\YouTubeDownloader\bin\Release\
TRACE
true
pdbonly
@@ -46,8 +46,16 @@
;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
false
+
+ true
+ ..\..\..\..\FinalOP\
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+ ManagedMinimumRules.ruleset
+
-
diff --git a/YoutubeExtractor/ExampleApplication/Program.cs b/YoutubeExtractor/ExampleApplication/Program.cs
index 257640a..d14d7e7 100644
--- a/YoutubeExtractor/ExampleApplication/Program.cs
+++ b/YoutubeExtractor/ExampleApplication/Program.cs
@@ -2,14 +2,30 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Text.RegularExpressions;
using YoutubeExtractor;
namespace ExampleApplication
{
internal class Program
{
- private static void DownloadAudio(IEnumerable videoInfos)
+ /*ARGUMENTS RELATED ERRORS 1-5*/
+ const uint LESSARGS_ERR = 1;
+ const uint YLINK_ERR = 2;
+ const uint DWNPATH_ERR = 3;
+ const uint AVURL_ERR = 4;
+
+ /*FILE RELATED ERRORS 5-10*/
+ const uint FEXP_ERR = 5;
+ const uint FPATH_ERR = 6;
+
+ /*YOUTUBE LINK RELATED ERRORS 10-15*/
+ const uint YLINKFORMAT_ERR = 10;
+ const uint NETCON_ERR = 11;
+
+ /*OTHER ERRORS*/
+ const uint OTHER_ERR = 99;
+
+ private static void DownloadAudio(IEnumerable videoInfos, string dwnpath)
{
/*
* We want the first extractable video with the highest audio quality.
@@ -19,14 +35,6 @@ private static void DownloadAudio(IEnumerable videoInfos)
.OrderByDescending(info => info.AudioBitrate)
.First();
- /*
- * If the video has a decrypted signature, decipher it
- */
- if (video.RequiresDecryption)
- {
- DownloadUrlResolver.DecryptDownloadUrl(video);
- }
-
/*
* Create the audio downloader.
* The first argument is the video where the audio should be extracted from.
@@ -34,13 +42,13 @@ private static void DownloadAudio(IEnumerable videoInfos)
*/
var audioDownloader = new AudioDownloader(video,
- Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
- RemoveIllegalPathCharacters(video.Title) + video.AudioExtension));
+ Path.Combine(dwnpath, Clean_Title(video.Title) + video.AudioExtension));
// Register the progress events. We treat the download progress as 85% of the progress
// and the extraction progress only as 15% of the progress, because the download will
// take much longer than the audio extraction.
audioDownloader.DownloadProgressChanged += (sender, args) => Console.WriteLine(args.ProgressPercentage * 0.85);
+
audioDownloader.AudioExtractionProgressChanged += (sender, args) => Console.WriteLine(85 + args.ProgressPercentage * 0.15);
/*
@@ -50,7 +58,7 @@ private static void DownloadAudio(IEnumerable videoInfos)
audioDownloader.Execute();
}
- private static void DownloadVideo(IEnumerable videoInfos)
+ private static void DownloadVideo(IEnumerable videoInfos, string dwnpath)
{
/*
* Select the first .mp4 video with 360p resolution
@@ -58,22 +66,14 @@ private static void DownloadVideo(IEnumerable videoInfos)
VideoInfo video = videoInfos
.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
- /*
- * If the video has a decrypted signature, decipher it
- */
- if (video.RequiresDecryption)
- {
- DownloadUrlResolver.DecryptDownloadUrl(video);
- }
-
/*
* Create the video downloader.
* The first argument is the video to download.
* The second argument is the path to save the video file.
*/
+
var videoDownloader = new VideoDownloader(video,
- Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
- RemoveIllegalPathCharacters(video.Title) + video.VideoExtension));
+ Path.Combine(dwnpath, Clean_Title(video.Title) + video.VideoExtension));
// Register the ProgressChanged event and print the current progress
videoDownloader.DownloadProgressChanged += (sender, args) => Console.WriteLine(args.ProgressPercentage);
@@ -85,26 +85,156 @@ private static void DownloadVideo(IEnumerable videoInfos)
videoDownloader.Execute();
}
- private static void Main()
+ ///
+ /// Used to maintain the log of the Current service.
+ /// Inputs: strmessage as a string.
+ /// Outputs: A log file containing the status of the Service.
+ /// Notes:
+ ///
+ public static void WriteLog(string strMessage)
{
- // Our test youtube link
- const string link = "https://www.youtube.com/watch?v=YQHsXMglC9A";
+ string Dt4 = DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy").Substring(0, 2);
+ string Dt5 = DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy").Substring(3, 2);
+ string Dt6 = DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy").Substring(6, 4);
- /*
- * Get the available video formats.
- * We'll work with them in the video and audio download examples.
- */
- IEnumerable videoInfos = DownloadUrlResolver.GetDownloadUrls(link, false);
+ string yestPath = AppDomain.CurrentDomain.BaseDirectory + "\\YouTubeDownloader" + Dt4 + Dt5 + Dt6 + ".log";
+
+ if (File.Exists(yestPath))
+ {
+ File.Delete(yestPath);
+ }
+
+ string strPath = null;
+ System.IO.StreamWriter file = null;
+ string Dt1 = DateTime.Now.Date.ToString("dd/MM/yyyy").Substring(0, 2);
+ string Dt2 = DateTime.Now.Date.ToString("dd/MM/yyyy").Substring(3, 2);
+ string Dt3 = DateTime.Now.Date.ToString("dd/MM/yyyy").Substring(6, 4);
+
+ strPath = AppDomain.CurrentDomain.BaseDirectory + "\\YouTubeDownloader" + Dt1 + Dt2 + Dt3 + ".log";
+
+ // 06/05/2014 Changes Anil Nair
+ try
+ {
+ file = new System.IO.StreamWriter(strPath, true);
+ file.WriteLine(strMessage);
+ file.Close();
+ }
+ catch (IOException)
+ {
+ file.Flush();
+ }
+ }
- //DownloadAudio(videoInfos);
- DownloadVideo(videoInfos);
+ private static string Clean_Title(string video_title)
+ {
+ return Path.GetInvalidFileNameChars().Aggregate(video_title, (current, c) => current.Replace(c.ToString(), string.Empty));
+ }
+
+ private static int Main(string[] args)
+ {
+ IEnumerable videoInfos;
+ string link = String.Empty;
+ string[] normlink;
+ bool exists;
+ string path = String.Empty;
+
+ if (args.Length < 3)
+ {
+ WriteLog("Please Specify 3 arguments");
+ Console.WriteLine("Please Specify 3 arguments");
+ return (int)LESSARGS_ERR;
+ }
+
+ if (args[0].Length == 0)
+ {
+ WriteLog("Please Specify the Youtube Link");
+ Console.WriteLine("Please Specify the Youtube Link");
+ return (int)YLINK_ERR;
+ }
+
+ if (args[2].Length == 0)
+ {
+ WriteLog("Please Specify the Download Path");
+ Console.WriteLine("Please Specify the Download Path");
+ return (int)DWNPATH_ERR;
+ }
+
+
+ else
+ {
+ try
+ {
+ path = System.IO.Path.GetFullPath(args[2].ToString());
+ DirectoryInfo info = new DirectoryInfo(path);
+ exists = info.Exists;
+ }
+
+ catch (Exception ex)
+ {
+ WriteLog(ex.Message);
+ return (int)FEXP_ERR;
+ }
+ }
+
+ if (!exists)
+ {
+ WriteLog("Please check the path");
+ Console.WriteLine("Please check the path");
+ return (int)FPATH_ERR;
+ }
+
+ try
+ {
+ if ((args[0].ToString().ToLower().Contains("http://www.youtube.com/watch?v=")) || (args[0].ToString().ToLower().Contains("https://www.youtube.com/watch?v=")))
+ {
+
+ normlink = args[0].ToString().Split('&');
+ link = normlink[0].ToString();
+
+ videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
+
+ if (args[1].ToString().ToUpper() == "VIDEO")
+ {
+ Console.WriteLine(path);
+ DownloadVideo(videoInfos, path);
+ Console.WriteLine(args[2].ToString());
+ return 0;
+ }
+
+ if (args[1].ToString().ToUpper() == "AUDIO")
+ {
+ DownloadAudio(videoInfos, path);
+ Console.WriteLine(args[2].ToString());
+ return 0;
+ }
+
+ if ((args[1].Length == 0) || (args[1].ToString().ToUpper() != "AUDIO") || (args[1].ToString().ToUpper() != "VIDEO"))
+ {
+ WriteLog("Please Specify the Format AUDIO/VIDEO");
+ Console.WriteLine("Please Specify the Format AUDIO/VIDEO");
+ return (int)AVURL_ERR;
+ }
+ }
+
+ else
+ {
+ WriteLog("Youtube URL not in correct format");
+ Console.WriteLine("Youtube URL not in correct format");
+ return (int)YLINKFORMAT_ERR;
+ }
}
- private static string RemoveIllegalPathCharacters(string path)
+ catch(Exception ex)
{
- string regexSearch = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
- var r = new Regex(string.Format("[{0}]", Regex.Escape(regexSearch)));
- return r.Replace(path, "");
+ WriteLog(ex.Message);
+ Console.WriteLine("Please check the internet connection");
+ return (int)NETCON_ERR;
}
+
+ Console.WriteLine("Did not pass the validation checks please retify any mistakes in Parameters");
+ return (int)OTHER_ERR;
+
+ }
+
}
}
\ No newline at end of file
diff --git a/YoutubeExtractor/ExampleApplication/Properties/AssemblyInfo_1.cs b/YoutubeExtractor/ExampleApplication/Properties/AssemblyInfo_1.cs
new file mode 100644
index 0000000..40853a3
--- /dev/null
+++ b/YoutubeExtractor/ExampleApplication/Properties/AssemblyInfo_1.cs
@@ -0,0 +1,32 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ExampleApplication")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ExampleApplication")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("0111bc98-bb98-4e04-8607-f5139023e47b")]
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/YoutubeExtractor/ExampleApplication/app.manifest b/YoutubeExtractor/ExampleApplication/app.manifest
new file mode 100644
index 0000000..4fddb8f
--- /dev/null
+++ b/YoutubeExtractor/ExampleApplication/app.manifest
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YoutubeExtractor/YouTubeDownloader/Program.cs b/YoutubeExtractor/YouTubeDownloader/Program.cs
new file mode 100644
index 0000000..a930fc5
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Program.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace YouTubeDownloader
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Frm_DwnYouTube());
+ }
+ }
+}
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/AssemblyInfo.cs b/YoutubeExtractor/YouTubeDownloader/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..4e41473
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("YouTubeDownloader")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("YouTubeDownloader")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("cff00363-d896-4206-9413-12d2e970746e")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/AssemblyInfo_1.cs b/YoutubeExtractor/YouTubeDownloader/Properties/AssemblyInfo_1.cs
new file mode 100644
index 0000000..4e41473
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/AssemblyInfo_1.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("YouTubeDownloader")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("YouTubeDownloader")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("cff00363-d896-4206-9413-12d2e970746e")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/Resources.Designer.cs b/YoutubeExtractor/YouTubeDownloader/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..5f6f824
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace YouTubeDownloader.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("YouTubeDownloader.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/Resources.Designer_1.cs b/YoutubeExtractor/YouTubeDownloader/Properties/Resources.Designer_1.cs
new file mode 100644
index 0000000..84750ed
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/Resources.Designer_1.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.225
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace YouTubeDownloader.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("YouTubeDownloader.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/Resources.resx b/YoutubeExtractor/YouTubeDownloader/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/Resources_1.resx b/YoutubeExtractor/YouTubeDownloader/Properties/Resources_1.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/Resources_1.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/Settings.Designer.cs b/YoutubeExtractor/YouTubeDownloader/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..d401738
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace YouTubeDownloader.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/Settings.Designer_1.cs b/YoutubeExtractor/YouTubeDownloader/Properties/Settings.Designer_1.cs
new file mode 100644
index 0000000..677dad8
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/Settings.Designer_1.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.225
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace YouTubeDownloader.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/Settings.settings b/YoutubeExtractor/YouTubeDownloader/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/Settings_1.settings b/YoutubeExtractor/YouTubeDownloader/Properties/Settings_1.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/Settings_1.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/YoutubeExtractor/YouTubeDownloader/Properties/app.manifest b/YoutubeExtractor/YouTubeDownloader/Properties/app.manifest
new file mode 100644
index 0000000..3b5ed3d
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/Properties/app.manifest
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.Designer.cs b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.Designer.cs
new file mode 100644
index 0000000..aa00227
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.Designer.cs
@@ -0,0 +1,199 @@
+namespace YouTubeDownloader
+{
+ partial class Frm_DwnYouTube
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.cmd_Download = new System.Windows.Forms.Button();
+ this.txt_Url = new System.Windows.Forms.TextBox();
+ this.cb_Resolution = new System.Windows.Forms.ComboBox();
+ this.cmd_DownloadAudio = new System.Windows.Forms.Button();
+ this.txt_location = new System.Windows.Forms.TextBox();
+ this.lbl_locationSave = new System.Windows.Forms.Label();
+ this.Lbl_youtubeUrl = new System.Windows.Forms.Label();
+ this.lbl_Resolution = new System.Windows.Forms.Label();
+ this.cmd_Exit = new System.Windows.Forms.Button();
+ this.pnl_YouTubeDownloader = new System.Windows.Forms.Panel();
+ this.lbl_progress = new System.Windows.Forms.Label();
+ this.prgbar_Download = new System.Windows.Forms.ProgressBar();
+ this.folderBrowserYoutube = new System.Windows.Forms.FolderBrowserDialog();
+ this.pnl_YouTubeDownloader.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // cmd_Download
+ //
+ this.cmd_Download.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.cmd_Download.Location = new System.Drawing.Point(9, 189);
+ this.cmd_Download.Name = "cmd_Download";
+ this.cmd_Download.Size = new System.Drawing.Size(172, 39);
+ this.cmd_Download.TabIndex = 0;
+ this.cmd_Download.Text = "Download Video";
+ this.cmd_Download.UseVisualStyleBackColor = true;
+ this.cmd_Download.Click += new System.EventHandler(this.cmd_Download_Click);
+ //
+ // txt_Url
+ //
+ this.txt_Url.Location = new System.Drawing.Point(149, 60);
+ this.txt_Url.Name = "txt_Url";
+ this.txt_Url.Size = new System.Drawing.Size(315, 20);
+ this.txt_Url.TabIndex = 1;
+ this.txt_Url.TextChanged += new System.EventHandler(this.txt_Url_TextChanged);
+ //
+ // cb_Resolution
+ //
+ this.cb_Resolution.FormattingEnabled = true;
+ this.cb_Resolution.Location = new System.Drawing.Point(149, 103);
+ this.cb_Resolution.Name = "cb_Resolution";
+ this.cb_Resolution.Size = new System.Drawing.Size(315, 21);
+ this.cb_Resolution.TabIndex = 2;
+ //
+ // cmd_DownloadAudio
+ //
+ this.cmd_DownloadAudio.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.cmd_DownloadAudio.Location = new System.Drawing.Point(295, 189);
+ this.cmd_DownloadAudio.Name = "cmd_DownloadAudio";
+ this.cmd_DownloadAudio.Size = new System.Drawing.Size(172, 42);
+ this.cmd_DownloadAudio.TabIndex = 3;
+ this.cmd_DownloadAudio.Text = "Download Audio";
+ this.cmd_DownloadAudio.UseVisualStyleBackColor = true;
+ this.cmd_DownloadAudio.Click += new System.EventHandler(this.cmd_DownloadAudio_Click);
+ //
+ // txt_location
+ //
+ this.txt_location.Location = new System.Drawing.Point(149, 12);
+ this.txt_location.Name = "txt_location";
+ this.txt_location.Size = new System.Drawing.Size(315, 20);
+ this.txt_location.TabIndex = 4;
+ //
+ // lbl_locationSave
+ //
+ this.lbl_locationSave.AutoSize = true;
+ this.lbl_locationSave.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lbl_locationSave.Location = new System.Drawing.Point(3, 12);
+ this.lbl_locationSave.Name = "lbl_locationSave";
+ this.lbl_locationSave.Size = new System.Drawing.Size(135, 18);
+ this.lbl_locationSave.TabIndex = 5;
+ this.lbl_locationSave.Text = "Location To Save";
+ //
+ // Lbl_youtubeUrl
+ //
+ this.Lbl_youtubeUrl.AutoSize = true;
+ this.Lbl_youtubeUrl.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.Lbl_youtubeUrl.Location = new System.Drawing.Point(6, 60);
+ this.Lbl_youtubeUrl.Name = "Lbl_youtubeUrl";
+ this.Lbl_youtubeUrl.Size = new System.Drawing.Size(100, 18);
+ this.Lbl_youtubeUrl.TabIndex = 6;
+ this.Lbl_youtubeUrl.Text = "YouTube Url";
+ //
+ // lbl_Resolution
+ //
+ this.lbl_Resolution.AutoSize = true;
+ this.lbl_Resolution.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lbl_Resolution.Location = new System.Drawing.Point(6, 103);
+ this.lbl_Resolution.Name = "lbl_Resolution";
+ this.lbl_Resolution.Size = new System.Drawing.Size(88, 18);
+ this.lbl_Resolution.TabIndex = 7;
+ this.lbl_Resolution.Text = "Resolution";
+ //
+ // cmd_Exit
+ //
+ this.cmd_Exit.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.cmd_Exit.Location = new System.Drawing.Point(152, 248);
+ this.cmd_Exit.Name = "cmd_Exit";
+ this.cmd_Exit.Size = new System.Drawing.Size(172, 42);
+ this.cmd_Exit.TabIndex = 8;
+ this.cmd_Exit.Text = "Exit";
+ this.cmd_Exit.UseVisualStyleBackColor = true;
+ this.cmd_Exit.Click += new System.EventHandler(this.cmd_Exit_Click);
+ //
+ // pnl_YouTubeDownloader
+ //
+ this.pnl_YouTubeDownloader.Controls.Add(this.lbl_progress);
+ this.pnl_YouTubeDownloader.Controls.Add(this.prgbar_Download);
+ this.pnl_YouTubeDownloader.Controls.Add(this.cmd_Exit);
+ this.pnl_YouTubeDownloader.Controls.Add(this.lbl_Resolution);
+ this.pnl_YouTubeDownloader.Controls.Add(this.Lbl_youtubeUrl);
+ this.pnl_YouTubeDownloader.Controls.Add(this.lbl_locationSave);
+ this.pnl_YouTubeDownloader.Controls.Add(this.txt_location);
+ this.pnl_YouTubeDownloader.Controls.Add(this.cmd_DownloadAudio);
+ this.pnl_YouTubeDownloader.Controls.Add(this.cb_Resolution);
+ this.pnl_YouTubeDownloader.Controls.Add(this.txt_Url);
+ this.pnl_YouTubeDownloader.Controls.Add(this.cmd_Download);
+ this.pnl_YouTubeDownloader.Location = new System.Drawing.Point(12, 16);
+ this.pnl_YouTubeDownloader.Name = "pnl_YouTubeDownloader";
+ this.pnl_YouTubeDownloader.Size = new System.Drawing.Size(478, 305);
+ this.pnl_YouTubeDownloader.TabIndex = 9;
+ //
+ // lbl_progress
+ //
+ this.lbl_progress.AutoSize = true;
+ this.lbl_progress.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Bold);
+ this.lbl_progress.Location = new System.Drawing.Point(9, 149);
+ this.lbl_progress.Name = "lbl_progress";
+ this.lbl_progress.Size = new System.Drawing.Size(75, 18);
+ this.lbl_progress.TabIndex = 10;
+ this.lbl_progress.Text = "Progress";
+ //
+ // prgbar_Download
+ //
+ this.prgbar_Download.Location = new System.Drawing.Point(149, 140);
+ this.prgbar_Download.Name = "prgbar_Download";
+ this.prgbar_Download.Size = new System.Drawing.Size(315, 23);
+ this.prgbar_Download.TabIndex = 9;
+ //
+ // Frm_DwnYouTube
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(498, 331);
+ this.Controls.Add(this.pnl_YouTubeDownloader);
+ this.Name = "Frm_DwnYouTube";
+ this.Text = "YouTubeDownloader";
+ this.pnl_YouTubeDownloader.ResumeLayout(false);
+ this.pnl_YouTubeDownloader.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button cmd_Download;
+ private System.Windows.Forms.TextBox txt_Url;
+ private System.Windows.Forms.ComboBox cb_Resolution;
+ private System.Windows.Forms.Button cmd_DownloadAudio;
+ private System.Windows.Forms.TextBox txt_location;
+ private System.Windows.Forms.Label lbl_locationSave;
+ private System.Windows.Forms.Label Lbl_youtubeUrl;
+ private System.Windows.Forms.Label lbl_Resolution;
+ private System.Windows.Forms.Button cmd_Exit;
+ private System.Windows.Forms.Panel pnl_YouTubeDownloader;
+ private System.Windows.Forms.FolderBrowserDialog folderBrowserYoutube;
+ private System.Windows.Forms.Label lbl_progress;
+ private System.Windows.Forms.ProgressBar prgbar_Download;
+ }
+}
+
diff --git a/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.cs b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.cs
new file mode 100644
index 0000000..ea7b7f3
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.cs
@@ -0,0 +1,390 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
+using System.IO.Pipes;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using YoutubeExtractor;
+
+namespace YouTubeDownloader
+{
+ public partial class Frm_DwnYouTube : Form
+ {
+ // To Report Download Progress to GUI
+ static BackgroundWorker background_download;
+ /*ARGUMENTS RELATED ERRORS 1-5*/
+ const uint LESSARGS_ERR = 1;
+ const uint YLINK_ERR = 2;
+ const uint DWNPATH_ERR = 3;
+ const uint AVURL_ERR = 4;
+
+ /*FILE RELATED ERRORS 5-10*/
+ const uint FEXP_ERR = 5;
+ const uint FPATH_ERR = 6;
+
+ /*YOUTUBE LINK RELATED ERRORS 10-15*/
+ const uint YLINKFORMAT_ERR = 10;
+ const uint NETCON_ERR = 11;
+
+ /*OTHER ERRORS*/
+ const uint OTHER_ERR = 99;
+
+ #region Initialize
+
+ public Frm_DwnYouTube()
+ {
+ InitializeComponent();
+ background_download = new BackgroundWorker();
+ background_download.DoWork += Background_download_DoWork;
+ background_download.ProgressChanged += Background_download_ProgressChanged;
+ background_download.RunWorkerCompleted += Background_download_RunWorkerCompleted;
+ background_download.WorkerReportsProgress = true;
+ init();
+ }
+
+ #endregion
+
+ private void Background_download_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+ {
+ processExitCode((int)e.Result);
+ cmd_Download.Enabled = true;
+ cmd_DownloadAudio.Enabled = true;
+ }
+
+ private void Background_download_ProgressChanged(object sender, ProgressChangedEventArgs e)
+ {
+ prgbar_Download.Value = e.ProgressPercentage;
+ }
+
+ private void Background_download_DoWork(object sender, DoWorkEventArgs e)
+ {
+ string[] args = (string[])e.Argument;
+
+ try
+ {
+ if (args[0].Equals("VIDEO"))
+ {
+ e.Result = StartDownloader("VIDEO", args[1], args[2]);
+ }
+ else
+ {
+ e.Result = StartDownloader("AUDIO", args[1], args[2]);
+ }
+ }
+ catch
+ {
+
+ }
+ }
+
+ private static void VideoDownloader_DownloadProgressChanged(object sender, ProgressEventArgs e)
+ {
+ background_download.ReportProgress((int)e.ProgressPercentage);
+ }
+
+ private static void AudioDownloader_DownloadProgressChanged(object sender, ProgressEventArgs e)
+ {
+ background_download.ReportProgress((int)(e.ProgressPercentage * 0.85));
+ }
+
+ #region Button Events
+
+ private void cmd_Download_Click(object sender, EventArgs e)
+ {
+ string apppath = AppDomain.CurrentDomain.BaseDirectory;
+ string dwnload_path = String.Empty;
+
+
+ if (txt_Url.Text.ToString().Length == 0)
+ {
+ MessageBox.Show("Please input the Youtube Url");
+ return;
+ }
+
+ DialogResult result = this.folderBrowserYoutube.ShowDialog();
+
+ if (result == DialogResult.OK)
+ {
+ txt_location.Text = this.folderBrowserYoutube.SelectedPath.ToString();
+ }
+
+ dwnload_path = txt_location.Text.ToString();
+
+ cmd_Download.Enabled = false;
+ cmd_DownloadAudio.Enabled = false;
+
+ background_download.RunWorkerAsync(new string[] { "VIDEO", apppath, dwnload_path });
+
+ }
+
+ private void cmd_DownloadAudio_Click(object sender, EventArgs e)
+ {
+ string apppath = AppDomain.CurrentDomain.BaseDirectory;
+ string dwnload_path = String.Empty;
+
+ if (txt_Url.Text.ToString().Length == 0)
+ {
+ MessageBox.Show("Please input the Youtube Url");
+ return;
+ }
+
+ DialogResult result = this.folderBrowserYoutube.ShowDialog();
+
+ if (result == DialogResult.OK)
+ {
+ txt_location.Text = this.folderBrowserYoutube.SelectedPath.ToString();
+ }
+
+ dwnload_path = txt_location.Text.ToString();
+
+ background_download.RunWorkerAsync(new string[] { "AUDIO", apppath, dwnload_path });
+
+ }
+
+ private void cmd_Exit_Click(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ #endregion
+
+ #region Functions
+
+ private static void DownloadAudio(IEnumerable videoInfos, string dwnpath)
+ {
+ /*
+ * We want the first extractable video with the highest audio quality.
+ */
+ VideoInfo video = videoInfos
+ .Where(info => info.CanExtractAudio)
+ .OrderByDescending(info => info.AudioBitrate)
+ .First();
+
+ /*
+ * Create the audio downloader.
+ * The first argument is the video where the audio should be extracted from.
+ * The second argument is the path to save the audio file.
+ */
+
+ var audioDownloader = new AudioDownloader(video,
+ Path.Combine(dwnpath, Clean_Title(video.Title) + video.AudioExtension));
+
+ // Register the progress events. We treat the download progress as 85% of the progress
+ // and the extraction progress only as 15% of the progress, because the download will
+ // take much longer than the audio extraction.
+ audioDownloader.DownloadProgressChanged += AudioDownloader_DownloadProgressChanged;
+
+ //audioDownloader.AudioExtractionProgressChanged += (sender, args) => Console.WriteLine(85 + args.ProgressPercentage * 0.15);
+
+ /*
+ * Execute the audio downloader.
+ * For GUI applications note, that this method runs synchronously.
+ */
+ audioDownloader.Execute();
+ }
+
+ private static void DownloadVideo(IEnumerable videoInfos, string dwnpath)
+ {
+ /*
+ * Select the first .mp4 video with 360p resolution
+ */
+ VideoInfo video = videoInfos
+ .First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
+
+ /*
+ * Create the video downloader.
+ * The first argument is the video to download.
+ * The second argument is the path to save the video file.
+ */
+
+ var videoDownloader = new VideoDownloader(video,
+ Path.Combine(dwnpath, Clean_Title(video.Title) + video.VideoExtension));
+
+ // Register the ProgressChanged event and print the current progress
+ //videoDownloader.DownloadProgressChanged += (sender, args) => Console.WriteLine((args.ProgressPercentage));
+ videoDownloader.DownloadProgressChanged += VideoDownloader_DownloadProgressChanged;
+
+ /*
+ * Execute the video downloader.
+ * For GUI applications note, that this method runs synchronously.
+ */
+ videoDownloader.Execute();
+ }
+
+ ///
+ /// Used to maintain the log of the Current service.
+ /// Inputs: strmessage as a string.
+ /// Outputs: A log file containing the status of the Service.
+ /// Notes:
+ ///
+ public static void WriteLog(string strMessage)
+ {
+ string Dt4 = DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy").Substring(0, 2);
+ string Dt5 = DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy").Substring(3, 2);
+ string Dt6 = DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy").Substring(6, 4);
+
+ string yestPath = AppDomain.CurrentDomain.BaseDirectory + "\\YouTubeDownloader" + Dt4 + Dt5 + Dt6 + ".log";
+
+ if (File.Exists(yestPath))
+ {
+ File.Delete(yestPath);
+ }
+
+ string strPath = null;
+ System.IO.StreamWriter file = null;
+ string Dt1 = DateTime.Now.Date.ToString("dd/MM/yyyy").Substring(0, 2);
+ string Dt2 = DateTime.Now.Date.ToString("dd/MM/yyyy").Substring(3, 2);
+ string Dt3 = DateTime.Now.Date.ToString("dd/MM/yyyy").Substring(6, 4);
+
+ strPath = AppDomain.CurrentDomain.BaseDirectory + "\\YouTubeDownloader" + Dt1 + Dt2 + Dt3 + ".log";
+
+ // 06/05/2014 Changes Anil Nair
+ try
+ {
+ file = new System.IO.StreamWriter(strPath, true);
+ file.WriteLine(strMessage);
+ file.Close();
+ }
+ catch (IOException)
+ {
+ file.Flush();
+ }
+ }
+
+ private static string Clean_Title(string video_title)
+ {
+ return Path.GetInvalidFileNameChars().Aggregate(video_title, (current, c) => current.Replace(c.ToString(), string.Empty));
+ }
+
+ private int StartDownloader(string AV, string path, string dwnloaddir)
+ {
+ IEnumerable videoInfos;
+ string link = String.Empty;
+ string[] normlink;
+ bool exists = false;
+
+ try
+ {
+ path = System.IO.Path.GetFullPath(dwnloaddir.ToString());
+ DirectoryInfo info = new DirectoryInfo(path);
+ exists = info.Exists;
+ }
+
+ catch (Exception ex)
+ {
+ WriteLog(ex.Message);
+ return (int)OTHER_ERR;
+ }
+
+ if (!exists)
+ {
+ WriteLog("Please check the path");
+ return (int) DWNPATH_ERR;
+ }
+
+ try
+ {
+ if ((txt_Url.Text.ToString().ToLower().Contains("http://www.youtube.com/watch?v=")) || (txt_Url.Text.ToString().ToLower().Contains("https://www.youtube.com/watch?v=")))
+ {
+
+ normlink = txt_Url.Text.ToString().Split('&');
+ link = normlink[0].ToString();
+
+ videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
+
+ if (AV.ToString().ToUpper() == "VIDEO")
+ {
+ DownloadVideo(videoInfos, path);
+ return 0;
+ }
+
+ if (AV.ToString().ToUpper() == "AUDIO")
+ {
+ DownloadAudio(videoInfos, path);
+ return 0;
+ }
+
+ if ((AV.Length == 0) || (AV.ToString().ToUpper() != "AUDIO") || (AV.ToString().ToUpper() != "VIDEO"))
+ {
+ WriteLog("Please Specify the Format AUDIO/VIDEO");
+ return (int)AVURL_ERR;
+ }
+ }
+
+ else
+ {
+ WriteLog("Youtube URL not in correct format");
+ return (int)YLINKFORMAT_ERR;
+ }
+ }
+
+ catch (Exception ex)
+ {
+ WriteLog(ex.Message);
+ return (int)OTHER_ERR;
+ }
+
+ return (int)OTHER_ERR;
+
+ }
+
+ private void processExitCode(int retval)
+ {
+ if (retval == 0)
+ {
+ MessageBox.Show("Download Successful");
+ }
+
+ if ((retval < 5) && (retval != 0))
+ {
+ MessageBox.Show("Please check the arguments file path or youtube url maybe incorrect");
+ }
+
+ if ((retval > 5) && (retval <= 10))
+ {
+ MessageBox.Show("Please check the file path");
+ }
+
+ if ((retval > 5) && (retval > 10) && (retval <= 15))
+ {
+ MessageBox.Show("Please check the youtube Url or Internet connection");
+ }
+
+ if ((retval > 5) && (retval > 10) && (retval > 15) && (retval == 99))
+ {
+ MessageBox.Show("Please check the parameters");
+ }
+ }
+
+ private void init()
+ {
+ lbl_Resolution.Enabled = false;
+ cb_Resolution.Enabled = false;
+ this.folderBrowserYoutube.ShowNewFolderButton = false;
+ this.folderBrowserYoutube.RootFolder = System.Environment.SpecialFolder.MyComputer;
+ }
+
+
+ #endregion
+
+ private void txt_Url_TextChanged(object sender, EventArgs e)
+ {
+ if (txt_Url.Text.Length > 5)
+ {
+ lbl_Resolution.Enabled = true;
+ cb_Resolution.Enabled = true;
+ IEnumerable videoInfos = DownloadUrlResolver.GetDownloadUrls(txt_Url.Text);
+ foreach (VideoInfo videoInfo in videoInfos)
+ {
+
+ }
+ }
+ }
+
+ }
+}
diff --git a/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.csproj b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.csproj
new file mode 100644
index 0000000..255e65a
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.csproj
@@ -0,0 +1,152 @@
+
+
+
+ Debug
+ x86
+ 8.0.30703
+ 2.0
+ {EC7C4410-101D-48D2-AED8-2D427E477976}
+ WinExe
+ Properties
+ YouTubeDownloader
+ YouTubeDownloader
+ v3.5
+
+
+ 512
+ false
+ C:\Users\Anil\Documents\Visual Studio 2017\YoutubeDownloader\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 2
+ 1.0.0.%2a
+ false
+ true
+ true
+
+
+ x86
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ x86
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ true
+ ..\..\..\..\FinalOP\
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+ ManagedMinimumRules.ruleset
+
+
+ YouTubeDownloader.Program
+
+
+ true
+
+
+ D1993851A1717F8BD902B08079A5C7785DE6D8DD
+
+
+ YouTubeDownloader_TemporaryKey.pfx
+
+
+ true
+
+
+ LocalIntranet
+
+
+ Properties\app.manifest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ YouTubeDownloader.cs
+
+
+
+
+ YouTubeDownloader.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+
+
+ {ecdc127f-8def-4f99-8300-72c13597339d}
+ YoutubeExtractor
+
+
+
+
+
\ No newline at end of file
diff --git a/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.resx b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.resx
new file mode 100644
index 0000000..70b5629
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader_TemporaryKey.pfx b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader_TemporaryKey.pfx
new file mode 100644
index 0000000..3068763
Binary files /dev/null and b/YoutubeExtractor/YouTubeDownloader/YouTubeDownloader_TemporaryKey.pfx differ
diff --git a/YoutubeExtractor/YouTubeDownloader/app.config b/YoutubeExtractor/YouTubeDownloader/app.config
new file mode 100644
index 0000000..e59af44
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/YoutubeExtractor/YouTubeDownloader/app.manifest b/YoutubeExtractor/YouTubeDownloader/app.manifest
new file mode 100644
index 0000000..94ae7e0
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/app.manifest
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YoutubeExtractor/YouTubeDownloader/packages.config b/YoutubeExtractor/YouTubeDownloader/packages.config
new file mode 100644
index 0000000..a46798b
--- /dev/null
+++ b/YoutubeExtractor/YouTubeDownloader/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/YoutubeExtractor/YouTubeDownloader/speed-download.ico b/YoutubeExtractor/YouTubeDownloader/speed-download.ico
new file mode 100644
index 0000000..484323e
Binary files /dev/null and b/YoutubeExtractor/YouTubeDownloader/speed-download.ico differ
diff --git a/YoutubeExtractor/YouTubeDownloader/yDownload.jpg b/YoutubeExtractor/YouTubeDownloader/yDownload.jpg
new file mode 100644
index 0000000..69c7f8b
Binary files /dev/null and b/YoutubeExtractor/YouTubeDownloader/yDownload.jpg differ
diff --git a/YoutubeExtractor/YoutubeExtractor.Tests/app.manifest b/YoutubeExtractor/YoutubeExtractor.Tests/app.manifest
new file mode 100644
index 0000000..4fddb8f
--- /dev/null
+++ b/YoutubeExtractor/YoutubeExtractor.Tests/app.manifest
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YoutubeExtractor/YoutubeExtractor.sln b/YoutubeExtractor/YoutubeExtractor.sln
index 6e2ad3d..737ef1e 100644
--- a/YoutubeExtractor/YoutubeExtractor.sln
+++ b/YoutubeExtractor/YoutubeExtractor.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YoutubeExtractor", "YoutubeExtractor\YoutubeExtractor.csproj", "{ECDC127F-8DEF-4F99-8300-72C13597339D}"
EndProject
@@ -16,37 +16,95 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleApplication.Portable
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YoutubeExtractor.Tests", "YoutubeExtractor.Tests\YoutubeExtractor.Tests.csproj", "{CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YouTubeDownloader", "YouTubeDownloader\YouTubeDownloader.csproj", "{EC7C4410-101D-48D2-AED8-2D427E477976}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x86 = Debug|x86
+ Final Output|Any CPU = Final Output|Any CPU
+ Final Output|x86 = Final Output|x86
Release|Any CPU = Release|Any CPU
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ECDC127F-8DEF-4F99-8300-72C13597339D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECDC127F-8DEF-4F99-8300-72C13597339D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ECDC127F-8DEF-4F99-8300-72C13597339D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {ECDC127F-8DEF-4F99-8300-72C13597339D}.Debug|x86.Build.0 = Debug|Any CPU
+ {ECDC127F-8DEF-4F99-8300-72C13597339D}.Final Output|Any CPU.ActiveCfg = Release|Any CPU
+ {ECDC127F-8DEF-4F99-8300-72C13597339D}.Final Output|Any CPU.Build.0 = Release|Any CPU
+ {ECDC127F-8DEF-4F99-8300-72C13597339D}.Final Output|x86.ActiveCfg = Release|Any CPU
+ {ECDC127F-8DEF-4F99-8300-72C13597339D}.Final Output|x86.Build.0 = Release|Any CPU
{ECDC127F-8DEF-4F99-8300-72C13597339D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECDC127F-8DEF-4F99-8300-72C13597339D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ECDC127F-8DEF-4F99-8300-72C13597339D}.Release|x86.ActiveCfg = Release|Any CPU
+ {ECDC127F-8DEF-4F99-8300-72C13597339D}.Release|x86.Build.0 = Release|Any CPU
{B894B26A-A518-4366-B31C-D90489A0F138}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B894B26A-A518-4366-B31C-D90489A0F138}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B894B26A-A518-4366-B31C-D90489A0F138}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B894B26A-A518-4366-B31C-D90489A0F138}.Debug|x86.Build.0 = Debug|Any CPU
+ {B894B26A-A518-4366-B31C-D90489A0F138}.Final Output|Any CPU.ActiveCfg = Release|Any CPU
+ {B894B26A-A518-4366-B31C-D90489A0F138}.Final Output|Any CPU.Build.0 = Release|Any CPU
+ {B894B26A-A518-4366-B31C-D90489A0F138}.Final Output|x86.ActiveCfg = Release|Any CPU
+ {B894B26A-A518-4366-B31C-D90489A0F138}.Final Output|x86.Build.0 = Release|Any CPU
{B894B26A-A518-4366-B31C-D90489A0F138}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B894B26A-A518-4366-B31C-D90489A0F138}.Release|Any CPU.Build.0 = Release|Any CPU
{B894B26A-A518-4366-B31C-D90489A0F138}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {B894B26A-A518-4366-B31C-D90489A0F138}.Release|x86.ActiveCfg = Release|Any CPU
+ {B894B26A-A518-4366-B31C-D90489A0F138}.Release|x86.Build.0 = Release|Any CPU
{1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Debug|x86.Build.0 = Debug|Any CPU
+ {1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Final Output|Any CPU.ActiveCfg = Release|Any CPU
+ {1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Final Output|Any CPU.Build.0 = Release|Any CPU
+ {1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Final Output|x86.ActiveCfg = Release|Any CPU
+ {1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Final Output|x86.Build.0 = Release|Any CPU
{1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Release|x86.ActiveCfg = Release|Any CPU
+ {1BB4CF4D-3617-4A23-B51A-DA7711E6F8EB}.Release|x86.Build.0 = Release|Any CPU
{D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Debug|x86.Build.0 = Debug|Any CPU
+ {D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Final Output|Any CPU.ActiveCfg = Release|Any CPU
+ {D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Final Output|Any CPU.Build.0 = Release|Any CPU
+ {D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Final Output|x86.ActiveCfg = Release|Any CPU
+ {D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Final Output|x86.Build.0 = Release|Any CPU
{D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Release|x86.ActiveCfg = Release|Any CPU
+ {D71C979F-7F55-4AD3-854C-7F1FFF35B4F0}.Release|x86.Build.0 = Release|Any CPU
{CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Debug|x86.Build.0 = Debug|Any CPU
+ {CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Final Output|Any CPU.ActiveCfg = Release|Any CPU
+ {CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Final Output|Any CPU.Build.0 = Release|Any CPU
+ {CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Final Output|x86.ActiveCfg = Release|Any CPU
+ {CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Final Output|x86.Build.0 = Release|Any CPU
{CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Release|x86.ActiveCfg = Release|Any CPU
+ {CE76B74C-BD0C-4768-8F8B-78E0FBD46FBC}.Release|x86.Build.0 = Release|Any CPU
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Debug|x86.ActiveCfg = Debug|x86
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Debug|x86.Build.0 = Debug|x86
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Final Output|Any CPU.ActiveCfg = Final Output|x86
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Final Output|x86.ActiveCfg = Final Output|x86
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Final Output|x86.Build.0 = Final Output|x86
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Release|Any CPU.ActiveCfg = Release|x86
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Release|x86.ActiveCfg = Release|x86
+ {EC7C4410-101D-48D2-AED8-2D427E477976}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A8A1652E-E76D-48D4-A92A-657012F8D013}
+ EndGlobalSection
GlobalSection(CodealikeProperties) = postSolution
SolutionGuid = 09b3acc1-9c76-4060-a18f-5b5f253925cc
EndGlobalSection
diff --git a/YoutubeExtractor/YoutubeExtractor/Decipherer.cs b/YoutubeExtractor/YoutubeExtractor/Decipherer.cs
index e5ac261..89f9dca 100644
--- a/YoutubeExtractor/YoutubeExtractor/Decipherer.cs
+++ b/YoutubeExtractor/YoutubeExtractor/Decipherer.cs
@@ -9,7 +9,8 @@ internal static class Decipherer
{
public static string DecipherWithVersion(string cipher, string cipherVersion)
{
- string jsUrl = string.Format("http://s.ytimg.com/yts/jsbin/player-{0}.js", cipherVersion);
+ string jsUrl = string.Format("http://s.ytimg.com/yts/jsbin/player_{0}.js", cipherVersion);
+
string js = HttpHelper.DownloadString(jsUrl);
//Find "C" in this: var A = B.sig||C (B.s)
diff --git a/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs b/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs
index 6896edf..8b43319 100644
--- a/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs
+++ b/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs
@@ -182,10 +182,10 @@ private static IEnumerable ExtractDownloadUrls(JObject json)
bool requiresDecryption = false;
- if (queries.ContainsKey("s") || queries.ContainsKey("sig"))
+ if (queries.ContainsKey("s") || queries.ContainsKey("signature"))
{
requiresDecryption = queries.ContainsKey("s");
- string signature = queries.ContainsKey("s") ? queries["s"] : queries["sig"];
+ string signature = queries.ContainsKey("s") ? queries["s"] : queries["signature"];
url = string.Format("{0}&{1}={2}", queries["url"], SignatureQuery, signature);
@@ -230,7 +230,7 @@ private static string GetDecipheredSignature(string htmlPlayerVersion, string si
private static string GetHtml5PlayerVersion(JObject json)
{
- var regex = new Regex(@"player-(.+?).js");
+ var regex = new Regex(@"player_(.+?).js");
string js = json["assets"]["js"].ToString();
diff --git a/YoutubeExtractor/YoutubeExtractor/YoutubeExtractor.csproj b/YoutubeExtractor/YoutubeExtractor/YoutubeExtractor.csproj
index 9cb7519..958d092 100644
--- a/YoutubeExtractor/YoutubeExtractor/YoutubeExtractor.csproj
+++ b/YoutubeExtractor/YoutubeExtractor/YoutubeExtractor.csproj
@@ -17,7 +17,7 @@
true
full
false
- bin\Debug\Full
+ ..\YouTubeDownloader\bin\Debug\
obj\Debug\Full
DEBUG;TRACE
prompt
@@ -26,12 +26,12 @@
pdbonly
true
- bin\Release\Full
+ ..\YouTubeDownloader\bin\Release\
obj\Release\Full
TRACE
prompt
4
- bin\Release\Full\YoutubeExtractor.xml
+ C:\Users\Anil\Documents\github_projects\YoutubeExtractor\YoutubeExtractor\YouTubeDownloader\bin\Release\YoutubeExtractor.xml
true
diff --git a/YoutubeExtractor/YoutubeExtractor/app.manifest b/YoutubeExtractor/YoutubeExtractor/app.manifest
new file mode 100644
index 0000000..4fddb8f
--- /dev/null
+++ b/YoutubeExtractor/YoutubeExtractor/app.manifest
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YoutubeExtractor/YoutubeExtractor/speed-download.ico b/YoutubeExtractor/YoutubeExtractor/speed-download.ico
new file mode 100644
index 0000000..484323e
Binary files /dev/null and b/YoutubeExtractor/YoutubeExtractor/speed-download.ico differ
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..14fba53
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,27 @@
+version: 1.0.{build}
+configuration:
+- Debug
+- Release
+platform:
+- Any CPU
+
+build:
+ project: YoutubeExtractor\YoutubeExtractor.sln
+ parallel: true
+ verbosity: minimal
+
+environment:
+ matrix:
+ - YoutubeExtractor: YoutubeExtractor.sln
+
+before_build:
+ - cmd: cd YoutubeExtractor
+ - cmd: nuget restore
+
+artifacts:
+ - path: YoutubeExtractor\YouTubeDownloader\bin\$(configuration)
+ name: YouTubeDownloader
+
+build_script:
+- cmd: >-
+ msbuild %YoutubeExtractor% /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
diff --git a/readme.md b/readme.md
index b43bf24..075d947 100644
--- a/readme.md
+++ b/readme.md
@@ -8,6 +8,15 @@
+
+
+
+
+
+
+
+
+
## Overview
YoutubeExtractor is a library for .NET, written in C#, that allows to download videos from YouTube and/or extract their audio track (audio extraction currently only for flash videos).
@@ -41,6 +50,20 @@ Files that are GPLv2 licensed are explicitly marked with the GPLv2 header at the
- [FlvExtract](http://moitah.net/) for extracting MP3 and AAC audio tracks out of flash files.
+## Example GUI Application
+
+Built a sample GUI application to Download videos from Youtube at default 360 settings.
+Features added:
+1.Progress bar to denote the status of video being downloaded.
+
+## Build from Appveyor
+
+Added support for running tests and builds from Appveyor.
+
+## Analysis by BetterCode
+
+Added Support for analysis by BetterCode Organization (https://bettercodehub.com)
+
## Example code
**Get the download URLs**