【问题标题】:How to direct download large file from Google drive without Google Drive can't scan this file for viruses message如何在没有 Google Drive 的情况下直接从 Google Drive 下载大文件无法扫描此文件中的病毒消息
【发布时间】:2018-06-23 18:55:26
【问题描述】:

我正在尝试在我的 Google 驱动器中播放一个音乐文件,但它大约 300mb,因此 Google 不会让我使用此链接直接下载它。

https://drive.google.com/uc?export=download&id=12cpUAP0wy8jyMD4-rjKJ23bicCJ29Cs-

有一个“谷歌驱动器无法扫描此文件消息”并下载按钮。然后我使用 Chrome 检查了无论如何下载按钮并看到了这个链接:

https://drive.google.com/uc?export=download&confirm=9iBg&id=12cpUAP0wy8jyMD4-rjKJ23bicCJ29Cs-

所以我尝试使用下面的 func 播放音频,它工作正常

audioPlayer = AVPlayer(url: url)

但是,无论如何下载按钮的网址不断从确认=9iBg 更改为确认=????这使得无法再次播放音频,除非我必须转到我的代码并手动更改该 ID。这个问题有方法解决吗?谢谢!

【问题讨论】:

标签: ios swift avplayer nsurl


【解决方案1】:

不幸的是,没有确认窗口就无法完成,很可能令牌&confirm=9iBg&id=12cpUAP0wy8jyMD4-rjKJ23bicCJ29Cs- 有一个到期日期,并且只能通过确认窗口进行更新。

【讨论】:

    【解决方案2】:

    今天解决同样的问题时,我想出了一个解决方案。我正在使用 shell 自动从谷歌驱动器下载文件。关键是设置cookie并从第一次下载尝试结果html页面内容中动态检索确认码:

    printf "${WHITE}Downloading ${fileNames[$i]}${NC}\n"
    curl -L -c mycookie -o temp "https://drive.google.com/uc?export=download&id=${fileLinks[$i]}"
    filesize=$(wc -c temp | awk '{print $1}')
    if [ $filesize -gt 10000 ]; then
      printf "Finish downloading\n"
      mv temp "${fileNames[$i]}.tar.gz"
    else
      content=$(cat temp)
      for (( j=0; j<$filesize-10; j++)); do
        if [ "${content:$j:8}" == "confirm=" ]; then
          for (( k=0; k<10; k++)); do
            if [ "${content:$j+8+$k:1}" == "&" ]; then
              token=${content:$j+8:$k}
            fi
          done
        fi
      done
      printf "Confirm downloading with token ${token}\n"
      curl -L -b mycookie -o "${fileNames[$i]}.tar.gz" "https://drive.google.com/uc?export=download&confirm=${token}&id=${fileLinks[$i]}"
      rm mycookie
      rm temp
    fi
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-19
      相关资源
      最近更新 更多