From 50306aff5db0e6fbd2217d5b9fba7aeadd1f873f Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Tue, 7 Feb 2023 23:08:09 +0100 Subject: [PATCH] Fix #34: Correct JSON files by putting first line in another metadata file --- main.cpp | 7 ++++--- website/channels.php | 8 +------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/main.cpp b/main.cpp index a7d38d9..1ab06d9 100644 --- a/main.cpp +++ b/main.cpp @@ -721,9 +721,10 @@ json getJson(unsigned short threadId, string url, bool usingYoutubeDataApiv3, st } ostringstream toString; - toString << CHANNELS_DIRECTORY << directoryPath << "/" << requestsPerChannelThreads[threadId] << ".json"; - requestsPerChannelThreads[threadId]++; - writeFile(threadId, toString.str(), "w", url + "\n" + content); + toString << CHANNELS_DIRECTORY << directoryPath << "/"; + writeFile(threadId, toString.str() + "urls.txt", "a", url + "\n"); + toString << requestsPerChannelThreads[threadId]++ << ".json"; + writeFile(threadId, toString.str(), "w", content); return data; } diff --git a/website/channels.php b/website/channels.php index 0ae9cfa..a061157 100644 --- a/website/channels.php +++ b/website/channels.php @@ -1,10 +1,5 @@