-
Notifications
You must be signed in to change notification settings - Fork 0
/
Netflix.html
489 lines (428 loc) · 19.1 KB
/
Netflix.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home | Netflix</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="Netflix.css">
<style>
* {
margin: 0;
padding: 0;
}
body {
font-family: 'Netflix Sans', sans-serif;
background-color: #111;
}
::-webkit-scrollbar {
width: 7px;
background-color: #111;
}
::-webkit-scrollbar-thumb {
background-color: white;
border-radius: 10px;
}
.nav {
position: fixed;
top: 0;
padding: 20px 40px;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
z-index: 1;
transition-timing-function: ease-in;
transition: all .5s;
}
.nav.active {
background-color: #111;
}
.nav_left {
margin-left: 10px;
}
.nav_logo {
width: 50px;
}
.nav_right {
position: fixed;
right: 30px;
display: flex;
margin-right: 10px;
}
.nav_avatar {
width: 40px;
}
#banner {
color: white;
object-fit: contain;
height: 644px;
background-position: center center;
background-size: cover;
}
#banner_contents {
margin-left: 70px;
padding-top: 340px;
height: 190px;
}
#banner_title {
font-size: 3rem;
font-weight: 800;
padding-bottom: 0.3rem;
}
#banner_description {
width: 45rem;
line-height: 1.5;
padding-top: 1rem;
font-size: .9rem;
max-width: 360px;
height: 80px;
}
#banner_button {
cursor: pointer;
color: white;
outline: none;
border: none;
font-weight: 700;
border-radius: .2vw;
padding-left: 2rem;
margin-top: 1rem;
margin-bottom: 1rem;
padding-right: 2rem;
margin-right: 1rem;
padding-top: .5rem;
background-color: rgba(51, 51, 51, .5);
padding-bottom: .5rem;
}
#banner_button:hover {
color: black;
background-color: #e6e6e6;
transition: all .3s;
}
#banner_fadeBottom {
height: 7.4rem;
background: linear-gradient(180deg,
transparent,
rgba(37, 37, 37, .61),
#111);
}
.row {
margin-left: 20px;
color: white;
}
.row_poster {
object-fit: contain;
width: 100%;
max-height: 120px;
margin-right: 10px;
transition: transform 500ms;
}
.row_poster::-webkit-scrollbar {
display: none;
}
.row_posters {
display: flex;
overflow-y: hidden;
overflow-x: scroll;
padding: 20px;
}
.row_poster:hover {
transform: scale(1.08);
}
.row_posterLarge,
.row_posterLarge1,
.row_posterLarge2 {
object-fit: contain;
width: 100%;
max-height: 250px;
margin-right: 10px;
transition: transform 500ms;
}
.row_posterLarge:hover,
.row_posterLarge1:hover,
.row_posterLarge2:hover {
transform: scale(1.09);
opacity: 1;
}
.default-ltr-cache-1d568uk {
width: 9.25rem;
height: 2.5rem;
color: rgb(229, 9, 20);
fill: currentColor;
display: block;
}
.default-ltr-cache-pnouz0 .ea3diy34,
.default-ltr-cache-pnouz0 .ea3diy34>select {
min-width: auto;
width: auto;
}
.default-ltr-cache-pnouz0 .ea3diy34 {
font-size: 1rem;
font-weight: 400;
color: rgb(255, 255, 255);
}
.default-ltr-cache-pnouz0 .ea3diy34 {
fill: currentColor;
min-width: 12.5rem;
}
.default-ltr-cache-pnouz0 .ea3diy34 {
padding: 0;
}
.default-ltr-cache-fmygl2 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
color: black;
fill: black;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
font-size: 13px;
font-weight: 400;
gap: 2px;
letter-spacing: normal;
line-height: 100%;
padding: 2px;
position: relative;
text-align: left;
z-index: 0;
}
.default-ltr-cache-1s6nle9 * {
box-sizing: border-box;
}
.default-ltr-cache-pnouz0 .ea3diy34,
.default-ltr-cache-pnouz0 .ea3diy34>select {
min-width: auto;
width: auto;
}
.default-ltr-cache-pnouz0 .ea3diy34>select {
line-height: 1.25rem;
padding-top: 0.375rem;
padding-right: calc(2.25rem + 0rem);
padding-bottom: 0.375rem;
padding-left: calc(0.625rem + 1rem + 0.5rem);
}
.default-ltr-cache-pnouz0 .ea3diy34>select {
color: inherit;
-webkit-filter: opacity(100%);
filter: opacity(100%);
}
.default-ltr-cache-pnouz0 .ea3diy34>select {
min-height: 16px;
min-width: 16px;
padding-right: 12px;
}
.default-ltr-cache-fmygl2>input,
.default-ltr-cache-fmygl2>select {
-webkit-animation: animation-14hycbg;
animation: animation-14hycbg;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
background: transparent;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 0 solid transparent;
color: inherit;
font: inherit;
letter-spacing: inherit;
line-height: inherit;
margin: 0;
min-width: 15px;
min-height: 15px;
padding: 0;
text-align: inherit;
-webkit-text-decoration: inherit;
text-decoration: inherit;
text-transform: inherit;
}
.default-ltr-cache-1s6nle9 * {
box-sizing: border-box;
}
button,
select {
text-transform: none;
}
button,
input,
optgroup,
select,
textarea {
color: inherit;
font: inherit;
margin: 0;
}
.default-ltr-cache-1vql4q4::after {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
-webkit-transition: inherit;
transition: inherit;
border-style: solid;
border-width: 0.0625rem;
border-radius: calc(0.25rem - 0.0625rem);
content: '';
border-color: rgba(0, 0, 0, 0);
}
.login-btn {
color: white;
background-color: #e50914;
padding: 6px;
border-radius: 4px;
font-size: 13px;
text-decoration: none;
font-family: Netflix Sans, Helvetica Neue, Segoe UI, Roboto, Ubuntu, sans-serif;
font-weight: 500;
}
.default-ltr-cache-pnouz0 .ea3diy34>select {
line-height: 1.25rem;
padding-top: 0.375rem;
padding-right: calc(2.25rem + 0rem);
padding-bottom: 0.375rem;
padding-left: calc(0.625rem + 1rem + 0.5rem);
}
</style>
<script>
// API key from TMDB
const api = "api_key=52908479c00e97f79a9f2a5135821ac4";
// base url of the site
const base_url = "https://api.themoviedb.org/3";
const banner_url = "https://image.tmdb.org/t/p/original";
const img_url = "https://image.tmdb.org/t/p/w500";
// requests for movies data
const requests = {
fetchTrending: `${base_url}/trending/all/week?${api}&language=en-US`,
fetchNetflixOrignals: `${base_url}/discover/tv?${api}&with_networks=213`,
fetchActionMovies: `${base_url}/discover/movie?${api}&with_genres=28`,
fetchHorrorMovies: `${base_url}/discover/movie?${api}&with_genres=27`,
fetchRomanceMovies: `${base_url}/discover/movie?${api}&with_genres=10749`,
fetchDocumentaries: `${base_url}/discover/movie?${api}&with_genres=99`,
};
// used to truncate the string
function truncate(str, n) {
return str?.length > n ? str.substr(0, n - 1) + "..." : str;
}
function handleFetch(url, rowTitle) {
fetch(url)
.then((res) => res.json())
.then((data) => {
console.log(data.results);
const headrow = document.getElementById("headrow");
const row = document.createElement("div");
row.className = "row";
headrow.appendChild(row);
const title = document.createElement("h2");
title.className = "row_title";
title.innerText = rowTitle;
row.appendChild(title);
const row_posters = document.createElement("div");
row_posters.className = "row_posters";
row.appendChild(row_posters);
data.results.forEach((movie) => {
const poster = document.createElement("img");
poster.className = rowTitle === "NETFLIX ORIGINALS" ? "row_posterLarge" : "row_poster";
poster.src = img_url + (movie.poster_path || movie.backdrop_path);
row_posters.appendChild(poster);
});
})
.catch((error) => console.error("Error fetching data:", error));
}
document.addEventListener("DOMContentLoaded", function () {
// Banner
fetch(requests.fetchNetflixOrignals)
.then((res) => res.json())
.then((data) => {
console.log(data.results);
const setMovie = data.results[Math.floor(Math.random() * data.results.length)];
const banner = document.getElementById("banner");
const banner_title = document.getElementById("banner_title");
const banner_desc = document.getElementById("banner_description");
banner.style.backgroundImage = `url(${banner_url}${setMovie.backdrop_path})`;
banner_desc.innerText = truncate(setMovie.overview, 150);
banner_title.innerText = setMovie.name || setMovie.title;
})
.catch((error) => console.error("Error fetching banner data:", error));
// Movie Rows
handleFetch(requests.fetchNetflixOrignals, "NETFLIX ORIGINALS");
handleFetch(requests.fetchTrending, "Top Rated");
handleFetch(requests.fetchActionMovies, "Action Movies");
handleFetch(requests.fetchHorrorMovies, "Horror Movies");
handleFetch(requests.fetchRomanceMovies, "Romance Movies");
handleFetch(requests.fetchDocumentaries, "Documentaries");
});
window.addEventListener("scroll", function () {
var nav = document.querySelector(".nav");
nav.classList.toggle("active", window.scrollY > 0);
});
</script>
</head>
<body>
<div class="nav">
<div class="nav_left">
<span class="default-ltr-cache-0 ev1dnif0" data-uia="nmhp-card-header+logo"><svg viewBox="0 0 111 30"
version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" role="img" class="default-ltr-cache-1d568uk ev1dnif2">
<g>
<path
d="M105.06233,14.2806261 L110.999156,30 C109.249227,29.7497422 107.500234,29.4366857 105.718437,29.1554972 L102.374168,20.4686475 L98.9371075,28.4375293 C97.2499766,28.1563408 95.5928391,28.061674 93.9057081,27.8432843 L99.9372012,14.0931671 L94.4680851,-5.68434189e-14 L99.5313525,-5.68434189e-14 L102.593495,7.87421502 L105.874965,-5.68434189e-14 L110.999156,-5.68434189e-14 L105.06233,14.2806261 Z M90.4686475,-5.68434189e-14 L85.8749649,-5.68434189e-14 L85.8749649,27.2499766 C87.3746368,27.3437061 88.9371075,27.4055675 90.4686475,27.5930265 L90.4686475,-5.68434189e-14 Z M81.9055207,26.93692 C77.7186241,26.6557316 73.5307901,26.4064111 69.250164,26.3117443 L69.250164,-5.68434189e-14 L73.9366389,-5.68434189e-14 L73.9366389,21.8745899 C76.6248008,21.9373887 79.3120255,22.1557784 81.9055207,22.2804387 L81.9055207,26.93692 Z M64.2496954,10.6561065 L64.2496954,15.3435186 L57.8442216,15.3435186 L57.8442216,25.9996251 L53.2186709,25.9996251 L53.2186709,-5.68434189e-14 L66.3436123,-5.68434189e-14 L66.3436123,4.68741213 L57.8442216,4.68741213 L57.8442216,10.6561065 L64.2496954,10.6561065 Z M45.3435186,4.68741213 L45.3435186,26.2498828 C43.7810479,26.2498828 42.1876465,26.2498828 40.6561065,26.3117443 L40.6561065,4.68741213 L35.8121661,4.68741213 L35.8121661,-5.68434189e-14 L50.2183897,-5.68434189e-14 L50.2183897,4.68741213 L45.3435186,4.68741213 Z M30.749836,15.5928391 C28.687787,15.5928391 26.2498828,15.5928391 24.4999531,15.6875059 L24.4999531,22.6562939 C27.2499766,22.4678976 30,22.2495079 32.7809542,22.1557784 L32.7809542,26.6557316 L19.812541,27.6876933 L19.812541,-5.68434189e-14 L32.7809542,-5.68434189e-14 L32.7809542,4.68741213 L24.4999531,4.68741213 L24.4999531,10.9991564 C26.3126816,10.9991564 29.0936358,10.9054269 30.749836,10.9054269 L30.749836,15.5928391 Z M4.78114163,12.9684132 L4.78114163,29.3429562 C3.09401069,29.5313525 1.59340144,29.7497422 0,30 L0,-5.68434189e-14 L4.4690224,-5.68434189e-14 L10.562377,17.0315868 L10.562377,-5.68434189e-14 L15.2497891,-5.68434189e-14 L15.2497891,28.061674 C13.5935889,28.3437998 11.906458,28.4375293 10.1246602,28.6868498 L4.78114163,12.9684132 Z">
</path>
</g>
</svg></span>
</div>
<div class="nav_right">
<div class="d-flex">
<span class="default-ltr-cache-1sk81mw e1emcujf0">
<div data-uia="language-picker-header+container"
class=" e1jlx6kl1 default-ltr-cache-pnouz0 ea3diy35"><label for=":R5ajalalbd:"
data-uia="language-picker-header+label" class="default-ltr-cache-1vw5kt6 ea3diy32"></label>
<div class="default-ltr-cache-fmygl2 ea3diy34">
<div role="img" aria-hidden="true" class="default-ltr-cache-xfvfnh e1vkmu653"><svg
xmlns="http://www.w3.org/2000/svg" fill="none" width="16" height="16"
viewBox="0 0 16 16" role="img" data-icon="LanguagesSmall" aria-hidden="true">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M10.7668 5.33333L10.5038 5.99715L9.33974 8.9355L8.76866 10.377L7.33333 14H9.10751L9.83505 12.0326H13.4217L14.162 14H16L12.5665 5.33333H10.8278H10.7668ZM10.6186 9.93479L10.3839 10.5632H11.1036H12.8856L11.6348 7.2136L10.6186 9.93479ZM9.52722 4.84224C9.55393 4.77481 9.58574 4.71045 9.62211 4.64954H6.41909V2H4.926V4.64954H0.540802V5.99715H4.31466C3.35062 7.79015 1.75173 9.51463 0 10.4283C0.329184 10.7138 0.811203 11.2391 1.04633 11.5931C2.55118 10.6795 3.90318 9.22912 4.926 7.57316V12.6667H6.41909V7.51606C6.81951 8.15256 7.26748 8.76169 7.7521 9.32292L8.31996 7.88955C7.80191 7.29052 7.34631 6.64699 6.9834 5.99715H9.06968L9.52722 4.84224Z"
fill="currentColor"></path>
</svg></div><select id=":R5ajalalbd:" name="LanguageSelect"
data-uia="language-picker-header">
<option lang="en" label="English" value="en-IN" selected="">English</option>
<option lang="hi" label="हिन्दी" value="hi-IN">हिन्दी</option>
</select>
<div aria-hidden="true" class="default-ltr-cache-emv211 ea3diy33"><svg
xmlns="http://www.w3.org/2000/svg" fill="none" width="16" height="16"
viewBox="0 0 16 16" role="img" data-icon="CaretDownSmall" aria-hidden="true">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M11.5976 6.5C11.7461 6.5 11.8204 6.67956 11.7154 6.78457L8.23574 10.2643C8.10555 10.3945 7.89445 10.3945 7.76425 10.2643L4.28457 6.78457C4.17956 6.67956 4.25393 6.5 4.40244 6.5H11.5976Z"
fill="currentColor"></path>
</svg></div>
</div>
</div>
</span>
<div data-layout="item" class=" default-ltr-cache-11adcsa ew2l6qe0">
<div style=" margin-left: 10px;"><a role="button"
class="login-btn e1ax5wel2 ew97par0 default-ltr-cache-1vql4q4 e1ff4m3w1" id="signIn"
data-uia="header-login-link" href="/in/login">Sign In</a></div>
</div>
</div>
</div>
</div>
<!-- Banner -->
<header id="banner">
<div id="banner_contents">
<h1 id="banner_title"></h1>
<div id="banner_buttons">
<button id="banner_button">Play</button>
<button id="banner_button">My List</button>
</div>
<p id="banner_description"></p>
</div>
<div id="banner_fadeBottom"></div>
</header>
<!-- Rows -->
<div id="headrow"></div>
</body>
</html>