mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-20 04:51:16 +00:00
Include available video qualities to metadata
The playerResponse streamingData adaptiveFormats are filter to include only those which include a qualityLabel. This array is then mapped to an array of qualityLabels and sorted from lowest to highest quality.
This commit is contained in:
@@ -141,6 +141,7 @@ module.exports = {
|
||||
metadata.publish_date = data.microformat.playerMicroformatRenderer.publishDate || 'N/A';
|
||||
metadata.upload_date = data.microformat.playerMicroformatRenderer.uploadDate || 'N/A';
|
||||
metadata.keywords = data.videoDetails.keywords || [];
|
||||
metadata.available_qualities = [...new Set(data[2].playerResponse.streamingData.adaptiveFormats.filter(v => v.qualityLabel).map(v => v.qualityLabel).sort((a, b) => +a.replace(/\D/gi, "") - +b.replace(/\D/gi, "")))]
|
||||
|
||||
video_details.id = data.videoDetails.videoId;
|
||||
video_details.title = data.videoDetails.title;
|
||||
@@ -169,6 +170,7 @@ module.exports = {
|
||||
metadata.publish_date = data[2].playerResponse.microformat.playerMicroformatRenderer.publishDate;
|
||||
metadata.upload_date = data[2].playerResponse.microformat.playerMicroformatRenderer.uploadDate;
|
||||
metadata.keywords = data[2].playerResponse.videoDetails.keywords;
|
||||
metadata.available_qualities = [...new Set(data[2].playerResponse.streamingData.adaptiveFormats.filter(v => v.qualityLabel).map(v => v.qualityLabel).sort((a, b) => +a.replace(/\D/gi, "") - +b.replace(/\D/gi, "")))]
|
||||
|
||||
video_details.id = data[2].playerResponse.videoDetails.videoId;
|
||||
video_details.title = data[2].playerResponse.videoDetails.title;
|
||||
|
||||
Reference in New Issue
Block a user