Skip to content

Commit 6eb2d9f

Browse files
committed
Fixed patterns
1 parent 2c860fc commit 6eb2d9f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • library/src/main/java/com/gapps/library/api

library/src/main/java/com/gapps/library/api/Const.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package com.gapps.library.api
22

33
//Patterns
4-
//https://regex101.com/r/nJzgG0/1
4+
//YouTube: https://regex101.com/r/nJzgG0/1
55
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
67
const val VIMEO_PATTERN = "(?:http[s]?://)(?:w{3})?(?:player\\.)?vimeo\\.com/(?:[a-z]*/)*([0-9]{6,11})[?]?"
78
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
810
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
1011
const val DAILYMOTION_PATTERN = "(?:http[s]?://)?(?:www\\.)?(?:(?:dailymotion\\.com(?:/embed)?/video)|dai\\.ly)/([a-zA-Z0-9]+)(?:_[\\w_-]+)?"
1112
const val WISTIA_PATTERN = "(?:http[s]?:\\/\\/)?(?:.+)?(?:wistia\\.(?:com|net)|wi\\.st)\\/(?:medias|embed|series)\\/(?:iframe\\/?)?(?:\\S+\\?\\S*wvideoid=)?([a-zA-Z0-9]+)\\S*"
1213
const val VZAAR_PATTERN = "(?:http[s]?://)?(?:.+)?vzaar.com/?(?:videos/)?([a-zA-Z0-9]+)\\S*"
14+
//Hulu: https://regex101.com/r/LORZgZ/2
1315
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
1517
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
1719
const val TED_TALKS_PATTERN = "(?:http[s]?:\\/\\/)?(?:www|embed)?\\.?ted\\.com\\/talks\\/([_a-zA-Z0-9]+)\\S*"
18-
//https://regex101.com/r/Cbhu4d/1
1920

2021
//Base
2122
private const val YOUTUBE_BASE_URL = "https://www.youtube.com"

0 commit comments

Comments
 (0)