Fix #34: Correct JSON files by putting first line in another metadata file
This commit is contained in:
parent
4fa433495b
commit
50306aff5d
7
main.cpp
7
main.cpp
@ -721,9 +721,10 @@ json getJson(unsigned short threadId, string url, bool usingYoutubeDataApiv3, st
|
|||||||
}
|
}
|
||||||
|
|
||||||
ostringstream toString;
|
ostringstream toString;
|
||||||
toString << CHANNELS_DIRECTORY << directoryPath << "/" << requestsPerChannelThreads[threadId] << ".json";
|
toString << CHANNELS_DIRECTORY << directoryPath << "/";
|
||||||
requestsPerChannelThreads[threadId]++;
|
writeFile(threadId, toString.str() + "urls.txt", "a", url + "\n");
|
||||||
writeFile(threadId, toString.str(), "w", url + "\n" + content);
|
toString << requestsPerChannelThreads[threadId]++ << ".json";
|
||||||
|
writeFile(threadId, toString.str(), "w", content);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function stripFirstLine($text)
|
|
||||||
{
|
|
||||||
return substr($text, strpos($text, "\n") + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('str_contains')) {
|
if (!function_exists('str_contains')) {
|
||||||
function str_contains($haystack, $needle)
|
function str_contains($haystack, $needle)
|
||||||
{
|
{
|
||||||
@ -19,8 +14,7 @@
|
|||||||
$uri = str_replace('/', '#', $uri);
|
$uri = str_replace('/', '#', $uri);
|
||||||
$uri = $prefix . $uri;
|
$uri = $prefix . $uri;
|
||||||
header('Content-Type: application/json; charset=UTF-8');
|
header('Content-Type: application/json; charset=UTF-8');
|
||||||
$content = file_get_contents("zip://$uri");
|
echo file_get_contents("zip://$uri");
|
||||||
echo stripFirstLine($content);
|
|
||||||
} else {
|
} else {
|
||||||
$uri = $prefix . $uri;
|
$uri = $prefix . $uri;
|
||||||
header("Content-Type: application/zip");
|
header("Content-Type: application/zip");
|
||||||
|
Loading…
Reference in New Issue
Block a user