R+Rcurl: How to Download a File from Pcloud?

114 views Asked by At

I am trying to download a file from the cloud storage provider pcloud using R+Rcurl. The file can be downloaded by following the link

https://e.pcloud.link/publink/show?code=XZgjVDZscLM2cMSvMu82070NKGEBSCTU8wX

and clicking the download button.

However, if I do

  library(RCurl)
  
  url='https://e.pcloud.link/publink/show?code=XZgjVDZscLM2cMSvMu82070NKGEBSCTU8wX'

  download.file(url, destfile="file1.txt",
          method="auto")

The final result is definitely not the text file I want. Does anyone know how to do it correctly? Thanks!

1

There are 1 answers

0
Erfan Ghasemi On BEST ANSWER

You can use the following codes to get the desired file:

library(RCurl)

url='https://evc118.pcloud.com/dHZn0leKuZannJ0wZZZnlmEykZ2ZZUT7ZkZgjVDZpCgmF4S6CRS92OPqbPt3cF5KywDy/speech2021.txt'

download.file(url, destfile="file1.txt",
              method="auto")

I just modified the URL link.

In the case of finding the download link. You can try to download the file on Google Chrome and in the download tab, you should right-click on the link and copy the link address as the following photo:

enter image description here