From 6d4f1cb3c990c92a00f35ef84e5313842903a149 Mon Sep 17 00:00:00 2001 From: Siddhartha6909 <104570057+Siddhartha6909@users.noreply.github.com> Date: Sun, 15 Dec 2024 21:17:22 +0530 Subject: [PATCH] Updated --- about.php | 88 ++++++++ footer.html | 349 +++++++++++++++--------------- header.html | 275 +++++++++++++++--------- home.php | 580 ++++++++++++++++++++++++++++++++++++-------------- index.html | 8 +- mega.php | 437 +++++++++++++++++++++++++++++++++++++ player.php | 492 ++++++++++++++++++++++++------------------ schedule.php | 19 ++ spotlight.php | 17 ++ tohost.php | 2 +- watch.php | 451 ++++++++++++++++++++++++++------------- 11 files changed, 1935 insertions(+), 783 deletions(-) create mode 100644 about.php create mode 100644 mega.php create mode 100644 schedule.php create mode 100644 spotlight.php diff --git a/about.php b/about.php new file mode 100644 index 0000000..3f30956 --- /dev/null +++ b/about.php @@ -0,0 +1,88 @@ + + + + + + About Us - Anito + + + + + + + +
+

Website Details

+

Welcome to Anito, a platform built for anime lovers! This website is designed to let users watch and explore anime series with ease. We fetch content dynamically using APIs and provide features like most popular anime, scheduled releases, and related recommendations.

+

Disclaimer: This website is created for fun and educational purposes. It is not intended for professional or commercial use. The author and developers are not responsible for any misuse of this website or its content. Use it at your own discretion.

+ +

Author

+

Name: Siddhartha Tiwari

+

GitHub: github.com/Siddhartha6909

+

The project was developed as a fun way to explore web development, learn API integration, and create a platform for anime enthusiasts. It's not associated with any professional anime streaming services.

+ +

About the Website

+ + +

Note

+

This is a hobby project, and the data used is sourced from external APIs. We do not host or claim ownership of any anime content.

+
+ + + + + diff --git a/footer.html b/footer.html index 6dedf04..06e6936 100644 --- a/footer.html +++ b/footer.html @@ -2,180 +2,185 @@ - - + + diff --git a/header.html b/header.html index 6275a9e..05ea3ab 100644 --- a/header.html +++ b/header.html @@ -1,108 +1,193 @@ - + - -
-
-

Anime World

- -
- ☰ + +
+
+

Anito

+ + + +
-
- +
-
-
- - - - + + + + diff --git a/home.php b/home.php index 578b28e..b948331 100644 --- a/home.php +++ b/home.php @@ -41,165 +41,353 @@ - Anime World - Home + Anito - Home -
-
-
GitHub
-
-
- -
-

Latest Anime Episodes

-
- - - <?= htmlspecialchars($anime['name']) ?> -
+ +
+ +
- +
-

Spotlight Anime

+

Latest Anime Episodes

- + <?= htmlspecialchars($anime['name']) ?>

+

Sub: | Dub:

@@ -207,30 +395,104 @@
+ +
-

Estimated Schedules ()

-
- - -
-

-

Japanese Name:

-

Airing Time:

-

Seconds Until Airing:

- View Details -
- - -

No schedules available for .

- -
-
+

Estimated Schedules ()

+
+ + +
+

+

Japanese Name:

+ + + +

Airing Time:

+ + + +

Time Until Airing: (HH:MM)

+ + View Details +
+ + +

No schedules available for .

+ +
+ + + + + +
+
- + + + + diff --git a/index.html b/index.html index 89c88f3..56290ca 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Welcome to Anime Stream + Welcome to Anito + +
+
+ + + + +
+ + +
+
+ + + + [ + "start" => $introStart, + "end" => $introEnd + ], + "outro" => [ + "start" => $outroStart, + "end" => $outroEnd + ] + ]; + + $vttContent = "WEBVTT\n\n"; + foreach ($data as $chapter => $times) { + $start = secondsToWebVTT($times['start']); + $end = secondsToWebVTT($times['end']); + $title = ucfirst($chapter); + $vttContent .= "{$start} --> {$end}\n"; + $vttContent .= "{$title}\n\n"; + } + + echo ""; + echo ""; + ?> + + + +
+

Streaming Episodes for

+ + $group): ?> +
+

+ Episodes - +

+ +
+ + +
+ + + + + + + diff --git a/player.php b/player.php index 91a568c..65c42e2 100644 --- a/player.php +++ b/player.php @@ -22,275 +22,353 @@ die("Failed to fetch episode sources."); } -$videoUrl = $data['data']['sources'][0]['url']; // Use the first available source -$subtitles = $data['data']['tracks']; // Available subtitles -$introStart = $data['data']['intro']['start']; // Intro start time -$introEnd = $data['data']['intro']['end']; // Intro end time -$outroStart = $data['data']['outro']['start']; // Outro start time -$outroEnd = $data['data']['outro']['end']; // Outro end time +// Check if the response is not empty +if ($response !== false) { + $data = json_decode($response, true); + if (isset($data['data']['tracks'])) { + $tracks = $data['data']['tracks']; + foreach ($tracks as $track) { + if (isset($track['label']) && $track['label'] === 'English') { + $englishSubtitleUrl = $track['file']; + break; + } + } + } else { + echo "No tracks found in the API response."; + } +} else { + echo "Error fetching API response."; +} + +$videoUrl = $data['data']['sources'][0]['url']; +$subtitles = $data['data']['tracks'][0]['file']; +$introStart = $data['data']['intro']['start']; +$introEnd = $data['data']['intro']['end']; +$outroStart = $data['data']['outro']['start']; +$outroEnd = $data['data']['outro']['end']; + include 'header.html'; ?> - + - - - Watching Episode <?= htmlspecialchars($episodeId) ?> - - + + + + + + - - +.jwplayer .jw-icon-rewind, .jwplayer .jw-icon-next { + filter: invert(100%); +} -
-

Watching Episode

- -
- - - - -
-
- -

WELCOME TO SIDDHARTHA ANIME SITE
SITE IS IN DEVELOPMENT

-
- - + + [ + "start" => $introStart, + "end" => $introEnd + ], + "outro" => [ + "start" => $outroStart, + "end" => $outroEnd + ] + ]; + + $vttContent = "WEBVTT\n\n"; + foreach ($data as $chapter => $times) { + $start = secondsToWebVTT($times['start']); + $end = secondsToWebVTT($times['end']); + $title = ucfirst($chapter); + $vttContent .= "{$start} --> {$end}\n"; + $vttContent .= "{$title}\n\n"; } - function getCueFromVtt(vttData, currentTime) { - const cues = vttData.split('\n\n'); - for (let i = 0; i < cues.length; i++) { - let cue = cues[i].split('\n'); - if (cue.length > 1) { - let timeRange = cue[0].split(' --> '); - let startTime = parseVttTime(timeRange[0]); - let endTime = parseVttTime(timeRange[1]); - if (currentTime >= startTime && currentTime <= endTime) { - return { text: cue.slice(1).join(' ') }; - } + echo ""; + echo ""; + ?> + + + // Event listeners for category buttons + subBtn.addEventListener("click", () => switchCategory('sub')); + dubBtn.addEventListener("click", () => switchCategory('dub')); - + playerInstance.on("ready", function () { + console.log("JW Player is ready!"); + }); + + - + diff --git a/schedule.php b/schedule.php new file mode 100644 index 0000000..e610d26 --- /dev/null +++ b/schedule.php @@ -0,0 +1,19 @@ + diff --git a/spotlight.php b/spotlight.php new file mode 100644 index 0000000..0a80acc --- /dev/null +++ b/spotlight.php @@ -0,0 +1,17 @@ + false, 'message' => 'Failed to fetch spotlight data.'])); +} + +echo json_encode($data['data']['spotlightAnimes']); +?> diff --git a/tohost.php b/tohost.php index 342acbf..955dd06 100644 --- a/tohost.php +++ b/tohost.php @@ -1,4 +1,4 @@ diff --git a/watch.php b/watch.php index 15e65ed..4179abe 100644 --- a/watch.php +++ b/watch.php @@ -22,184 +22,347 @@ die("Failed to fetch episode sources."); } + +// Check if the response is not empty +if ($response !== false) { + // Decode the JSON response + $data = json_decode($response, true); // 'true' converts it to an associative array + + // Check if decoding was successful and the tracks exist + if (isset($data['data']['tracks'])) { + $tracks = $data['data']['tracks']; + + // Search for the English subtitle file + foreach ($tracks as $track) { + if (isset($track['label']) && $track['label'] === 'English') { + // Get the English subtitle file URL + $englishSubtitleUrl = $track['file']; + + // Print or return the subtitle URL + // echo "English Subtitle URL: " . $englishSubtitleUrl; + break; + } + } + } else { + echo "No tracks found in the API response."; + } +} else { + echo "Error fetching API response."; +} + + + $videoUrl = $data['data']['sources'][0]['url']; // Use the first available source -$subtitles = $data['data']['tracks']; // Available subtitles +$subtitles = $data['data']['tracks'][0]['file']; // Available subtitles $introStart = $data['data']['intro']['start']; // Intro start time $introEnd = $data['data']['intro']['end']; // Intro end time $outroStart = $data['data']['outro']['start']; // Outro start time $outroEnd = $data['data']['outro']['end']; // Outro end time + +//Print the times + // echo "Intro Start: $introStart, Intro End: $introEnd\n"; + // echo "Outro Start: $outroStart, Outro End: $outroEnd\n"; + + + include 'header.html'; ?> + - - - Watching Episode <?= htmlspecialchars($episodeId) ?> - - + + + + + + + - - +
+
+ + +
+ + + + [ + "start" => $introStart, // Intro start time in seconds + "end" => $introEnd // Intro end time in seconds + ], + "outro" => [ + "start" => $outroStart, // Outro start time in seconds + "end" => $outroEnd // Outro end time in seconds + ] +]; + +// Function to convert seconds to WebVTT timestamp format (HH:MM:SS.mmm) +function secondsToWebVTT($seconds) { + $hours = floor($seconds / 3600); + $minutes = floor(($seconds % 3600) / 60); + $seconds = round($seconds % 60, 3); + return sprintf("%02d:%02d:%06.3f", $hours, $minutes, $seconds); +} + +// Generate WebVTT content dynamically +$vttContent = "WEBVTT\n\n"; +foreach ($data as $chapter => $times) { + $start = secondsToWebVTT($times['start']); + $end = secondsToWebVTT($times['end']); + $title = ucfirst($chapter); // Capitalize the chapter name + $vttContent .= "{$start} --> {$end}\n"; + $vttContent .= "{$title}\n\n"; +} -
-

Watching Episode

- -
- - - - -
- - -
- - -
-
- -

WELCOME TO SIDDHARTHA ANIME SITE
SITE IS IN DEVELOPMENT

-
+// Output the WebVTT content to be used in the JW Player +echo ""; + +// Output the $data array as JSON for JavaScript +echo ""; +?> + + + + + +