I would like to use the website from R. The website is http://soundoftext.com/ , where I can download WAV. files with audio files from the specified text and language (voice).
There are two ways to load voice into WAV: 1) Paste text and select a language. And send 2) In the new window, click "Save" and select a folder.
So far, I could get the xml tree, convert it to a list, and change the text and language values. However, I do not know how to convert the list to XML (with new values) and execute it. Then I will need to take the second step.
Here is my code:
require(RCurl)
require(XML)
webpage <- getURL("http://soundoftext.com/")
webpage <- readLines(tc <- textConnection(webpage)); close(tc)
pagetree <- htmlTreeParse(webpage, error=function(...){}, useInternalNodes = TRUE)
x<-xmlToList(pagetree)
x$body$div$div$div$form$div$label$.attrs[[1]]<-"Raúl"
x$body$div$div$div$form$div$label$.attrs[[1]]
x$body$div$div$div$form$div$select$option$.attrs<-"es"
x$body$div$div$div$form$div$select$option$.attrs
I follow this , but there is an error with the "tag".
: rvest , . ()?
url <- "http://soundoftext.com/"
s <- html_session(url)
f0 <- html_form(s)
f1 <- set_values(f0[[1]], text="Raúl", lang="es")
attr(f1, "type") <- "Submit"
s[["fields"]][["submit"]] <- f1
attr(f1, "Class") <- "save"
test <- submit_form(s, f1)