Skip to content

Commit 54657ca

Browse files
authored
Merge pull request #70 from Ahmad-AbuOsbeh/master
implemented Vimeo API for Unlisted videos
2 parents 82c48dc + 88c5c08 commit 54657ca

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

control/content/app.services.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,21 @@
4545
return {
4646
extractSingleVideoIdOrUserID: function (url) {
4747
var match = url.match(/(\.com)\/(.+)/);
48+
49+
if (match[2].split("/")[1]) {
50+
match[2]= match[2].split("/")[0] + ":" +match[2].split("/")[1]
51+
}
4852
var rgx = /\/.+\/?/g;
4953

5054
if (match && !rgx.test(match[2])) {
55+
// normal single videos : should send only the video id
5156
return match[2].split("/")[0];
57+
} else if (match && rgx.test(match[2])) {
58+
// this part for unlisted videos >> it should be sent like this "videoId:privacyHash">> sample: "528104478:257ef1e75a"
59+
return match[2].split("/")[0]+":"+match[2].split("/")[1];
5260
} else {
5361
return null;
5462
}
55-
5663
},
5764
extractFeedID: function (url) {
5865
var match = url.match(/(channels)\/(.+)/);

widget/app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@
8181
.filter('returnVimeoUrl', ['$sce', function ($sce) {
8282
return function (uri) {
8383
var id = uri.split("/").pop();
84+
85+
// this part for unlisted videos >> sample: https://player.vimeo.com/video/528104478/257ef1e75a
86+
// it should be sent like this > https://player.vimeo.com/video/528104478?h=257ef1e75a
87+
if (id.split(":")[1]) {
88+
id = id.split(":")[0] + "?h="+ id.split(":")[1]
89+
}
90+
8491
if(id.includes(':'))
8592
id = id.substr(0, id.indexOf(':'));
8693
return $sce.trustAsResourceUrl("https://player.vimeo.com/video/" + id);

0 commit comments

Comments
 (0)