Added SoundCloud source
This commit is contained in:
1 parent
6276a68d98
commit
324dd41145
1 file changed
+9
-1
@@ -23,16 +23,21 @@ enum SourceEnum {
|
||||
public class SourceFinder {
|
||||
private static Pattern youtubePattern = Pattern.compile("^(?:https?://)?(?:(?:www\\.)?)?(?:youtube\\.com|youtu\\.be)/.*?(?:embed|e|v|watch.*?v=)?/?([-_a-z0-9]{10,})?(?:&?index=\\d+)?(?>(?:playlist\\?|&)?list=([^#\\\\&\\?]{12,}))?", Pattern.CASE_INSENSITIVE);
|
||||
private static Matcher youtubeMatcher;
|
||||
private static Matcher soudcloudMatcher;
|
||||
private static Pattern soundcloudPattern = Pattern.compile("^(?:https?://)?(?:www\\.)?(?:m\\.)?soundcloud\\.com/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)(?:\\\\?.*|)$", Pattern.CASE_INSENSITIVE);
|
||||
private static Matcher soundcloudMatcher;
|
||||
private static Matcher BandcampMatcher;
|
||||
private static Matcher vimeoMatcher;
|
||||
|
||||
public static SourceEnum getSource(String url) {
|
||||
youtubeMatcher = youtubePattern.matcher(url);
|
||||
soundcloudMatcher = soundcloudPattern.matcher(url);
|
||||
|
||||
if (youtubeMatcher.find())
|
||||
return SourceEnum.Youtube;
|
||||
|
||||
if (soundcloudMatcher.find())
|
||||
return SourceEnum.Soundcloud;
|
||||
|
||||
if (url.startsWith("ytsearch:"))
|
||||
return SourceEnum.YTSearch;
|
||||
|
||||
@@ -47,6 +52,9 @@ public class SourceFinder {
|
||||
case Youtube:
|
||||
identifier = youtubeMatcher.group(1);
|
||||
break;
|
||||
case Soundcloud:
|
||||
identifier = url;
|
||||
break;
|
||||
case YTSearch:
|
||||
identifier = url;
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user