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

simpleyt

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simpleyt - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

.idea/discord.xml

3

package.json

@@ -12,3 +12,2 @@ {

"main": "src/index.js",
"browser": "browser/index.js",
"homepage": "https://github.com/kimcore/simpleYT",

@@ -21,3 +20,3 @@ "bugs": {

"description": "Simple youtube search library without need of an api key",
"version": "1.0.4",
"version": "1.0.5",
"dependencies": {

@@ -24,0 +23,0 @@ "miniget": "^2.0.1"

@@ -11,2 +11,7 @@ # simpleYT

## Usage
If you intend to use this library in a browser, use jsDelivr:
```html
<script src="https://cdn.jsdelivr.net/gh/kimcore/simpleyt/browser/simpleyt.js"></script>
```
Or in Node.JS:
```js

@@ -16,6 +21,8 @@ const simpleYT = require('simpleyt')

simpleYT(query, {
filter: 'video', // Filter only videos
filter: 'video',
// Available filters: video, playlist
localAddress: '2001:470:1234:5678::a',
family: 6
// Other parameters are passed to miniget
// Other parameters are passed to miniget (https)
}).then(console.log)

@@ -27,16 +34,29 @@ ```

{
type: 'video',
identifier: 'iMTblJbmam4',
uri: 'https://www.youtube.com/watch?v=iMTblJbmam4',
title: "[ENG/CC][4K] JUSTHIS(저스디스)의 킬링벌스를 라이브로! I IndiGO, Diablo, Gone, DF KV Freestyle, That Ain't Real 등",
author: {
name: 'dingo freestyle',
profile: 'https://yt3.ggpht.com/a-/AOh14GiiLlR1duwARrL4IWqmVVZcuH-mdVnQLunfTw=s68-c-k-c0x00ffffff-no-rj-mo',
uri: 'https://www.youtube.com/user/nunnaamo'
type: 'video',
identifier: 'nPuHl_Hl2xI',
uri: 'https://www.youtube.com/watch?v=nPuHl_Hl2xI',
title: '12 HOURS LONG RELAX MUSIC - Relaxation, Meditation, Sleep and Spa Music by RELAX CHANNEL ☯188',
author: {
name: 'RELAX CHANNEL',
profile: 'https://yt3.ggpht.com/a-/AOh14GiqEKfh0k2lWpQVJU18CYULkb9XL2g8i7Jd2A=s68-c-k-c0x00ffffff-no-rj-mo',
uri: 'https://www.youtube.com/user/relaxvideoschannel'
},
length: { ms: 42888000, sec: 42888 },
isStream: false,
thumbnails: [ [Object], [Object], [Object], [Object] ]
},
length: { ms: 794000, sec: 794 },
isStream: false,
thumbnails: [ [Object], [Object], [Object], [Object] ]
},
...
...
{
type: 'playlist',
identifier: 'PLAhZL8hvPmBGp4RpHNHThexBegcjYxcC-',
uri: 'https://www.youtube.com/playlist?list=PLAhZL8hvPmBGp4RpHNHThexBegcjYxcC-',
title: 'The very long music playlist',
author: {
name: 'Humphreys Samuel',
uri: 'https://www.youtube.com/channel/UC0fAfWQXyTVN-R7NP0BWwGA'
},
count: 1000,
thumbnails: [ [Object], [Object], [Object], [Object], [Object] ]
},
...
]

@@ -43,0 +63,0 @@ ```

@@ -5,3 +5,3 @@ const miniget = require('miniget')

const response = await miniget(
'https://www.youtube.com/results?search_query=' + encodeURIComponent(query), options
'https://www.youtube.com/results?search_query=' + encodeURIComponent(query), {...options, ...{filter: undefined}}
).text()

@@ -15,3 +15,5 @@ const line = response.match(/window\["ytInitialData"]\s*=\s*(.*);+\n/)[0]

const type = Object.keys(video)[0].replace('Renderer', '')
return ['video', 'playlist'].includes(type)
if (options.filter === 'video') return type === 'video'
else if (options.filter === 'playlist') return type === 'playlist'
else return ['video', 'playlist'].includes(type)
}).map(video => {

@@ -63,7 +65,3 @@ const type = Object.keys(video)[0].replace('Renderer', '')

}
}).filter(it => {
if (options.filter === 'video') return it.type === 'video'
else if (options.filter === 'playlist') return it.type === 'playlist'
else return true
})
}

Sorry, the diff of this file is not supported yet

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