ionic-youtube-streams
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -51,3 +51,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var httpClient, tubeService, ciphService, params, ytApi, response, body, info, playErr, url, responseEmbeded, jsonStr, config, infoResponse, html5playerfile, tokens, funcs; | ||
var httpClient, tubeService, ciphService, params, watchPageURL, ytApi, response, body, info, playErr, url, responseEmbeded, jsonStr, config, infoResponse, html5playerfile, tokens, funcs; | ||
return __generator(this, function (_a) { | ||
@@ -59,5 +59,5 @@ switch (_a.label) { | ||
ciphService = new cip_service_1.CiphService(httpClient); | ||
params = 'hl=en'; | ||
ytApi = tubeService.VIDEO_URL + youtubeId + '&pbj=1&' + params + | ||
'&bpctr=' + Math.ceil(Date.now() / 1000); | ||
params = '?hl=en'; | ||
watchPageURL = tubeService.VIDEO_URL + youtubeId + params + '&bpctr=' + Math.ceil(Date.now() / 1000); | ||
ytApi = watchPageURL + "&pbj=1"; | ||
return [4 /*yield*/, httpClient.get(ytApi, {}, { | ||
@@ -67,2 +67,3 @@ 'User-Agent': '', | ||
'x-youtube-client-version': '2.20191008.04.01', | ||
'x-youtube-identity-token': '', | ||
})]; | ||
@@ -87,3 +88,3 @@ case 1: | ||
responseEmbeded = _a.sent(); | ||
jsonStr = tubeService.between(responseEmbeded.data, 't.setConfig({\'PLAYER_CONFIG\': ', '</script>'); | ||
jsonStr = tubeService.between(responseEmbeded.data, /(['"])PLAYER_(CONFIG|VARS)\1:\s?/, '</script>'); | ||
config = void 0; | ||
@@ -101,3 +102,4 @@ if (!jsonStr) { | ||
playErr = tubeService.playError(info, 'LOGIN_REQUIRED'); | ||
if (!config.args.player_response && !config.args.embedded_player_response && playErr) { | ||
if ((!config.args || (!config.args.player_response && !config.args.embedded_player_response)) && | ||
!config.embedded_player_response && playErr) { | ||
throw playErr; | ||
@@ -104,0 +106,0 @@ } |
@@ -82,3 +82,3 @@ "use strict"; | ||
moreinfo = querystring.parse(respo.data); | ||
player_response = moreinfo.args.player_response || info.playerResponse; | ||
player_response = moreinfo.player_response || info.playerResponse; | ||
_a.label = 2; | ||
@@ -140,8 +140,19 @@ case 2: | ||
YTubeService.prototype.between = function (haystack, left, right) { | ||
var pos = indexOf(haystack, left); | ||
if (pos === -1) { | ||
return ''; | ||
var pos; | ||
if (left instanceof RegExp) { | ||
var match = haystack.match(left); | ||
if (!match) { | ||
return ''; | ||
} | ||
pos = match.index + match[0].length; | ||
} | ||
haystack = haystack.slice(pos + left.length); | ||
pos = indexOf(haystack, right); | ||
else { | ||
pos = haystack.indexOf(left); | ||
if (pos === -1) { | ||
return ''; | ||
} | ||
pos += left.length; | ||
} | ||
haystack = haystack.slice(pos); | ||
pos = haystack.indexOf(right); | ||
if (pos === -1) { | ||
@@ -148,0 +159,0 @@ return ''; |
{ | ||
"name": "ionic-youtube-streams", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Fetch meta information about YouTube videos including stream urls in ionic apps", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193848
654