Skip to content
This repository was archived by the owner on Sep 28, 2020. It is now read-only.

Commit f3f48e7

Browse files
author
Jay Harris
committed
Made the changes more consistent with the rest of YouTube extractor and attempted to fix indentation issues.
1 parent 505bfd2 commit f3f48e7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace YoutubeExtractor
1212
/// </summary>
1313
public static class DownloadUrlResolver
1414
{
15-
private const string RateBypassFlag = "ratebypass=yes";
15+
private const string RateBypassFlag = "ratebypass";
1616
private const int CorrectSignatureLength = 81;
1717
private const string SignatureQuery = "signature";
1818

@@ -104,9 +104,6 @@ public static IEnumerable<VideoInfo> GetDownloadUrls(string videoUrl, bool decry
104104
{
105105
DecryptDownloadUrl(info);
106106
}
107-
108-
//Add the ratebypass parameter to the url. This is optional but greatly speeds up downloads
109-
info.DownloadUrl += "&" + RateBypassFlag;
110107
}
111108

112109
return infos;
@@ -206,6 +203,10 @@ private static IEnumerable<ExtractionInfo> ExtractDownloadUrls(JObject json)
206203
url = HttpHelper.UrlDecode(url);
207204
url = HttpHelper.UrlDecode(url);
208205

206+
IDictionary<string, string> parameters = HttpHelper.ParseQueryString(url);
207+
if (!parameters.ContainsKey(RateBypassFlag))
208+
url += string.Format("&{0}={1}", RateBypassFlag, "yes");
209+
209210
yield return new ExtractionInfo { RequiresDecryption = requiresDecryption, Uri = new Uri(url) };
210211
}
211212
}

0 commit comments

Comments
 (0)