@@ -33,39 +33,6 @@ class NewSourceTest {
3333 config .setSourceId (6 );
3434 }
3535
36- @ Test
37- void crackSearch () {
38- String kw = "我吃西红柿" ;
39- String js = ResourceUtil .readUtf8Str ("js/rule-6.js" );
40- Object key = ScriptUtil .invoke (js , "getParamB" , kw );
41-
42- Source source = new Source (6 );
43- Rule .Search ruleSearch = source .rule .getSearch ();
44- String param = ruleSearch .getData ().formatted (key , kw );
45- /* JSONObject obj = JSONUtil.parseObj(param);
46- System.out.println(JSONUtil.toJsonPrettyStr(obj)); */
47-
48- Map <String , String > map = JSONUtil .toBean (param , Map .class );
49- HttpRequest req = HttpRequest
50- .get (ruleSearch .getUrl ())
51- .header ("Referer" , ruleSearch .getUrl () + "search.html" )
52- .formStr (map );
53-
54- System .out .println (req .form ());
55- String body = req .execute ().body ();
56- String s = UnicodeUtil .toString (body );
57- String s2 = HtmlUtil .unescape (s )
58- .replace ("\\ r" , "" )
59- .replace ("\\ n" , "" )
60- .replace ("\\ t" , "" )
61- .replace ("\\ /" , "/" )
62- .replace ("\\ \" " , "'" );
63- String s4 = ReUtil .getGroup0 ("\\ {(.*?)\\ }" , s2 );
64- JSONObject jsonObject = JSONUtil .parseObj (s4 );
65- String html = jsonObject .getStr ("content" );
66- System .out .println (Jsoup .parse (html ));
67- }
68-
6936 @ Test
7037 void searchParse () {
7138 SearchResultParser sr = new SearchResultParser (config );
@@ -97,4 +64,38 @@ void chapterParse() {
9764 System .out .println (chapterParser .parse (chapter ));
9865 }
9966
67+
68+ @ Test
69+ void crackSearch6 () {
70+ String kw = "我吃西红柿" ;
71+ String js = ResourceUtil .readUtf8Str ("js/rule-6.js" );
72+ Object key = ScriptUtil .invoke (js , "getParamB" , kw );
73+
74+ Source source = new Source (config );
75+ Rule .Search ruleSearch = source .rule .getSearch ();
76+ String param = ruleSearch .getData ().formatted (kw , key );
77+ JSONObject obj = JSONUtil .parseObj (param );
78+ System .out .println (JSONUtil .toJsonPrettyStr (obj ));
79+
80+ Map <String , String > map = JSONUtil .toBean (param , Map .class );
81+ HttpRequest req = HttpRequest
82+ .get (ruleSearch .getUrl ())
83+ .header ("Referer" , ruleSearch .getUrl () + "search.html" )
84+ .formStr (map );
85+
86+ System .out .println (req .form ());
87+ String body = req .execute ().body ();
88+ String s = UnicodeUtil .toString (body );
89+ String s2 = HtmlUtil .unescape (s )
90+ .replace ("\\ r" , "" )
91+ .replace ("\\ n" , "" )
92+ .replace ("\\ t" , "" )
93+ .replace ("\\ /" , "/" )
94+ .replace ("\\ \" " , "'" );
95+ String s4 = ReUtil .getGroup0 ("\\ {(.*?)\\ }" , s2 );
96+ JSONObject jsonObject = JSONUtil .parseObj (s4 );
97+ String html = jsonObject .getStr ("content" );
98+ System .out .println (Jsoup .parse (html ));
99+ }
100+
100101}
0 commit comments