videos - liberation of Kherson
Bad newsā¦
I may or may not have just deleted all the files on my website.
The good news is that I had a backup.
Oh .
Glad you have a backup (I really need to start taking those more)!
Something wrong with this code.
<p> Video results for ID <?php echo '' . htmlspecialchars($_POST["name"]) . ''; ?> </p>
<?php
function abbreviate_numbers(int $num)
{
$num_len = strlen($num);
switch ($num_len)
{
case 1:
return $num;
case 2:
return $num;
case 3:
return $num;
case 4:
return number_format($num, 0, ".", " ");
case 5:
return intval(substr($num, 0, -2)) / 10 . "K";
case 6:
return intdiv($num, 1000) . "K";
case 7:
return intval(substr($num, 0, -5)) / 10 . "M";
case 8:
return intval(substr($num, 0, -5)) / 10 . "M";
case 9:
return intdiv($num, 1000000) . "M";
case 10:
return intval(substr($num, 0, -8)) / 10 . "B";
case 11:
return intval(substr($num, 0, -8)) / 10 . "B";
case 12:
return intdiv($num, 1000000000) . "B";
case 13:
return intval(substr($num, 0, -11)) / 10 . "T";
case 14:
return intval(substr($num, 0, -11)) / 10 . "T";
case 15:
return intdiv($num, 1000000000000) . "T";
case 16:
return intval(substr($num, 0, -14)) / 10 . "Q";
case 17:
return intval(substr($num, 0, -14)) / 10 . "Q";
case 18:
return intdiv($num, 1000000000000000) . "Q";
default:
return number_format($num, 0, ".", " ");
}
}
$json = file_get_contents('https://returnyoutubedislikeapi.com/Votes?videoId=' . htmlspecialchars($_POST["name"]) . '&ref=coreyx');
$obj = json_decode($json);
$viddeleted = $obj->deleted;
if ($obj->deleted == true or $obj->status == 404)
{
include 'errorvid.php';
}
else
{
function get_youtube_title($video_id)
{
$html = 'https://www.googleapis.com/youtube/v3/videos?id=' . $video_id . '&key=AIzaSyBHRp-QtGP3uQkDQUXzMrHRiG-cxozG2K0&part=snippet,contentDetails,statistics,status&ref=coreyx';
$response = file_get_contents($html);
$decoded = json_decode($response, true);
foreach ($decoded['items'] as $items)
{
$title = $items['snippet']['title'];
return $title;
}
function get_youtube_description($video_id)
{
$html = 'https://www.googleapis.com/youtube/v3/videos?id=' . $video_id . '&key=AIzaSyBHRp-QtGP3uQkDQUXzMrHRiG-cxozG2K0&part=snippet,contentDetails,statistics,status&ref=coreyx';
$response = file_get_contents($html);
$decoded = json_decode($response, true);
foreach ($decoded['items'] as $items)
{
$title = $items['snippet']['description'];
return $title;
}
}
echo '<ul class="list-group">';
echo '<li class="list-group-item">Title: ' . get_youtube_title($_POST["name"]) . '</li>';
echo '<li class="list-group-item">Title: ' . get_youtube_description($_POST["name"]) . '</li>';
echo '<li class="list-group-item">Dislikes: ' . $obj->dislikes . '</li>';
echo '<li class="list-group-item">Likes: ' . $obj->likes . '</li>';
echo '<li class="list-group-item">Date created: ' . $obj->dateCreated . '</li>';
echo '<li class="list-group-item">Views: ' . $obj->viewCount . '</li>';
echo '</ul>';
}
?>
I get a hit Parse error: Unclosed '{' on line 57
Seems you forgot to close the last else
condition?
When presenting an issue, it is really helpful is if you explain what the code is supposed to do, how you tried to fix it, and what the error message is.
While we will help you if you throw random code at us, I will not dedicate a lot of time to it, and I wonāt take the time to correct the code myself, Iāll just tell you how to fix it.
Yes! Today, the only reason that the files got deleted was that I wanted to download them but I clicked delete. I didnāt notice until I looked at the logs.
This is what happens when you tell a smart person to look at the glass half full rather than half empty:
https://twitter.com/jenmsft/status/1589660325351419904?s=46&t=IcjrIj6YBZTKdui1q4KpBg
https://twitter.com/windows/status/1590705866834968576?s=46&t=IcjrIj6YBZTKdui1q4KpBg
https://twitter.com/kryzazzy/status/1589641579631104000?s=46&t=IcjrIj6YBZTKdui1q4KpBg
Is this a glitch:
Parse error : syntax error, unexpected end of file in /home/vol10_3/epizy.com/epiz_32972238/htdocs/result.php on line 89
Code:
<p> Video results for ID <?php echo '' . htmlspecialchars($_POST["name"]) . ''; ?> </p>
<?php
function abbreviate_numbers(int $num)
{
$num_len = strlen($num);
switch ($num_len)
{
case 1:
return $num;
case 2:
return $num;
case 3:
return $num;
case 4:
return number_format($num, 0, ".", " ");
case 5:
return intval(substr($num, 0, -2)) / 10 . "K";
case 6:
return intdiv($num, 1000) . "K";
case 7:
return intval(substr($num, 0, -5)) / 10 . "M";
case 8:
return intval(substr($num, 0, -5)) / 10 . "M";
case 9:
return intdiv($num, 1000000) . "M";
case 10:
return intval(substr($num, 0, -8)) / 10 . "B";
case 11:
return intval(substr($num, 0, -8)) / 10 . "B";
case 12:
return intdiv($num, 1000000000) . "B";
case 13:
return intval(substr($num, 0, -11)) / 10 . "T";
case 14:
return intval(substr($num, 0, -11)) / 10 . "T";
case 15:
return intdiv($num, 1000000000000) . "T";
case 16:
return intval(substr($num, 0, -14)) / 10 . "Q";
case 17:
return intval(substr($num, 0, -14)) / 10 . "Q";
case 18:
return intdiv($num, 1000000000000000) . "Q";
default:
return number_format($num, 0, ".", " ");
}
}
$json = file_get_contents('https://returnyoutubedislikeapi.com/Votes?videoId=' . htmlspecialchars($_POST["name"]) . '&ref=coreyx');
$obj = json_decode($json);
$viddeleted = $obj->deleted;
function get_youtube_title($video_id)
{
$html = 'https://www.googleapis.com/youtube/v3/videos?id=' . $video_id . '&key=AIzaSyBHRp-QtGP3uQkDQUXzMrHRiG-cxozG2K0&part=snippet,contentDetails,statistics,status&ref=coreyx';
$response = file_get_contents($html);
$decoded = json_decode($response, true);
foreach ($decoded['items'] as $items)
{
$title = $items['snippet']['title'];
return $title;
}
function get_youtube_description($video_id)
{
$html = 'https://www.googleapis.com/youtube/v3/videos?id=' . $video_id . '&key=AIzaSyBHRp-QtGP3uQkDQUXzMrHRiG-cxozG2K0&part=snippet,contentDetails,statistics,status&ref=coreyx';
$response = file_get_contents($html);
$decoded = json_decode($response, true);
foreach ($decoded['items'] as $items)
{
$title = $items['snippet']['description'];
return $title;
}
}
if ($obj->deleted == true or $obj->status == 404)
{
include 'errorvid.php';
}
else {
echo '<ul class="list-group">';
echo '<li class="list-group-item">Title: ' . get_youtube_title($_POST["name"]) . '</li>';
echo '<li class="list-group-item">Title: ' . get_youtube_description($_POST["name"]) . '</li>';
echo '<li class="list-group-item">Dislikes: ' . $obj->dislikes . '</li>';
echo '<li class="list-group-item">Likes: ' . $obj->likes . '</li>';
echo '<li class="list-group-item">Date created: ' . $obj->dateCreated . '</li>';
echo '<li class="list-group-item">Views: ' . $obj->viewCount . '</li>';
echo '</ul>';
}
echo '';
?>
The function get_youtube_title
with param $video_id
has not been closed
Finally Works
It liternally took me this long and this many tries to understand the difference between <
and >
, and which number I should add 120 to.
There were 4 possible ways I could do this:
+120 > x
+120 < x
x > +120
x < +120
But since two of those are the same, there are only really two possibilities:
+120 > x
+120 < x
So it took me 20 attempts and one hour to figure out which of those two options was the correct one.
I think I can actually call myself stupid at this point.
(And if you wanted to know the correct answer, it was +120 > x
)
Was gonna use Codecademy cheatsheets to keep on top of developing C when offline, but I think that this is so much better:
It has offline support!
Thanks for welcoming me back
Quick question, if I want to get a MOFH account for testing and maybe actually using it, can I do that?
Thatās what did, and what I am currently doing.
Alright, signing up now!
The process I am going through now:
- Write code
- Code does not work
- Add debugging code
- Code works
- Remove debugging code
- Code no longer works
- Repeat
Fixed it. Not going to tell you what I did wrong, it is much to embarrassing.
Happened to me before. Anything is possibleā¦