Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ionic-youtube-streams

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ionic-youtube-streams - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

2

lib/lib/functions/utils.service.js

@@ -10,3 +10,3 @@ "use strict";

UtilsService.prototype.getHTMLWatchURL = function (id) {
var params = '?hl=en';
var params = '&hl=en';
return VIDEO_URL + id + params;

@@ -13,0 +13,0 @@ };

@@ -9,3 +9,3 @@ import { HTTP } from '@ionic-native/http/ngx';

findJSON(source: any, varName: any, body: any, left: any, right: any, prependJSON: string | undefined, utilsService: any): any;
getHTMLWatchPageBody(id: any, options: any, utilsService: any): Promise<any>;
getHTMLWatchPageBody(id: any, options: any, utilsService: any, httpClient: any): Promise<any>;
}

@@ -40,2 +40,3 @@ "use strict";

var utils_service_1 = require("./utils.service");
var siteCache = new Map();
var WatchHtmlService = /** @class */ (function () {

@@ -52,3 +53,3 @@ function WatchHtmlService(httpClient) {

utilsService = new utils_service_1.UtilsService();
return [4 /*yield*/, this.getHTMLWatchPageBody(id, options, utilsService)];
return [4 /*yield*/, this.getHTMLWatchPageBody(id, options, utilsService, this.httpClient)];
case 1:

@@ -83,3 +84,3 @@ body = _a.sent();

};
WatchHtmlService.prototype.getHTMLWatchPageBody = function (id, options, utilsService) {
WatchHtmlService.prototype.getHTMLWatchPageBody = function (id, options, utilsService, httpClient) {
return __awaiter(this, void 0, void 0, function () {

@@ -90,6 +91,10 @@ var url, response;

case 0:
if (!siteCache.get(id)) return [3 /*break*/, 1];
return [2 /*return*/, siteCache.get(id)];
case 1:
url = utilsService.getHTMLWatchURL(id);
return [4 /*yield*/, this.httpClient.get(url, {}, {})];
case 1:
return [4 /*yield*/, httpClient.get(url, {}, {})];
case 2:
response = _a.sent();
siteCache.set(id, response.data);
return [2 /*return*/, response.data];

@@ -96,0 +101,0 @@ }

@@ -40,2 +40,4 @@ "use strict";

var utils_service_1 = require("./utils.service");
var watch_html_service_1 = require("./watch-html.service");
var identityCache = new Map();
var WatchJsonService = /** @class */ (function () {

@@ -47,3 +49,3 @@ function WatchJsonService(httpClient) {

return __awaiter(this, void 0, void 0, function () {
var utilsService, url, ytApi, response, body, parsedBody, info;
var utilsService, url, ytApi, response, body, parsedBody, watchHtmlService, page, match, info;
return __generator(this, function (_a) {

@@ -56,6 +58,5 @@ switch (_a.label) {

return [4 /*yield*/, httpClient.get(ytApi, {}, {
'User-Agent': '',
'x-youtube-client-name': '1',
'x-youtube-client-version': '2.20201203.06.00',
'x-youtube-identity-token': '',
'x-youtube-identity-token': identityCache.get('browser') || '',
})];

@@ -66,2 +67,13 @@ case 1:

parsedBody = utilsService.parseJSON('watch.json', 'body', body);
if (!(parsedBody.reload === 'now')) return [3 /*break*/, 3];
watchHtmlService = new watch_html_service_1.WatchHtmlService(httpClient);
return [4 /*yield*/, watchHtmlService.getHTMLWatchPageBody(youtubeId, {}, utilsService, httpClient)];
case 2:
page = _a.sent();
match = page.match(/(["'])ID_TOKEN\1[:,]\s?"([^"]+)"/);
if (match) {
identityCache.set('browser', match && match[2]);
}
_a.label = 3;
case 3:
if (parsedBody.reload === 'now' || !Array.isArray(parsedBody)) {

@@ -68,0 +80,0 @@ throw Error('Unable to retrieve video metadata in watch.json');

@@ -80,3 +80,3 @@ "use strict";

_d = (_c = utilsService).getHTML5player;
return [4 /*yield*/, watchHtmlService.getHTMLWatchPageBody(youtubeId, options, utilsService)];
return [4 /*yield*/, watchHtmlService.getHTMLWatchPageBody(youtubeId, options, utilsService, httpClient)];
case 2:

@@ -83,0 +83,0 @@ _b = _d.apply(_c, [_g.sent()]);

{
"name": "ionic-youtube-streams",
"version": "1.0.8",
"version": "1.0.9",
"description": "Fetch meta information about YouTube videos including stream urls in ionic apps",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc