【发布时间】:2021-07-23 00:30:38
【问题描述】:
我需要下载文件到:https://drive.google.com/u/0/uc?id=1sSR9kWifwjIP5qFWcyxGCxN0-MoEd_oo&export=download
但下载文件后,我只得到一个文件,其中只有一行:“Google Drive-Virus scan warning”。理论上,我应该从 url 中指定的链接下载文件(我是通过浏览器控制台获取的),但我下载的是一行难以理解的文档。据我了解,我下载的是页面标记,而不是文件本身。如何解决这个问题?
要下载文件,请使用以下方法:
using System;
using System.Net;
public class Program
{
public static void Main(string[] args)
{
{
string url = "https://drive.google.com/u/0/uc?export=download&confirm=pKfr&id=1sSR9kWifwjIP5qFWcyxGCxN0-MoEd_oo";
string savePath = @"C:\Users\Saint\Desktop\TaskRetail\yml.xml";
WebClient client = new WebClient();
client.DownloadFile(url, savePath);
Console.ReadLine();
}
}
【问题讨论】:
标签: c# .net google-chrome