Last active
December 19, 2015 06:19
-
-
Save arthur-flam/5910814 to your computer and use it in GitHub Desktop.
Vérification de diplôme : Université Paris Dauphine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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