r3hab commited on
Commit
90c5bd3
·
verified ·
1 Parent(s): e76a197

Upload 2.html

Browse files
Files changed (1) hide show
  1. 2.html +290 -132
2.html CHANGED
@@ -1,162 +1,320 @@
1
  <!DOCTYPE html>
2
- <html>
3
  <head>
4
- <meta charset="UTF-8">
5
- <title>WebTorrent video player</title>
 
6
  <style>
7
- #output video {
8
- width: 100%;
 
 
9
  }
10
- #progressBar {
11
- height: 5px;
12
- width: 0%;
13
- background-color: #35b44f;
14
- transition: width .4s ease-in-out;
 
 
 
15
  }
16
- body.is-seed .show-seed {
17
- display: inline;
 
 
 
18
  }
19
- body.is-seed .show-leech {
20
- display: none;
 
 
 
 
21
  }
22
- .show-seed {
23
- display: none;
 
 
 
 
24
  }
25
- #status code {
26
- font-size: 90%;
27
- font-weight: 700;
28
- margin-left: 3px;
29
- margin-right: 3px;
30
- border-bottom: 1px dashed rgba(255,255,255,0.3);
31
  }
32
 
33
- .is-seed {
34
- background-color: #154820;
35
- transition: .5s .5s background-color ease-in-out;
 
 
 
36
  }
37
- body {
38
- background-color: #2a3749;
39
- margin: 0;
40
- height: 100%;
 
 
 
 
 
 
41
  }
42
- #status {
 
 
 
43
  color: #fff;
44
- font-size: 17px;
45
- padding: 5px;
46
  }
47
- a:link, a:visited {
48
- color: #30a247;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  text-decoration: none;
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  </style>
52
  </head>
53
  <body>
54
- <div>
55
- <div id="progressBar"></div>
56
- <video id="output" controls></video>
57
- </div>
58
- <!-- Statistics -->
59
- <div id="status">
60
- <div>
61
- <span class="show-leech">Downloading </span>
62
- <span class="show-seed">Seeding </span>
63
- <code>
64
- <a id="torrentLink" href="https://webtorrent.io/torrents/sintel.torrent">sintel.torrent</a>
65
- </code>
66
- <span class="show-leech"> from </span>
67
- <span class="show-seed"> to </span>
68
- <code id="numPeers">0 peers</code>.
69
  </div>
70
- <div>
71
- <code id="downloaded"></code>
72
- of <code id="total"></code>
73
- — <span id="remaining"></span><br/>
74
- &#x2198;<code id="downloadSpeed">0 b/s</code>
75
- / &#x2197;<code id="uploadSpeed">0 b/s</code>
76
  </div>
77
  </div>
78
 
79
- <!-- Moment.js for time formatting -->
80
- <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script>
81
-
82
- <script type="module">
83
- // Updated WebTorrent import using proper ESM syntax
84
- import WebTorrent from 'https://cdn.skypack.dev/webtorrent'
85
-
86
- const torrentId = 'https://webtorrent.io/torrents/sintel.torrent'
87
- const client = new WebTorrent()
88
-
89
- // HTML elements
90
- const $body = document.body
91
- const $progressBar = document.querySelector('#progressBar')
92
- const $numPeers = document.querySelector('#numPeers')
93
- const $downloaded = document.querySelector('#downloaded')
94
- const $total = document.querySelector('#total')
95
- const $remaining = document.querySelector('#remaining')
96
- const $uploadSpeed = document.querySelector('#uploadSpeed')
97
- const $downloadSpeed = document.querySelector('#downloadSpeed')
98
-
99
- // Service Worker registration
100
- navigator.serviceWorker.register('https://cdn.jsdelivr.net/npm/webtorrent@latest/sw.min.js', { scope: './' })
101
- .then(reg => {
102
- const worker = reg.active || reg.waiting || reg.installing
103
- function checkState(worker) {
104
- if (worker.state === 'activated') {
105
- client.createServer({ controller: reg })
106
- download()
107
- }
108
- }
109
- if (!checkState(worker)) {
110
- worker.addEventListener('statechange', ({ target }) => checkState(target))
111
- }
112
- })
113
-
114
- function download() {
115
- client.add(torrentId, torrent => {
116
- const file = torrent.files.find(file => file.name.endsWith('.mp4'))
117
- file.streamTo(document.querySelector('#output'))
118
-
119
- torrent.on('done', onDone)
120
- setInterval(onProgress, 500)
121
- onProgress()
122
-
123
- function onProgress() {
124
- $numPeers.innerHTML = torrent.numPeers + (torrent.numPeers === 1 ? ' peer' : ' peers')
125
- const percent = Math.round(torrent.progress * 100 * 100) / 100
126
- $progressBar.style.width = percent + '%'
127
- $downloaded.innerHTML = prettyBytes(torrent.downloaded)
128
- $total.innerHTML = prettyBytes(torrent.length)
129
-
130
- let remaining
131
- if (torrent.done) {
132
- remaining = 'Done.'
133
- } else {
134
- remaining = moment.duration(torrent.timeRemaining / 1000, 'seconds').humanize()
135
- remaining = remaining[0].toUpperCase() + remaining.substring(1) + ' remaining.'
136
- }
137
- $remaining.innerHTML = remaining
138
-
139
- $downloadSpeed.innerHTML = prettyBytes(torrent.downloadSpeed) + '/s'
140
- $uploadSpeed.innerHTML = prettyBytes(torrent.uploadSpeed) + '/s'
141
- }
142
 
143
- function onDone() {
144
- $body.className += ' is-seed'
145
- onProgress()
146
- }
147
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
149
 
150
- function prettyBytes(num) {
151
- const units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
152
- const neg = num < 0
153
- if (neg) num = -num
154
- if (num < 1) return (neg ? '-' : '') + num + ' B'
155
- const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1)
156
- const unit = units[exponent]
157
- num = Number((num / Math.pow(1000, exponent)).toFixed(2))
158
- return (neg ? '-' : '') + num + ' ' + unit
 
 
159
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  </script>
161
  </body>
162
  </html>
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
  <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Movie Streamer</title>
7
  <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
  }
13
+
14
+ body {
15
+ font-family: Arial, sans-serif;
16
+ background-color: #1a1a1a;
17
+ color: white;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
  }
22
+
23
+ .header {
24
+ background-color: #2a2a2a;
25
+ padding: 20px 0;
26
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
27
  }
28
+
29
+ .header h1 {
30
+ text-align: center;
31
+ color: #007bff;
32
+ font-size: 2rem;
33
+ margin-bottom: 10px;
34
  }
35
+
36
+ .container {
37
+ max-width: 1200px;
38
+ margin: 0 auto;
39
+ padding: 20px;
40
+ flex: 1;
41
  }
42
+
43
+ .search-container {
44
+ text-align: center;
45
+ margin: 20px 0;
 
 
46
  }
47
 
48
+ #searchInput {
49
+ padding: 10px;
50
+ width: 300px;
51
+ border-radius: 5px;
52
+ border: none;
53
+ font-size: 16px;
54
  }
55
+
56
+ #searchButton {
57
+ padding: 10px 20px;
58
+ background-color: #007bff;
59
+ border: none;
60
+ border-radius: 5px;
61
+ color: white;
62
+ cursor: pointer;
63
+ margin-left: 10px;
64
+ font-size: 16px;
65
  }
66
+
67
+ .section-title {
68
+ font-size: 24px;
69
+ margin: 30px 0 20px 0;
70
  color: #fff;
 
 
71
  }
72
+
73
+ .movie-grid {
74
+ display: grid;
75
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
76
+ gap: 20px;
77
+ margin-top: 20px;
78
+ }
79
+
80
+ .movie-card {
81
+ background-color: #2a2a2a;
82
+ border-radius: 10px;
83
+ overflow: hidden;
84
+ cursor: pointer;
85
+ transition: transform 0.3s;
86
+ }
87
+
88
+ .movie-card:hover {
89
+ transform: scale(1.05);
90
+ }
91
+
92
+ .movie-poster {
93
+ width: 100%;
94
+ height: 300px;
95
+ object-fit: cover;
96
+ }
97
+
98
+ .movie-info {
99
+ padding: 10px;
100
+ }
101
+
102
+ .movie-info h4 {
103
+ margin-bottom: 8px;
104
+ font-size: 16px;
105
+ }
106
+
107
+ .movie-info p {
108
+ font-size: 14px;
109
+ color: #ccc;
110
+ line-height: 1.4;
111
+ }
112
+
113
+ .player-container {
114
+ margin-top: 20px;
115
+ aspect-ratio: 16/9;
116
+ }
117
+
118
+ #moviePlayer {
119
+ width: 100%;
120
+ height: 100%;
121
+ border: none;
122
+ border-radius: 10px;
123
+ }
124
+
125
+ .rating {
126
+ color: #ffd700;
127
+ margin-top: 8px;
128
+ font-weight: bold;
129
+ }
130
+
131
+ .footer {
132
+ background-color: #2a2a2a;
133
+ padding: 20px;
134
+ text-align: center;
135
+ margin-top: 40px;
136
+ }
137
+
138
+ .footer p {
139
+ color: #ccc;
140
+ font-size: 14px;
141
+ line-height: 1.6;
142
+ }
143
+
144
+ .footer a {
145
+ color: #007bff;
146
  text-decoration: none;
147
  }
148
+
149
+ .footer a:hover {
150
+ text-decoration: underline;
151
+ }
152
+
153
+ /* Mobile Responsiveness */
154
+ @media (max-width: 768px) {
155
+ .header h1 {
156
+ font-size: 1.5rem;
157
+ }
158
+
159
+ .container {
160
+ padding: 10px;
161
+ }
162
+
163
+ #searchInput {
164
+ width: calc(100% - 20px);
165
+ margin-bottom: 10px;
166
+ }
167
+
168
+ #searchButton {
169
+ width: calc(100% - 20px);
170
+ margin-left: 0;
171
+ }
172
+
173
+ .movie-grid {
174
+ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
175
+ gap: 15px;
176
+ }
177
+
178
+ .movie-poster {
179
+ height: 225px;
180
+ }
181
+
182
+ .movie-info h4 {
183
+ font-size: 14px;
184
+ }
185
+
186
+ .movie-info p {
187
+ font-size: 12px;
188
+ }
189
+
190
+ .section-title {
191
+ font-size: 20px;
192
+ margin: 20px 0 15px 0;
193
+ }
194
+ }
195
  </style>
196
  </head>
197
  <body>
198
+ <header class="header">
199
+ <h1>SlimShadow Movies</h1>
200
+ </header>
201
+
202
+ <div class="container">
203
+ <div class="search-container">
204
+ <input
205
+ type="text"
206
+ id="searchInput"
207
+ placeholder="Search for movies..."
208
+ />
209
+ <button id="searchButton">Search</button>
 
 
 
210
  </div>
211
+
212
+ <h2 class="section-title">Trending Movies</h2>
213
+ <div class="movie-grid" id="movieGrid"></div>
214
+
215
+ <div class="player-container">
216
+ <iframe id="moviePlayer" allowfullscreen></iframe>
217
  </div>
218
  </div>
219
 
220
+ <footer class="footer">
221
+ <p>
222
+ © 2024 SlimShadow Organization. All rights reserved.
223
+ </p>
224
+ <p>
225
+ This application is part of the SlimShadow Organization's suite of entertainment services.
226
+ Movie data provided by <a href="https://www.themoviedb.org" target="_blank">TMDB</a>.
227
+ </p>
228
+ <p>
229
+ For educational and demonstration purposes only. Not for commercial use.
230
+ </p>
231
+ </footer>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
 
233
+ <script>
234
+ const TMDB_API_KEY = 'c8402e1c7b8bb9bcbf95b3fa3bad4d84';
235
+ const movieGrid = document.getElementById('movieGrid');
236
+ const searchInput = document.getElementById('searchInput');
237
+ const searchButton = document.getElementById('searchButton');
238
+ const moviePlayer = document.getElementById('moviePlayer');
239
+
240
+ // Get trending movies
241
+ async function getTrendingMovies() {
242
+ try {
243
+ const response = await fetch(
244
+ `https://api.themoviedb.org/3/trending/movie/day?api_key=${TMDB_API_KEY}`
245
+ );
246
+ const data = await response.json();
247
+ return data.results;
248
+ } catch (error) {
249
+ console.error('Error fetching trending movies:', error);
250
+ }
251
  }
252
 
253
+ // Search movies
254
+ async function searchMovies(query) {
255
+ try {
256
+ const response = await fetch(
257
+ `https://api.themoviedb.org/3/search/movie?api_key=${TMDB_API_KEY}&query=${query}`
258
+ );
259
+ const data = await response.json();
260
+ return data.results;
261
+ } catch (error) {
262
+ console.error('Error searching movies:', error);
263
+ }
264
  }
265
+
266
+ // Display movies
267
+ function displayMovies(movies) {
268
+ movieGrid.innerHTML = '';
269
+ movies.forEach((movie) => {
270
+ const movieCard = document.createElement('div');
271
+ movieCard.className = 'movie-card';
272
+ movieCard.innerHTML = `
273
+ <img class="movie-poster"
274
+ src="https://image.tmdb.org/t/p/w500${movie.poster_path || ''}"
275
+ onerror="this.src='https://via.placeholder.com/500x750?text=No+Poster'"
276
+ alt="${movie.title}">
277
+ <div class="movie-info">
278
+ <h4>${movie.title}</h4>
279
+ <p>${movie.overview ? movie.overview.substring(0, 80) + '...' : 'No description available'}</p>
280
+ <div class="rating">★ ${movie.vote_average.toFixed(1)}</div>
281
+ </div>
282
+ `;
283
+
284
+ movieCard.addEventListener('click', () => playMovie(movie.id));
285
+ movieGrid.appendChild(movieCard);
286
+ });
287
+ }
288
+
289
+ // Play movie using vidsrc
290
+ function playMovie(tmdbId) {
291
+ moviePlayer.src = `https://vidsrc.in/embed/movie/${tmdbId}`;
292
+ }
293
+
294
+ // Event listeners
295
+ searchButton.addEventListener('click', async () => {
296
+ const query = searchInput.value;
297
+ if (query) {
298
+ const movies = await searchMovies(query);
299
+ displayMovies(movies);
300
+ }
301
+ });
302
+
303
+ searchInput.addEventListener('keypress', async (e) => {
304
+ if (e.key === 'Enter') {
305
+ const query = searchInput.value;
306
+ if (query) {
307
+ const movies = await searchMovies(query);
308
+ displayMovies(movies);
309
+ }
310
+ }
311
+ });
312
+
313
+ // Load trending movies on page load
314
+ window.addEventListener('load', async () => {
315
+ const trendingMovies = await getTrendingMovies();
316
+ displayMovies(trendingMovies);
317
+ });
318
  </script>
319
  </body>
320
  </html>