Skip to content

Commit 82af884

Browse files
committed
v0.5.1
1 parent c724acc commit 82af884

File tree

5 files changed

+42
-7
lines changed

5 files changed

+42
-7
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-video-url-parser",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"homepage": "https://github.com/Zod-/jsVideoUrlParser",
55
"main": "dist/jsVideoUrlParser.js",
66
"authors": [{

dist/jsVideoUrlParser.js

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,41 @@
211211
var parser = new urlParser();
212212
var base = parser;
213213

214+
function Allocine() {
215+
this.provider = 'allocine';
216+
this.alternatives = [];
217+
this.defaultFormat = 'embed';
218+
this.formats = {
219+
embed: this.createEmbedUrl
220+
};
221+
this.mediaTypes = {
222+
VIDEO: 'video'
223+
};
224+
}
225+
226+
Allocine.prototype.parseUrl = function (url) {
227+
var match = url.match(/(?:\/video\/player_gen_cmedia=)([A-Za-z0-9]+)/i);
228+
return match ? match[1] : undefined;
229+
};
230+
231+
Allocine.prototype.parse = function (url) {
232+
var result = {
233+
mediaType: this.mediaTypes.VIDEO,
234+
id: this.parseUrl(url)
235+
};
236+
return result.id ? result : undefined;
237+
};
238+
239+
Allocine.prototype.createEmbedUrl = function (vi) {
240+
if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
241+
return undefined;
242+
}
243+
244+
return 'https://player.allocine.fr/' + vi.id + '.html';
245+
};
246+
247+
base.bind(new Allocine());
248+
214249
var combineParams$1 = util.combineParams;
215250

216251
function CanalPlus() {
@@ -1374,7 +1409,7 @@
13741409
}
13751410

13761411
Ted.prototype.parseUrl = function (url, result) {
1377-
var match = url.match(/\/(talks|playlists\/(\d+))\/([\w-]+)/);
1412+
var match = url.match(/\/(talks|playlists\/(\d+))\/([\w-]+)/i);
13781413
var channel = match ? match[1] : undefined;
13791414

13801415
if (!channel) {
@@ -1471,7 +1506,7 @@
14711506
params: params,
14721507
mediaType: this.mediaTypes.VIDEO
14731508
};
1474-
var match = url.match(/(?:\/(\d+))?\/videos(?:\/.*?)?\/(\d+)/);
1509+
var match = url.match(/(?:\/(\d+))?\/videos(?:\/.*?)?\/(\d+)/i);
14751510

14761511
if (match) {
14771512
if (match[1]) {

0 commit comments

Comments
 (0)