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

Commit e7b5d88

Browse files
committed
Check if the URL is actually an HTTP URL
1 parent ce312d5 commit e7b5d88

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@ public static System.Threading.Tasks.Task<IEnumerable<VideoInfo>> GetDownloadUrl
140140
/// </returns>
141141
public static bool TryNormalizeYoutubeUrl(string url, out string normalizedUrl)
142142
{
143+
Uri uriResult;
144+
bool isValidurl = Uri.TryCreate(x, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
145+
146+
if (!isValidUrl)
147+
{
148+
normalizedUrl = null;
149+
return false;
150+
}
151+
143152
url = url.Trim();
144153

145154
url = url.Replace("youtu.be/", "youtube.com/watch?v=");

0 commit comments

Comments
 (0)