Rav*_*avs 1 html java parsing android jsoup
需要帮助使用 JSOUP 从 HTML META 标记中提取 URL 值。这是我的 html -
String html = "<HTML><HEAD><...></...><META ......><META ......><META http-equiv="refresh" content="1;URL='https://xyz.com/login.html?redirect=www.google.com'"></HEAD></HTML>"
Run Code Online (Sandbox Code Playgroud)
预期输出:“https://xyz.com/login.html?redirect=www.google.com”
谁能告诉我怎么做。谢谢
假设是第一个 META
String html_src = ...
Document doc = Jsoup.parse(html);
Element eMETA = doc.select("META").first();
String content = eMETA.attr("content");
String urlRedirect = content.split(";")[1];
String url = urlRedirect.split("=")[1].replace("'","");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5495 次 |
| 最近记录: |