使用请求下载文件结果html中的文件结果

发布于 2025-01-26 07:55:04 字数 1167 浏览 2 评论 0原文

我目前的代码是:

url = "https://drive.google.com/u/0/uc?id=1-PopFOwxcm39uW4I-tVM5tSrOjvyOCly&export=download"

# Get all the files from mediafire link

def fetchFilesMedia():
  response = requests.get(url, stream=True)
  with open("test", "wb") as handle:
    for data in tqdm(response.iter_content()):
        handle.write(data)

我希望它下载zip中的所有文件夹,但目前仅下载网页。

<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8">
  <meta content="width=300, initial-scale=1" name="viewport">
  <meta name="description" content="Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.">
  <meta name="google-site-verification" content="LrdTUW9psUAMbh4Ia074-BPEVmcpBxF6Gwf0MSgQXZs">
  <title>Meet Google Drive – One place for all your files</title>
  <style>
  @font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300;
  src: url(//fonts.gstatic.com/s/opensans/v15/mem5YaGs126MiZpBA-UN_r8OUuhs.ttf) format('truetype');
}

ETC。

My code currently is:

url = "https://drive.google.com/u/0/uc?id=1-PopFOwxcm39uW4I-tVM5tSrOjvyOCly&export=download"

# Get all the files from mediafire link

def fetchFilesMedia():
  response = requests.get(url, stream=True)
  with open("test", "wb") as handle:
    for data in tqdm(response.iter_content()):
        handle.write(data)

I want it to download all the folders in the zip but currently it just downloads the webpage.

<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8">
  <meta content="width=300, initial-scale=1" name="viewport">
  <meta name="description" content="Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.">
  <meta name="google-site-verification" content="LrdTUW9psUAMbh4Ia074-BPEVmcpBxF6Gwf0MSgQXZs">
  <title>Meet Google Drive – One place for all your files</title>
  <style>
  @font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300;
  src: url(//fonts.gstatic.com/s/opensans/v15/mem5YaGs126MiZpBA-UN_r8OUuhs.ttf) format('truetype');
}

etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文