flux-dl 1.0.7 → 1.0.8
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.
- package/package.json +1 -1
- package/src/VideoDownloader.js +30 -0
- package/src/platforms/youtube.js +2 -0
package/package.json
CHANGED
package/src/VideoDownloader.js
CHANGED
|
@@ -137,6 +137,36 @@ class VideoDownloader {
|
|
|
137
137
|
return { filepath, info };
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Get audio stream without saving to file
|
|
142
|
+
* Returns a readable stream that can be piped or consumed directly
|
|
143
|
+
* @param {string} url - Video URL
|
|
144
|
+
* @param {function} onProgress - Optional progress callback (percent, downloaded, total)
|
|
145
|
+
* @returns {Promise<{stream: ReadableStream, info: Object}>}
|
|
146
|
+
*/
|
|
147
|
+
async getAudioStream(url, onProgress = null) {
|
|
148
|
+
const info = await this.getVideoInfo(url);
|
|
149
|
+
|
|
150
|
+
if (!info.videoUrl) {
|
|
151
|
+
throw new Error('No download URL available');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
console.log(`Streaming audio: ${info.title}`);
|
|
155
|
+
console.log(`Quality: ${info.quality}`);
|
|
156
|
+
|
|
157
|
+
// Nutze Browser Emulation mit Cookies
|
|
158
|
+
const referer = `https://www.youtube.com/watch?v=${info.videoId}`;
|
|
159
|
+
|
|
160
|
+
const stream = await this.browser.downloadStream(info.videoUrl, referer, onProgress);
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
stream,
|
|
164
|
+
info,
|
|
165
|
+
contentType: 'audio/mpeg',
|
|
166
|
+
filename: this.sanitizeFilename(info.title) + '.mp3'
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
140
170
|
selectAudioFormat(formats) {
|
|
141
171
|
// Nutze InnerTube Helper falls verfügbar
|
|
142
172
|
if (this.detectPlatform && formats.length > 0) {
|
package/src/platforms/youtube.js
CHANGED
|
@@ -53,6 +53,7 @@ module.exports = {
|
|
|
53
53
|
duration: parseInt(data.videoDetails.lengthSeconds),
|
|
54
54
|
thumbnail: bestThumbnail,
|
|
55
55
|
author: data.videoDetails.author,
|
|
56
|
+
description: data.videoDetails.shortDescription || data.videoDetails.description || '',
|
|
56
57
|
viewCount: parseInt(data.videoDetails.viewCount || 0),
|
|
57
58
|
likeCount: parseInt(data.videoDetails.likeCount || 0),
|
|
58
59
|
uploadDate: data.videoDetails.uploadDate || data.videoDetails.publishDate || null,
|
|
@@ -140,6 +141,7 @@ module.exports = {
|
|
|
140
141
|
duration: parseInt(videoDetails.lengthSeconds),
|
|
141
142
|
thumbnail: bestThumbnail,
|
|
142
143
|
author: videoDetails.author,
|
|
144
|
+
description: videoDetails.shortDescription || videoDetails.description || '',
|
|
143
145
|
viewCount: parseInt(videoDetails.viewCount || 0),
|
|
144
146
|
likeCount: parseInt(videoDetails.likeCount || 0),
|
|
145
147
|
uploadDate: videoDetails.uploadDate || videoDetails.publishDate || null,
|