Hello,
I am trying to setup a script which automatically downloads every day Facebook's daily reports on political advertisments. The button to download the report is at the bottom of this page.
I am able to trigger the download with RSelenium:
library(RSelenium)
#open server
rd <- rsDriver(browser = "firefox", port = 4444L)
#open browser
ffd <- rd$client
#navigate to target url
url <- 'https://www.facebook.com/ads/library/report/'
ffd$navigate(url)
css_selector <- "._7vio"
download_btn <- ffd$findElement(using = "css selector", css_selector)
download_btn$clickElement()
And I am also able to setup an RStudio Server instance which runs on AWS. However, I didn't manage to get RSelenium running on the virtual cloud.
Hence, I was wondering whether there is another way to trigger the 'click' on the download button, e.g. via httr. I saw a few pertaining posts on stackoverflow, but they pertain to forms which are downloaded as .csvs. Here I have to trigger the 'click' and I haven't figured out how to do this. In fact, I am even not sure whether it is possible. I would be hence grateful for any hint/cue how to proceed.
I had posted this question already on stackoverflow, but didn't get any reply. Should an answer come up I will post it here. Many thanks.