Use a generic matcher for the shorthand URIs.

This commit is contained in:
Xaekai 2015-02-16 22:40:18 -08:00
parent ca17c82c8c
commit 5c6a966e6f
1 changed files with 6 additions and 19 deletions

View File

@ -1316,38 +1316,25 @@ function parseMediaLink(url) {
} }
/* Shorthand URIs */ /* Shorthand URIs */
// To catch Google Plus by ID alone
if ((m = url.match(/(?:gp:)?(\d{21}_\d{19}_\d{19})/))) { if ((m = url.match(/(?:gp:)?(\d{21}_\d{19}_\d{19})/))) {
return { return {
id: m[1], id: m[1],
type: "gp" type: "gp"
}; };
} }
// So we still trim DailyMotion URLs
if ((m = url.match(/gd:([^\/]{28})/))) {
return {
id: m[1],
type: "gd"
};
}
if((m = url.match(/yt:([^\?&#]+)/))) {
return {
id: m[1],
type: "yt"
};
}
if((m = url.match(/dm:([^\?&#_]+)/))) { if((m = url.match(/dm:([^\?&#_]+)/))) {
return { return {
id: m[1], id: m[1],
type: "dm" type: "dm"
}; };
} }
// Generic for the rest.
if((m = url.match(/vi:([^\?&#]+)/))) { if ((m = url.match(/([a-z]{2}):([^\?&#]+)/)) {
return { return {
id: m[1], id: m[2],
type: "vi" type: m[1]
}; };
} }