importorg.jsoup.Jsoup;importorg.jsoup.nodes.Element;publicclassProfileToIDParser{publicstaticintparse(Stringusername){try{Stringurl="https://genius.com/"+username;org.jsoup.nodes.Documentdocument=Jsoup.connect(url).get();//returns the relative resource path, e.g. /users/12345; .first() may be omittedElementresourcePath=document.head().select("meta[name=newrelic-resource-path]").first();//Extract the Genius user IDStringid=resourcePath.attr("content").replace("/users/","");returnInteger.parseInt(id);}catch(Exceptione){e.printStackTrace();}return0;}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.