zohlathu 1.0.6 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +6 -5
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const Parser = require('rss-parser');
2
2
  const { htmlToText } = require('html-to-text');
3
- const ytSearch = require('yt-search');
3
+ const { Client } = require('youtubei');
4
+ const youtube = new Client();
4
5
 
5
6
  /**
6
7
  * Fetch lyrics for the given song query
@@ -19,15 +20,15 @@ async function get_lyrics(query) {
19
20
  let feed_url = "";
20
21
 
21
22
  try {
22
- const results = await ytSearch(query);
23
- const videos = results.videos;
23
+ const searchResults = await youtube.search(query, { type: "video" });
24
24
 
25
- if (!videos || videos.length === 0) {
25
+ if (!searchResults || !searchResults.items || searchResults.items.length === 0) {
26
26
  console.log(`No YouTube results found for query: ${query}`);
27
27
  return null;
28
28
  }
29
29
 
30
- const titlep = videos[0].title.substring(0, 100);
30
+ const video = searchResults.items[0];
31
+ const titlep = video.title.substring(0, 100);
31
32
  const search_query = titlep.replace(/ /g, '+');
32
33
  feed_url = `${base_url}?q=${search_query}`;
33
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zohlathu",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
4
4
  "description": "A Node.js package for fetching Mizo song lyrics from www.zohlathu.in",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,9 +21,9 @@
21
21
  "node": ">=14.0.0"
22
22
  },
23
23
  "dependencies": {
24
- "rss-parser": "^3.13.0",
25
24
  "html-to-text": "^9.0.5",
26
- "yt-search": "^2.13.1"
25
+ "rss-parser": "^3.13.0",
26
+ "youtubei": "^1.8.5"
27
27
  },
28
28
  "overrides": {
29
29
  "minimatch": "^5.0.0"