@@ -55,7 +55,7 @@ public abstract class YouTubeUriExtractor extends AsyncTask<String, String, Spar
55
55
56
56
private static final String USER_AGENT ="Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36" ;
57
57
58
- private static final Pattern patYouTubePageLink =Pattern .compile ("(http|https)://(www\\ .|)youtube\\ .com/watch\\ ?v=(.+?)( |\\ z|&)" );
58
+ private static final Pattern patYouTubePageLink =Pattern .compile ("(http|https)://(www\\ .|m.| )youtube\\ .com/watch\\ ?v=(.+?)( |\\ z|&)" );
59
59
private static final Pattern patYouTubeShortLink =Pattern .compile ("(http|https)://(www\\ .|)youtu.be/(.+?)( |\\ z|&)" );
60
60
61
61
private static final Pattern patItag =Pattern .compile ("itag=([0-9]+?)(&|,)" );
@@ -131,6 +131,7 @@ protected void onPostExecute(SparseArray<YtFile> ytFiles) {
131
131
132
132
@ Override
133
133
protected SparseArray <YtFile > doInBackground (String ... params ) {
134
+ youtubeID =null ;
134
135
String ytUrl =params [0 ];
135
136
if (ytUrl == null ){
136
137
return null ;
@@ -231,18 +232,17 @@ private SparseArray<YtFile> getStreamUrls() throws IOException, InterruptedExcep
231
232
decipherFunctionName =null ;
232
233
}
233
234
decipherJsFileName =curJsFileName ;
234
- }
235
- streams =streamMap .split (",|url_encoded_fmt_stream_map|&adaptive_fmts=" );
236
-
235
+ }
237
236
}else {
238
237
patTitle = Pattern .compile ("title=((.*?))(&|\\ z)" );
239
238
mat =patTitle .matcher (streamMap );
240
239
if (mat .find ()){
241
240
videoTitle =URLDecoder .decode (mat .group (2 ), "UTF-8" );
242
241
}
243
242
streamMap =URLDecoder .decode (streamMap , "UTF-8" );
244
- streams =streamMap .split (",|url_encoded_fmt_stream_map|&adaptive_fmts=" );
245
243
}
244
+
245
+ streams =streamMap .split (",|url_encoded_fmt_stream_map|&adaptive_fmts=" );
246
246
SparseArray <YtFile > ytFiles =new SparseArray <YtFile >();
247
247
for (String encStream : streams ){
248
248
encStream =encStream + "," ;
@@ -289,10 +289,9 @@ private SparseArray<YtFile> getStreamUrls() throws IOException, InterruptedExcep
289
289
lock .unlock ();
290
290
}
291
291
}
292
- if (decipheredSignature == null ){
292
+ sig =decipheredSignature ;
293
+ if (sig == null ){
293
294
return null ;
294
- }else {
295
- sig =decipheredSignature ;
296
295
}
297
296
}
298
297
}
@@ -418,6 +417,8 @@ else if (javascriptFile.charAt(i) == '}')
418
417
if (CACHING ){
419
418
writeDeciperFunctToChache ();
420
419
}
420
+ }else {
421
+ return false ;
421
422
}
422
423
}else {
423
424
decipherViaWebView (sig );
0 commit comments