问题
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
回答1:
As far as I can tell, the scheme is just http://vimeo.com/A_NUMBER
, so try http://(www\.)?vimeo\.com/(\d+)
. If you don't need links to be prefixed by http://
, you can leave off the whole http://(www\.)
bit.
回答2:
Be careful: The url scheme is
http://vimeo.com/[SEVERAL_FOLDERS(opt.)]/[VIDEO_NUMBER]
for example:
http://vimeo.com/channels/staffpicks/48237094
http://vimeo.com/48237094
As you can see, it depends from what page the user copies the link from.
回答3:
Vimeo have 4 different public video links
- Video ID
vimeo.com/[Video ID]
- Channels
vimeo.com/channels/[Channel]/[Video ID]
- Groups
vimeo.com/groups/[Group]/[Video ID]
- Player
player.vimeo.com/video/[Video ID]
/(http|https)?:\/\/(www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)/
回答4:
Is there anything wrong with vimeo\.com/(\d)+
? Do you need the http://www.
?
回答5:
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
来源:https://stackoverflow.com/questions/5008609/vimeo-video-link-regex