New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

yt-api

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yt-api - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

2

package.json
{
"name": "yt-api",
"version": "0.1.3",
"version": "0.1.4",
"description": "A light weight, easy, and super fast way of interacting with the YouTube Data API v3.",

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

@@ -7,2 +7,5 @@ # Welcome to the yt-api a light weight, easy, and super fast way of interacting with the YouTube Data API v3.

# Need support?
You can join the official support discord [here](https://discord.gg/tXH4r37)
# Defining the api

@@ -40,2 +43,2 @@ ```javascript

//Returns Promise<SearchedVideoInfo> as a array
```
```
const snekfetch = require("snekfetch");
const utils = require("./Utils.js");
module.exports = class YouTubeAPI {
class YouTubeAPI {
constructor(ytKey) {

@@ -11,3 +11,3 @@ this.key = ytKey;

return new Promise(async (res, rej) => {
let apiResponse = await snekfetch.get(`https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics,liveStreamingDetails,contentDetails&id=${id}&key=${this.key}`);
let apiResponse = snekfetch.get(`https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics,liveStreamingDetails,contentDetails&id=${id}&key=${this.key}`);
let json = JSON.parse(apiResponse.text);

@@ -54,3 +54,3 @@ let data = json.items[0];

return new Promise(async (res, rej) => {
let apiResponse = await snekfetch.get(`https://www.googleapis.com/youtube/v3/search?part=id,snippet&q=${encodeURIComponent(search)}&type=video&key=${this.key}`);
let apiResponse = snekfetch.get(`https://www.googleapis.com/youtube/v3/search?part=id,snippet&q=${encodeURIComponent(search)}&type=video&key=${this.key}`);
let json = JSON.parse(apiResponse.text);

@@ -76,3 +76,3 @@ let data = json.items[0];

return new Promise(async (res, rej) => {
let apiResponse = await snekfetch.get(`https://www.googleapis.com/youtube/v3/search?part=id,snippet&q=${encodeURIComponent(search)}&type=video&maxResults=${maxResults}&key=${this.key}`);
let apiResponse = snekfetch.get(`https://www.googleapis.com/youtube/v3/search?part=id,snippet&q=${encodeURIComponent(search)}&type=video&maxResults=${maxResults}&key=${this.key}`);
let json = JSON.parse(apiResponse.text);

@@ -99,2 +99,3 @@ if(!json.items[0]) rej("No videos were found for this search!");

}
}
}
module.exports.API = YouTubeAPI;
const moment = require("moment");
exports.resolveDuration = (iso) => {
if(iso[0] !== "P")throw new Error("Invaild params.");
const time = iso.match(/P(?:(\d*)D)?T(?:(\d*)H)?(?:(\d*)M)?(?:(\d*)S)?/);

@@ -12,6 +11,6 @@ let d, h, m, s;

return {
d: d ? `${d}d ` : "",
h: h ? `${h}h ` : "",
m: m ? `${m}m ` : "",
s: s ? `${s}s` : ""
d: d ? `${d} ` : "",
h: h ? `${h} ` : "",
m: m ? `${m} ` : "",
s: s ? `${s}` : ""
}

@@ -22,3 +21,3 @@ };

let [ _, y, mm, d, h, m ] = iso.match(/(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):\d\d\.\d{3}Z/),
suffix = "am";
suffix = "am";

@@ -32,3 +31,3 @@ h = ~~h;

return `${mm} ${d} ${y} at ${h}:${m}${suffix}`;
return `${mm}/${d}/${y} at ${h}:${m}${suffix}`;
}

@@ -1,5 +0,6 @@

const api = require("../src/index.js");
declare module "yt-api" {
import { API } from "../src";
declare module "yt-api" {
export class api<string> {
export class api extends API<string> {
public constructor(ytKey: string);

@@ -6,0 +7,0 @@

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