Fix for view-count

This commit is contained in:
Kasper Rynning-Tønnesen
2019-07-26 13:12:35 +02:00
parent 116a1e8905
commit bd9815927b

View File

@@ -89,7 +89,7 @@ var Suggestions = {
"&type=video&key=" +
api_key.youtube;
var video_urls =
"https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id,statistics&fields=pageInfo,items(id,contentDetails,snippet(categoryId,channelTitle,publishedAt,title,description,thumbnails))&key=" +
"https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id,statistics&fields=pageInfo,items(id,contentDetails,statistics(viewCount),snippet(categoryId,channelTitle,publishedAt,title,description,thumbnails))&key=" +
api_key.youtube +
"&id=";
@@ -125,29 +125,27 @@ var Suggestions = {
try {
viewCount = song.statistics.viewCount
.toString()
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
} catch (e) {}
try {
document
.getElementById("suggest-song-html")
.insertAdjacentHTML(
"beforeend",
List.generateSong(
{
id: video_id,
title: video_title,
length: length,
duration: duration,
votes: viewCount,
extra: "Views",
source: "youtube"
},
false,
false,
false
)
);
document.getElementById("suggest-song-html").insertAdjacentHTML(
"beforeend",
List.generateSong(
{
id: video_id,
title: video_title,
length: length,
duration: duration,
votes: viewCount,
extra: "Views",
source: "youtube"
},
false,
false,
false
)
);
} catch (e) {}
}
}