Yep YouTube app has changed the content of the intent it fires to "Title: URL" rather than just "URL".
I have managed to make myself a filthy hack to get me by until freezy releases the new version he has been working on.
This hack:
- Has not been well tested!
- Breaks compatibility with old versions of YouTube app!
- Requires full un-install and re-install (new signatures)
- ... so probably isn't worth your while unless you use this feature a lot as I did!
What the hack actually is, and please note I am only listing the subs/functions that I have changed here!
UrlIntentController.java (private void CheckIntent())
Code:
private void checkIntent(){
Intent intent = mActivity.getIntent();
final String action = intent.getAction();
if(action != null) {
Log.i("CHECKINTENT", action);
if ( action.equals(UrlIntentActivity.ACTION) ){
final String subjectTxt = intent.getStringExtra(Intent.EXTRA_SUBJECT);
// Youtube Filthy Hack
String pathtemp = intent.getStringExtra(Intent.EXTRA_TEXT).trim();
if ((pathtemp.toLowerCase().contains("youtu.be/") == true) || (pathtemp.toLowerCase().contains("youtube.com/") == true)) {
// This is a YOUTUBE link - fudge it.
if (pathtemp.contains(" ") == true) {
pathtemp = pathtemp.substring(pathtemp.lastIndexOf(' ')).trim();
}
}
final String path = pathtemp;
// End Of Hack.
if(isIMDB(subjectTxt)){
handleIMDb(path);
cleaupIntent(intent);
}
else if(isValidURL(path)){
handleURL(path);
cleaupIntent(intent);
}
}
}
}
YoutubeURLParser.java (public static String parseYoutubeURL)
Code:
public static String parseYoutubeURL(Uri playuri) {
Pattern patregex;
if (playuri.getHost().endsWith("youtube.com") == true) {
// We'll need to get the v= parameter from the URL and use
// that to send to XBMC
patregex = Pattern.compile("^http(:?s)?:\\/\\/(?:www\\.)?(?:youtube\\.com)\\/watch\\?(?=.*v=([\\w-]+))(?:\\S+)?$", Pattern.CASE_INSENSITIVE);
} else if (playuri.getHost().endsWith("youtu.be") == true) {
patregex = Pattern.compile("^http(:?s)?:\\/\\/(?:www\\.)?(?:youtu\\.be)(?=.*\\/([\\w-]+))(?:\\S+)?$", Pattern.CASE_INSENSITIVE);
} else {
patregex = null;
return null;
}
final Pattern pattern = patregex;
final Matcher matcher = pattern.matcher(playuri.toString());
if (matcher.matches()) {
return matcher.group(2);
} else {
return null;
}
}
Oh and I changed this ONE line in androidmanifest.xml too:
Code:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="10" />
No attach button on these forums so if you want APK PM me an email addy or something!