more youtube dupe detection
This commit is contained in:
parent
b7830261d8
commit
2b878e1a19
|
@ -472,13 +472,13 @@ export default {
|
||||||
let similar = `(http(s)?://)?${uri}/?`
|
let similar = `(http(s)?://)?${uri}/?`
|
||||||
|
|
||||||
const whitelist = ['news.ycombinator.com/item', 'bitcointalk.org/index.php']
|
const whitelist = ['news.ycombinator.com/item', 'bitcointalk.org/index.php']
|
||||||
const youtube = ['www.youtube.com', 'youtube.com', 'youtu.be']
|
const youtube = ['www.youtube.com', 'youtube.com', 'm.youtube.com', 'youtu.be']
|
||||||
if (whitelist.includes(uri)) {
|
if (whitelist.includes(uri)) {
|
||||||
similar += `\\${urlObj.search}`
|
similar += `\\${urlObj.search}`
|
||||||
} else if (youtube.includes(urlObj.hostname)) {
|
} else if (youtube.includes(urlObj.hostname)) {
|
||||||
// extract id and create both links
|
// extract id and create both links
|
||||||
const matches = url.match(/(https?:\/\/)?((www\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)(?<id>[_0-9a-z-]+)/i)
|
const matches = url.match(/(https?:\/\/)?((www\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)(?<id>[_0-9a-z-]+)/i)
|
||||||
similar = `(http(s)?://)?((www.)?youtube.com/watch\\?v=${matches?.groups?.id}|youtu.be/${matches?.groups?.id})`
|
similar = `(http(s)?://)?((www.|m.)?youtube.com/(watch\\?v=|v/)${matches?.groups?.id}|youtu.be/${matches?.groups?.id})((\\?|#)%)?`
|
||||||
} else {
|
} else {
|
||||||
similar += '((\\?|#)%)?'
|
similar += '((\\?|#)%)?'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue