Skip to content

Instantly share code, notes, and snippets.

@arthur-flam
Last active December 19, 2015 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthur-flam/5910814 to your computer and use it in GitHub Desktop.
Save arthur-flam/5910814 to your computer and use it in GitHub Desktop.
Vérification de diplôme : Université Paris Dauphine
## Arthur Flam
## @ArthurFlam
## Ecole Centrale Paris, ex-Dauphine
## Vérifier si quelqu'un vient bien de Dauphine
library(RCurl)
library(rjson)
library(XML)
is.Dauphine = function(prenom, nom){
# creating request
params = list(firstname = prenom, lastname = nom)
uri = "http://www.dauphine-alumni.org/taglib/sectionupdate/update?updatelist=content:action://addressbook/public-search/search"
response = postForm(uri=uri, .params=params, .opts=list(encoding='UTF-8'))
# parsing json response
json = fromJSON(response)
doc = htmlParse(json$content, encoding="UTF-8")
# extracting and cleaning information
out = unlist(xpathApply(doc, "//li", xmlValue))
if(is.null(out)) return("Aucun diplômé trouvé")
out = gsub(out, pattern="[\n|\t]",replacement="")
gsub(out, pattern=" +",replacement=" ")
}
is.Dauphine("arthur","flam")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment