0

i worked on that problem for a while and can´t find anny solution. I try to using R to download a pdf/epub file from an nginx server. Link to website

Usually R provide for that purpose the download.file function. But that dosn´t work because you need the direct path to pdf file. The server provides the usuall Downloadbutton, to trigger the download. When I look on the the html-code, i see the following for the button-item

<input id="btn_download" value="Download File" type="submit">

I found some stuff here that handle the same problem but for Javascript Trigger Download. From this point i came to the R-package "rJava" but it looks very complicated to me. So I start to experiment with the "rMouse" package, but than you need to call the page directly in a browserwindow to solf the triggerproblem. Is there some package/function that can help me to automate to solve these requestformula from the server. I would be happy for help.

  • I think you are trying to download epub books. ` epub <- "http://longfiles.com/ee6zjl95ajqu/The_Little_Book_of_Mahjong_Learn_How_to_Play,_Score,_and_Win.epub" download.file(epub,destfile = "test.epub")` Also, Check this package to read it https://www.rdocumentation.org/packages/epubr/versions/0.4.0 – user5249203 Jun 26 '18 at 20:49
  • Nice try, but you only skip the '.html' at the end of the link. That leads to 'No Such file with this filename'. I try it with pdf and epub and it dosn´t work. That means, it doesn´t download the file, only a little script of 13 kb size. This script works like a link that brings me directly to the downloadsite with the button. – Rcoderunner Jun 26 '18 at 23:16
  • You can probably use RSelenium to simulate a click on the download link. – yusuzech Jun 27 '18 at 01:45
  • Hey Yifu Yan, thanx for the support. RSelenium is removed from CRAN https://stackoverflow.com/questions/50153220/cran-r-removed-rselenium-why I guess there is a possebility to download the package somewhere and install it, but 'rMouse' shout be the same. I try it but it´s not the best reason ... see above. – Rcoderunner Jun 27 '18 at 12:55

0 Answers0