【发布时间】:2017-12-06 11:12:30
【问题描述】:
我正在尝试将此 URL 的内容作为字符串获取。
https://noembed.com/embed?url=https://www.youtube.com/watch?v=1FLhOGOg2Qg
这是我正在使用的代码:
var html_content = "";
using (var client = new WebClient())
{
client.Headers.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36");
html_content += client.DownloadString("https://noembed.com/embed?url=https://www.youtube.com/watch?v=1FLhOGOg2Qg");
}
Console.WriteLine(html_content);
Console.ReadLine();
这是我得到的错误:
System.Net.WebException was unhandled
HResult=-2146233079
Message=The request was aborted: Could not create SSL/TLS secure channel.
Source=System
我在 WPF 应用程序上使用它,我可以在这里忽略 SSL。我已经尝试过其他忽略 SSL 的答案,但没有一个有效。它适用于其他网址,例如https://www.youtube.com/watch?v=1FLhOGOg2Qg,但不适用于 noembed.com 网址。
【问题讨论】: