Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit ef1ba2e

Browse files
committed
Fixes issues with downloading Twitter videos
1 parent 9022e8f commit ef1ba2e

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

WPFMETRO/Queue.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public Dictionary<string, string> GetFormats(string url)
141141
desc = values[1].ToString() + " (" + values[2].ToString() + ")";
142142
}
143143
hasAudio = !hasAudio && values[1].ToString() == "mp4" || values[1].ToString() == "webm" || values[1].ToString() == "m4a" ? true : hasAudio;
144+
code += output.Contains("video only") ? "-y" : "-n";
144145

145146
formats.Add(code, desc);
146147
}

WPFMETRO/Settings.xaml.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,20 @@ private void ColorBox_SelectionChanged(object sender, SelectionChangedEventArgs
7373

7474
private void ResetButton_Click(object sender, RoutedEventArgs e)
7575
{
76-
MessageBoxResult userDialogResult = MessageBox.Show(Localization.Strings.AreYouSure, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
77-
if (userDialogResult == MessageBoxResult.Yes)
78-
{
79-
try
80-
{
81-
File.Delete(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);
82-
}
83-
catch (Exception eee)
84-
{
85-
MessageBox.Show(eee.Message);
86-
}
76+
MessageBoxResult userDialogResult = MessageBox.Show(Localization.Strings.AreYouSure, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
77+
if (userDialogResult == MessageBoxResult.Yes)
78+
{
79+
try
80+
{
81+
File.Delete(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);
82+
}
83+
catch (Exception ex)
84+
{
85+
MessageBox.Show(ex.Message);
86+
}
8787

88-
Application.Current.Shutdown();
89-
}
90-
88+
Application.Current.Shutdown();
89+
}
9190
}
9291
}
9392
}

WPFMETRO/Video.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ public void DownloadVideo()
6666
if (SelectedFormat.Contains(" "))
6767
{
6868
arguments += SelectedFormat.Substring(0, SelectedFormat.IndexOf(" "));
69-
arguments += SelectedFormat.Contains("mp4") ? "+bestaudio[ext!=webm]" : "+bestaudio[ext=webm]‌";
70-
arguments += " --merge-output-format" + SelectedFormat.Substring(SelectedFormat.IndexOf(" "));
69+
if (SelectedFormat.Substring(SelectedFormat.Length - 1) == "y")
70+
{
71+
int spaceIndex = SelectedFormat.IndexOf(" ");
72+
arguments += SelectedFormat.Contains("mp4") ? "+bestaudio[ext!=webm]" : "+bestaudio[ext=webm]‌";
73+
arguments += " --merge-output-format" + SelectedFormat.Substring(spaceIndex, SelectedFormat.Length - spaceIndex - 2);
74+
}
7175
}
7276
else
7377
{
@@ -78,7 +82,7 @@ public void DownloadVideo()
7882
}
7983
}
8084
arguments += SelectedFormat == "default" ? "-o \"" + Path + Name + "\"" : " -o \"" + Path + Name + "\"";
81-
arguments += " " + ID;
85+
arguments += " -i " + ID;
8286

8387
ytbDLInfo.Arguments = arguments;
8488
ytbDL = Process.Start(ytbDLInfo);

0 commit comments

Comments
 (0)