| 1 | <VideoSite> |
| 2 | <name>Vimeo</name> |
| 3 | <version>1.0</version> |
| 4 | <decoders> |
| 5 | <decoder>ffmpeg-m4v_audio-dec</decoder> |
| 6 | </decoders> |
| 7 | |
| 8 | <script type="text/javascript"> |
| 9 | <![CDATA[ |
| 10 | function canHandleURL(URL) { |
| 11 | if (URL.toLowerCase().match(/https?:\/\/vimeo.com\/(?:.*\/)*[0-9]+#?/)) return true; |
| 12 | else return false; |
| 13 | } |
| 14 | |
| 15 | function getVideoURL(html) { |
| 16 | var configURL = (html.match(/data-config-url="(.*?)"/), RegExp.$1.replace(/&/g, "&")); |
| 17 | var config = eval("(" + downloadURL(configURL) + ")"); |
| 18 | |
| 19 | if ('hd' in config.request.files.h264) return config.request.files.h264.hd.url; |
| 20 | else return config.request.files.h264.sd.url; |
| 21 | } |
| 22 | |
| 23 | function queryMetadata(html) { |
| 24 | var metadata = new Metadata(); |
| 25 | |
| 26 | metadata.title = (html.match(/"title":"(.*?)"[\},]/) ? RegExp.$1.replace(/\\/g, "") : null); |
| 27 | metadata.description = (html.match(/<div (?:.*?)itemprop="description"(?:.*?)>((?:.|\n|\r)*?)<\/div>/) ? RegExp.$1 : null); |
| 28 | |
| 29 | metadata.date = (html.match(/<meta itemprop="uploadDate" content="(.*?)T(?:.*?)">/) ? RegExp.$1 : null); |
| 30 | metadata.thumbnail = (html.match(/<link itemprop="thumbnailUrl" href="(.*?)">/) ? RegExp.$1 : null); |
| 31 | |
| 32 | metadata.uploader = (html.match(/"user":\{(?:.*?)"name":"(.*?)"[\},]/) ? RegExp.$1.replace(/\\/g, "") : null); |
| 33 | |
| 34 | return metadata; |
| 35 | } |
| 36 | ]]> |
| 37 | </script> |
| 38 | </VideoSite> |