Commit b0aa3851 by yangchen

提交360kuai 的 自媒体账号获取方法

parent d6f4e440
...@@ -25,7 +25,7 @@ public class MediaSelfSource { ...@@ -25,7 +25,7 @@ public class MediaSelfSource {
public static void main(String[] args) { public static void main(String[] args) {
ProxyFactory.init("zookeeper://192.168.0.36:2181","local",GroupType.PROVIDER); ProxyFactory.init("zookeeper://192.168.0.36:2181","local",GroupType.PROVIDER);
List<String> urlList = new ArrayList<>(); List<String> urlList = new ArrayList<>();
urlList.add("https://www.lanjinger.com/news/detail?id=115982"); urlList.add("https://www.360kuai.com/pc/964909cac01375581?cota=3&kuai_so=1&sign=360_e39369d1&refer_scene=so_3");
List<MediaSelfSourceBean> u = MediaSelfSource.getMediaSelfSource(urlList); List<MediaSelfSourceBean> u = MediaSelfSource.getMediaSelfSource(urlList);
for(MediaSelfSourceBean b : u) { for(MediaSelfSourceBean b : u) {
System.out.println(b.toString()); System.out.println(b.toString());
......
...@@ -398,7 +398,10 @@ public class MatchSource { ...@@ -398,7 +398,10 @@ public class MatchSource {
Matcher ma = Pattern.compile("window.__INITIAL_DATA__ =[\\s\\S]+?\\</script\\>").matcher(html); Matcher ma = Pattern.compile("window.__INITIAL_DATA__ =[\\s\\S]+?\\</script\\>").matcher(html);
if(ma.find()) { if(ma.find()) {
String result = ma.group().replaceAll("window.__INITIAL_DATA__ =|\\</script\\>|", "").trim(); String result = ma.group().replaceAll("window.__INITIAL_DATA__ =|\\</script\\>|", "").trim();
JSONObject json = JSONObject.parseObject(result.substring(0,result.length()-1)); if(result.contains("window.autohomePVDDWhiteList")) {
result = result.split("window.autohomePVDDWhiteList")[0];
}
JSONObject json = JSONObject.parseObject(result.trim().substring(0,result.lastIndexOf(";")));
source = json.getJSONObject("detail").getString("sec_src"); source = json.getJSONObject("detail").getString("sec_src");
if(Objects.isNull(source) || source.length() < 1) { if(Objects.isNull(source) || source.length() < 1) {
source = json.getJSONObject("detail").getString("src"); source = json.getJSONObject("detail").getString("src");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment