n8n-nodes-youtube-transcript
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ "use strict"; | ||
const n8n_workflow_1 = require("n8n-workflow"); | ||
const youtube_transcript_1 = require("youtube-transcript"); | ||
const youtube_captions_scraper_1 = require("youtube-captions-scraper"); | ||
class YoutubeTranscriptNode { | ||
@@ -30,2 +30,18 @@ constructor() { | ||
{ | ||
displayName: 'Language', | ||
name: 'language', | ||
type: 'string', | ||
default: 'en', | ||
description: 'Enter the language code (for example, "en" for English)', | ||
placeholder: 'language code ', | ||
}, | ||
{ | ||
displayName: 'Fallback Language', | ||
name: 'fallbackLanguage', | ||
type: 'string', | ||
default: 'en', | ||
description: 'Enter the fallback language code (for example, "en" for English) to be used if the video does not support the selected language', | ||
placeholder: 'fallback language code', | ||
}, | ||
{ | ||
displayName: 'Return Merged Text', | ||
@@ -44,2 +60,4 @@ name: 'returnMergedText', | ||
let returnMergedText; | ||
let language; | ||
let fallbackLanguage; | ||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) { | ||
@@ -49,3 +67,17 @@ try { | ||
returnMergedText = this.getNodeParameter('returnMergedText', itemIndex, false); | ||
let transcript = await youtube_transcript_1.YoutubeTranscript.fetchTranscript(youtubeId); | ||
language = this.getNodeParameter('language', itemIndex, 'en'); | ||
fallbackLanguage = this.getNodeParameter('fallbackLanguage', itemIndex, 'en'); | ||
let transcript; | ||
try { | ||
transcript = await (0, youtube_captions_scraper_1.getSubtitles)({ | ||
videoID: youtubeId, | ||
lang: language, | ||
}); | ||
} | ||
catch (e) { | ||
transcript = await (0, youtube_captions_scraper_1.getSubtitles)({ | ||
videoID: youtubeId, | ||
lang: fallbackLanguage, | ||
}); | ||
} | ||
if (returnMergedText) { | ||
@@ -69,4 +101,4 @@ let text = ''; | ||
text: chunk.text, | ||
offset: chunk.offset, | ||
duration: chunk.duration, | ||
offset: chunk.start, | ||
duration: chunk.dur, | ||
}, | ||
@@ -73,0 +105,0 @@ pairedItem: { item: itemIndex }, |
{ | ||
"name": "n8n-nodes-youtube-transcript", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "download transcript of youtube videos in your n8n workflows", | ||
@@ -24,2 +24,3 @@ "keywords": [ | ||
"scripts": { | ||
"preinstall": "npx only-allow pnpm", | ||
"build": "tsc && gulp build:icons", | ||
@@ -30,3 +31,3 @@ "dev": "tsc --watch", | ||
"lintfix": "eslint nodes package.json --fix", | ||
"prepublishOnly": "npm run build && npm run lint -c .eslintrc.prepublish.js nodes package.json" | ||
"prepublishOnly": "pnpm build && pnpm lint -c .eslintrc.prepublish.js nodes package.json" | ||
}, | ||
@@ -44,15 +45,16 @@ "files": [ | ||
"devDependencies": { | ||
"@types/express": "^4.17.6", | ||
"@types/request-promise-native": "~1.0.15", | ||
"@typescript-eslint/parser": "~5.45", | ||
"eslint-plugin-n8n-nodes-base": "^1.11.0", | ||
"@typescript-eslint/parser": "^7.15.0", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-n8n-nodes-base": "^1.16.1", | ||
"gulp": "^4.0.2", | ||
"n8n-core": "*", | ||
"n8n-workflow": "*", | ||
"prettier": "^2.7.1", | ||
"typescript": "~4.8.4" | ||
"prettier": "^3.3.2", | ||
"typescript": "^5.5.3" | ||
}, | ||
"peerDependencies": { | ||
"n8n-workflow": "*" | ||
}, | ||
"dependencies": { | ||
"youtube-transcript": "^1.2.1" | ||
"youtube-captions-scraper": "^2.0.3" | ||
} | ||
} |
{ | ||
"name": "n8n-nodes-youtube-transcript", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "download transcript of youtube videos in your n8n workflows", | ||
@@ -24,2 +24,3 @@ "keywords": [ | ||
"scripts": { | ||
"preinstall": "npx only-allow pnpm", | ||
"build": "tsc && gulp build:icons", | ||
@@ -30,3 +31,3 @@ "dev": "tsc --watch", | ||
"lintfix": "eslint nodes package.json --fix", | ||
"prepublishOnly": "npm run build && npm run lint -c .eslintrc.prepublish.js nodes package.json" | ||
"prepublishOnly": "pnpm build && pnpm lint -c .eslintrc.prepublish.js nodes package.json" | ||
}, | ||
@@ -44,15 +45,16 @@ "files": [ | ||
"devDependencies": { | ||
"@types/express": "^4.17.6", | ||
"@types/request-promise-native": "~1.0.15", | ||
"@typescript-eslint/parser": "~5.45", | ||
"eslint-plugin-n8n-nodes-base": "^1.11.0", | ||
"@typescript-eslint/parser": "^7.15.0", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-n8n-nodes-base": "^1.16.1", | ||
"gulp": "^4.0.2", | ||
"n8n-core": "*", | ||
"n8n-workflow": "*", | ||
"prettier": "^2.7.1", | ||
"typescript": "~4.8.4" | ||
"prettier": "^3.3.2", | ||
"typescript": "^5.5.3" | ||
}, | ||
"peerDependencies": { | ||
"n8n-workflow": "*" | ||
}, | ||
"dependencies": { | ||
"youtube-transcript": "^1.2.1" | ||
"youtube-captions-scraper": "^2.0.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
7
-22.22%130
32.65%41835
-30.91%2
100%2
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed