Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Moder112 authored Jan 11, 2019
1 parent d87ebf7 commit eb5863c
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 38 deletions.
125 changes: 96 additions & 29 deletions AnnotationsMassDownloader/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using YoutubeExplode;

Expand All @@ -23,24 +24,44 @@ static void Main(string[] args)
if (args[1].Contains("watch?v="))
{
string videoid = args[1].Substring(args[1].IndexOf("=")+1).Replace("/", "");
if (videoid.Contains("&"))videoid= videoid.Substring(0, videoid.IndexOf("&"));
Console.WriteLine("Downloading: " + videoid);
runrunshit(videoid, args[0]);

try
{
runrunshit(videoid, args[0]);
}catch(Exception e)
{
Console.WriteLine("Video init failed\n" + e);
}
}
else if (args[1].Contains("https://www.youtube.com/user/"))
{
string youtube = "https://www.youtube.com/user/";
string cid = args[1].Substring(args[1].IndexOf(youtube) + youtube.Length).Replace("/", "");
getid(cid, args[0]);
try
{
getid(cid, args[0]);
}
catch (Exception e)
{
Console.WriteLine("User init failed\n" + e);
}
// getchannelshit(cid, args[0]);
}
else if (args[1].Contains("https://www.youtube.com/channel/"))
{
string youtube = "https://www.youtube.com/channel/";
string cid = args[1].Substring(args[1].IndexOf(youtube) + youtube.Length).Replace("/", "");

getchannelshit(cid, args[0]);
try
{
getchannelshit(cid, args[0]);
}
catch (Exception e)
{
Console.WriteLine("User init failed\n" + e);
}
}

else
{
if (File.Exists(args[1]))
Expand All @@ -62,22 +83,44 @@ static async void filoop(string[] args)
if (ex.Contains("watch?v="))
{
string videoid = ex.Substring(ex.IndexOf("=") + 1).Replace("/", "");
if (videoid.Contains("&"))videoid= videoid.Substring(0, videoid.IndexOf("&"));
Console.WriteLine("Downloading: " + videoid);
await runrunshit(videoid, args[0]);
try
{
await runrunshit(videoid, args[0]);
}
catch (Exception e)
{
Console.WriteLine("User init failed\n" + e);
}

}
else if (ex.Contains("https://www.youtube.com/user/"))
{
string youtube = "https://www.youtube.com/user/";
string cid = ex.Substring(ex.IndexOf(youtube) + youtube.Length).Replace("/", "");
await getid(cid, args[0]);
try
{
await getid(cid, args[0]);
}
catch (Exception e)
{
Console.WriteLine("User init failed\n" + e);
}
// getchannelshit(cid, args[0]);
}
else if (ex.Contains("https://www.youtube.com/channel/"))
{
string youtube = "https://www.youtube.com/channel/";
string cid = ex.Substring(ex.IndexOf(youtube) + youtube.Length).Replace("/", "");

await getchannelshit(cid, args[0]);
try
{
await getchannelshit(cid, args[0]);
}
catch (Exception e)
{
Console.WriteLine("User init failed\n" + e);
}
}
}
}
Expand Down Expand Up @@ -115,37 +158,61 @@ static async Task
var client = new YoutubeClient();
var video = await client.GetVideoAsync(videoid);
var WClient = new WebClient();
try
int retry = 5;
while (retry > 0)
{
WClient.DownloadFile("http://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=" + videoid, videoid);
while (WClient.IsBusy) ;
if (vetforformatting(videoid))
try
{
string titletest = title(path, videoid, video.Title, video.Author);
if (!File.Exists(titletest)) {
File.Copy(videoid,titletest);
Console.WriteLine("Downloaded annotations for video: " + video.Title);
if (File.Exists(videoid)) File.Delete(videoid);
WClient.DownloadFile("http://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=" + videoid, videoid);
while (WClient.IsBusy) Thread.Sleep(100);

if (vetforformatting(videoid))
{
string titletest = title(path, videoid, video.Title, video.Author);
if (!File.Exists(titletest))
{
File.Copy(videoid, titletest);
Console.WriteLine("Downloaded annotations for video: " + video.Title);
if (File.Exists(videoid)) File.Delete(videoid);
break;
}
else
{
Console.WriteLine("Annotations file exists already: " + video.Title);
if (File.Exists(videoid)) File.Delete(videoid);
break;
}
}
else
{
Console.WriteLine("Annotations file exists already: " + video.Title);
Console.WriteLine("Video doesn't contain old youtube annotations: " + video.Title);
if (File.Exists(videoid)) File.Delete(videoid);
break;
}
}
else
catch (Exception e)
{
Console.WriteLine("Video doesn't contain old youtube annotations: " + video.Title);
if (File.Exists(videoid)) File.Delete(videoid);
retry--;

if (retry==0)

Console.WriteLine(e);
else
{
Console.WriteLine("Downloading failed, retrying " + video.Title);
}
try
{
if (File.Exists(videoid)) File.Delete(videoid);
}
catch
{

}
Console.ReadLine();
}
}
catch (Exception e)
{
Console.WriteLine("Downloading annotations for video failed: " + video.Title);
Console.WriteLine(e);
if (File.Exists(videoid)) File.Delete(videoid);
Console.ReadLine();
}

}
static bool vetforformatting(string path)
{
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
13 changes: 12 additions & 1 deletion AnnotationsMassDownloader/bin/channellist.txt
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
https://www.youtube.com/channel/UCBR8-60-B28hp2BmDPdntcQ
https://www.youtube.com/watch?v=wsAXCI0R7VE&t=2s
https://www.youtube.com/channel/UCBR8-60-B28hp2BmDPdntcQ
https://www.youtube.com/channel/UCMaOD7q-u-p6-ysGOjgYBZw
https://www.youtube.com/channel/UCbKWv2x9t6u8yZoB3KcPtnw
https://www.youtube.com/user/ducksmasher09
https://www.youtube.com/watch?v=3i_AdAtF6hM
https://www.youtube.com/watch?v=AKeqM2eWw1c
https://www.youtube.com/watch?v=wsAXCI0R7VE
https://www.youtube.com/watch?v=JLLT32YfXDs
https://www.youtube.com/watch?v=dN4kBhASzqg
https://www.youtube.com/watch?v=M5SrBtQr4NA
https://www.youtube.com/watch?v=ygbHdYNJGFo
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,17 @@ c:\users\olek\documents\visual studio 2015\Projects\AnnotationsMassDownloader\An
c:\users\olek\documents\visual studio 2015\Projects\AnnotationsMassDownloader\AnnotationsMassDownloader\obj\Debug\AnnotationsMassDownloader.pdb
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\AnnotationsMassDownloader\bin\Debug\Costura.dll
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\AnnotationsMassDownloader\bin\Debug\Costura.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\AnnotationsMassDownloader.exe.config
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\obj\Debug\AnnotationsMassDownloader.exe
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\obj\Debug\AnnotationsMassDownloader.pdb
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\AnnotationsMassDownloader.exe
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\AnnotationsMassDownloader.pdb
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\AngleSharp.dll
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\Costura.dll
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\Newtonsoft.Json.dll
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\YoutubeExplode.dll
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\AngleSharp.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\Costura.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\Newtonsoft.Json.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\bin\Debug\YoutubeExplode.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\AnnotationsMassDownloader\obj\Debug\AnnotationsMassDownloader.csprojResolveAssemblyReference.cache
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\packages\AngleSharp.0.9.9.1\lib\net45\AngleSharp.dll
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\packages\Costura.Fody.3.3.0\lib\net40\Costura.dll
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\packages\YoutubeExplode.4.6.2\lib\net45\YoutubeExplode.dll
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\packages\AngleSharp.0.9.9.1\lib\net45\AngleSharp.xml
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\packages\Costura.Fody.3.3.0\lib\net40\Costura.xml
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.xml
c:\Users\olek\Documents\Visual Studio 2015\Projects\AnnotationsMassDownloader\packages\YoutubeExplode.4.6.2\lib\net45\YoutubeExplode.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\packages\AngleSharp.0.9.9.1\lib\net45\AngleSharp.dll
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\packages\Costura.Fody.3.3.0\lib\net40\Costura.dll
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\packages\YoutubeExplode.4.6.2\lib\net45\YoutubeExplode.dll
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\packages\AngleSharp.0.9.9.1\lib\net45\AngleSharp.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\packages\Costura.Fody.3.3.0\lib\net40\Costura.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.xml
C:\Users\Aleksander\Documents\MassAnnotationDownloader-master\MassAnnotationDownloader-master\packages\YoutubeExplode.4.6.2\lib\net45\YoutubeExplode.xml
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit eb5863c

Please sign in to comment.