Vimeo 视频链接正则表达式
有人得到了 vimeo 视频链接的正则表达式,可以从 pragraph 中提取它们以在 php 中使用吗?似乎无法找到适合最新 vimeo url 方案的合适方案
Anybody got the regex for vimeo video links to extract them from a pragraph for use in php? Can't seem to find a proper one for the latest vimeo url scheme
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Vimeo 有 4 个不同的公共视频链接
vimeo.com/[Video ID]
vimeo.com/channels/[Channel]/[Video ID]
vimeo.com/groups/[组]/[视频 ID]
player.vimeo.com/video/[视频 ID]
/(http|https)?:\ /\/(www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\ /|视频\/|)(\d+)(?:|\/\?)/
Vimeo have 4 different public video links
vimeo.com/[Video ID]
vimeo.com/channels/[Channel]/[Video ID]
vimeo.com/groups/[Group]/[Video ID]
player.vimeo.com/video/[Video ID]
/(http|https)?:\/\/(www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)/
这涵盖了所有可能的 Vimeo 视频 URL 方案:
在此处测试:
https://regexr.com/68gk3
This one covers all possible Vimeo Video URL Schemes:
Test here:
https://regexr.com/68gk3
据我所知,该方案只是
http://vimeo.com/A_NUMBER
,因此请尝试http://(www\.)?vimeo\.com/(\ d+)
。如果您不需要以http://
为链接前缀,则可以省略整个http://(www\.)
位。As far as I can tell, the scheme is just
http://vimeo.com/A_NUMBER
, so tryhttp://(www\.)?vimeo\.com/(\d+)
. If you don't need links to be prefixed byhttp://
, you can leave off the wholehttp://(www\.)
bit.注意: url 方案例如
:
如您所见,这取决于用户从哪个页面复制链接。
Be careful: The url scheme is
for example:
As you can see, it depends from what page the user copies the link from.
vimeo\.com/(\d)+
有什么问题吗?您需要http://www.
吗?Is there anything wrong with
vimeo\.com/(\d)+
? Do you need thehttp://www.
?最好向 viemo 人员询问,因为他们更了解,如果他们更改任何内容,他们会在他们的 api
实时示例中反映它:
http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/76979871
API 文档:http://developer.vimeo.com/apis/oembed
受此启发的答案 https://stackoverflow.com/a/17156853/1545904
It's Better to ask viemo guys about it because they know better and if they change anything they will reflect it in their apis
Live Example :
http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/76979871
API docs : http://developer.vimeo.com/apis/oembed
Answer inspired from this one https://stackoverflow.com/a/17156853/1545904