@@ -259,6 +259,7 @@ static class HttpEapi {
259
259
private static boolean useOkHttp = false ;
260
260
private static Class clazz ;
261
261
private static Method m_getCookieString ;
262
+ private static Class c_cookieClass ;
262
263
final Object httpBase ;
263
264
264
265
HttpEapi (Object httpBase ) {
@@ -267,7 +268,12 @@ static class HttpEapi {
267
268
268
269
static void init () throws PackageManager .NameNotFoundException , IllegalAccessException {
269
270
if (!getFilteredClasses ("okhttp3" , null ).isEmpty ()) {
270
- clazz = findClass ("com.netease.cloudmusic.h.f.d.d" , classLoader );
271
+ Pattern pattern = Pattern .compile ("^com\\ .netease\\ .cloudmusic\\ .[a-z]\\ .f\\ .d\\ .d$" );
272
+ List <String > list = getFilteredClasses (pattern , Collections .<String >reverseOrder ());
273
+ if (list .isEmpty ()) {
274
+ throw new RuntimeException ("init failed" );
275
+ }
276
+ clazz = findClass (list .get (0 ), classLoader );
271
277
useOkHttp = true ;
272
278
} else {
273
279
Pattern pattern = Pattern .compile ("^com\\ .netease\\ .cloudmusic\\ .[a-z]\\ .[a-z]$" );
@@ -299,7 +305,11 @@ static Class getClazz() {
299
305
300
306
static String getDefaultCookie () throws UnsupportedEncodingException , JSONException , InvocationTargetException , IllegalAccessException {
301
307
if (useOkHttp ) {
302
- List list = (List ) callMethod (callStaticMethod (findClass ("com.netease.cloudmusic.h.e.a.a" , classLoader ), "a" ), "d" );
308
+ if (c_cookieClass == null ) {
309
+ String className = getClazz ().getName ().substring (0 , PACKAGE_NAME .length () + 2 ) + ".e.a.a" ;
310
+ c_cookieClass = findClass (className , classLoader );
311
+ }
312
+ List list = (List ) callMethod (callStaticMethod (c_cookieClass , "a" ), "d" );
303
313
StringBuilder sb = new StringBuilder ();
304
314
boolean first = true ;
305
315
for (Object l : list ) {
0 commit comments