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=" + "&type=video&key=" +
api_key.youtube; api_key.youtube;
var video_urls = 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 + api_key.youtube +
"&id="; "&id=";
@@ -125,29 +125,27 @@ var Suggestions = {
try { try {
viewCount = song.statistics.viewCount viewCount = song.statistics.viewCount
.toString() .toString()
.replace(/\B(?=(\d{3})+(?!\d))/g, ","); .replace(/\B(?=(\d{3})+(?!\d))/g, " ");
} catch (e) {} } catch (e) {}
try { try {
document document.getElementById("suggest-song-html").insertAdjacentHTML(
.getElementById("suggest-song-html") "beforeend",
.insertAdjacentHTML( List.generateSong(
"beforeend", {
List.generateSong( id: video_id,
{ title: video_title,
id: video_id, length: length,
title: video_title, duration: duration,
length: length, votes: viewCount,
duration: duration, extra: "Views",
votes: viewCount, source: "youtube"
extra: "Views", },
source: "youtube" false,
}, false,
false, false
false, )
false );
)
);
} catch (e) {} } catch (e) {}
} }
} }