Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
enhancement(digiteka): add url pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Bourrousse committed Mar 22, 2018
1 parent 4fc642a commit a2f0a71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/providers/digiteka.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ const provider = {
// ex. http://www.ultimedia.com/default/index/videogeneric/id/5ss8kq
/^(?:https?:)?\/\/(?:www\.)?ultimedia\.com\/default\/index\/videogeneric\/id\/([^?&#/]+)/i,
// ex. http://www.digiteka.net/default/index/videogeneric/id/550sru
/^(?:https?:)?\/\/(?:www\.)?digiteka\.net\/default\/index\/videogeneric\/.*id\/([^?&#/]+)/i
/^(?:https?:)?\/\/(?:www\.)?digiteka\.net\/default\/index\/videogeneric\/id\/([^?&#/]+)/i,
// ex. http//www.ultimedia.com/deliver/generic/iframe/mdtk/01637594/zone/34/src/5lfqkv
/^(?:https?:)?\/\/(?:www\.)?ultimedia\.com\/deliver\/generic\/iframe\/mdtk\/(?:[^?&#/]+)\/zone\/(?:[^?&#/]+)\/src\/([^?&#/]+)/i
],

getThumbnailUrl: videoId => (
Expand Down
10 changes: 8 additions & 2 deletions test/providers/digiteka.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@ describe('Digiteka provider', () => {
});
});

it('should extract video id from ultimedia url', () => {
it('should extract video id from ultimedia url (1)', () => {
expect(digiteka.videoIdExtractRegExps[0].exec(
'http://www.ultimedia.com/default/index/videogeneric/id/5ss8kq'
)[1]).to.equal('5ss8kq');
});

it('should extract video id from digiteka url', () => {
it('should extract video id from digiteka url (2)', () => {
expect(digiteka.videoIdExtractRegExps[1].exec(
'http://www.digiteka.net/default/index/videogeneric/id/550sru'
)[1]).to.equal('550sru');
});

it('should extract video id from digiteka url (3)', () => {
expect(digiteka.videoIdExtractRegExps[2].exec(
'http://www.ultimedia.com/deliver/generic/iframe/mdtk/01637594/zone/34/src/550sru'
)[1]).to.equal('550sru');
});

it('should get thumbnail url', (done) => {
digiteka.getThumbnailUrl('8f3q8q')
.then((thumbnailUrl) => {
Expand Down

0 comments on commit a2f0a71

Please sign in to comment.