File tree Expand file tree Collapse file tree 5 files changed +42
-7
lines changed
Expand file tree Collapse file tree 5 files changed +42
-7
lines changed Original file line number Diff line number Diff line change 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" : [{
Original file line number Diff line number Diff line change 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 ( / (?: \/ v i d e o \/ p l a y e r _ g e n _ c m e d i a = ) ( [ A - Z a - z 0 - 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 ( ) {
13741409 }
13751410
13761411 Ted . prototype . parseUrl = function ( url , result ) {
1377- var match = url . match ( / \/ ( t a l k s | p l a y l i s t s \/ ( \d + ) ) \/ ( [ \w - ] + ) / ) ;
1412+ var match = url . match ( / \/ ( t a l k s | p l a y l i s t s \/ ( \d + ) ) \/ ( [ \w - ] + ) / i ) ;
13781413 var channel = match ? match [ 1 ] : undefined ;
13791414
13801415 if ( ! channel ) {
14711506 params : params ,
14721507 mediaType : this . mediaTypes . VIDEO
14731508 } ;
1474- var match = url . match ( / (?: \/ ( \d + ) ) ? \/ v i d e o s (?: \/ .* ?) ? \/ ( \d + ) / ) ;
1509+ var match = url . match ( / (?: \/ ( \d + ) ) ? \/ v i d e o s (?: \/ .* ?) ? \/ ( \d + ) / i ) ;
14751510
14761511 if ( match ) {
14771512 if ( match [ 1 ] ) {
You can’t perform that action at this time.
0 commit comments