|
1 | 1 | package com.gapps.library.api |
2 | 2 |
|
3 | 3 | //Patterns |
4 | | -//https://regex101.com/r/nJzgG0/1 |
| 4 | +//YouTube: https://regex101.com/r/nJzgG0/1 |
5 | 5 | const val YOUTUBE_PATTERN = "(?:http(?:s)?:\\/\\/)?(?:www.)?(?:m.)?(?:music.)?youtu(?:be|.be)?(?:\\.com)?(?:(?:\\w*.?:\\/\\/)?\\w*.?\\w*-?.?\\w*\\/(?:embed|e|v|watch|.*\\/)?\\??(?:feature=\\w*\\.?\\w*)?&?(?:v=)?\\/?)([\\w\\d_-]{11})(?:\\S+)?" |
| 6 | +//Vimeo: https://regex101.com/r/Nru4zu/1 |
6 | 7 | const val VIMEO_PATTERN = "(?:http[s]?://)(?:w{3})?(?:player\\.)?vimeo\\.com/(?:[a-z]*/)*([0-9]{6,11})[?]?" |
7 | 8 | const val RUTUBE_PATTERN = "(?:http[s]?://)(?:w{3})?(?:player\\.)?rutube\\.ru/video/(?:embed/)?([A-Za-z0-9]+)[/]?(\\?.+)?" |
| 9 | +//Facebook: https://regex101.com/r/98Nfkr/5 |
8 | 10 | const val FACEBOOK_PATTERN = "(?:http[s]?://)?(?:www.|web.|m.)?(?:facebook|fb)?.com/(?:(?:video.php|watch?/)?\\?v=|.+/videos(?:/.+)?/)(\\d+)\\S*" |
9 | | -//https://regex101.com/r/98Nfkr/2 |
10 | 11 | const val DAILYMOTION_PATTERN = "(?:http[s]?://)?(?:www\\.)?(?:(?:dailymotion\\.com(?:/embed)?/video)|dai\\.ly)/([a-zA-Z0-9]+)(?:_[\\w_-]+)?" |
11 | 12 | const val WISTIA_PATTERN = "(?:http[s]?:\\/\\/)?(?:.+)?(?:wistia\\.(?:com|net)|wi\\.st)\\/(?:medias|embed|series)\\/(?:iframe\\/?)?(?:\\S+\\?\\S*wvideoid=)?([a-zA-Z0-9]+)\\S*" |
12 | 13 | const val VZAAR_PATTERN = "(?:http[s]?://)?(?:.+)?vzaar.com/?(?:videos/)?([a-zA-Z0-9]+)\\S*" |
| 14 | +//Hulu: https://regex101.com/r/LORZgZ/2 |
13 | 15 | const val HULU_PATTERN = "(?:http[s]?:\\/\\/)?(?:www.)?hulu\\.(?:(?:com\\/\\S*(?:w(?:atch)?|eid)(?:\\/|=)?)|(?:tv\\/))?([a-zA-Z0-9]+)\\S*" |
14 | | -//https://regex101.com/r/LORZgZ/1 |
| 16 | +//Ustream: https://regex101.com/r/E0PMAV/2 |
15 | 17 | const val USTREAM_PATTERN = "(?:http[s]?:\\/\\/)?(?:www\\.)?ustream.(?:com|tv)\\/(?:recorded|embed|channel)\\/?(?:([0-9]+)|(\\S+))(?:\\/\\S*)?" |
16 | | -//https://regex101.com/r/E0PMAV/1 |
| 18 | +//Ted: https://regex101.com/r/Cbhu4d/2 |
17 | 19 | const val TED_TALKS_PATTERN = "(?:http[s]?:\\/\\/)?(?:www|embed)?\\.?ted\\.com\\/talks\\/([_a-zA-Z0-9]+)\\S*" |
18 | | -//https://regex101.com/r/Cbhu4d/1 |
19 | 20 |
|
20 | 21 | //Base |
21 | 22 | private const val YOUTUBE_BASE_URL = "https://www.youtube.com" |
|
0 commit comments