Spaces:
Running
Running
Update 2.html
Browse files
2.html
CHANGED
@@ -232,6 +232,7 @@
|
|
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');
|
@@ -241,7 +242,9 @@
|
|
241 |
async function getTrendingMovies() {
|
242 |
try {
|
243 |
const response = await fetch(
|
244 |
-
|
|
|
|
|
245 |
);
|
246 |
const data = await response.json();
|
247 |
return data.results;
|
@@ -254,7 +257,9 @@
|
|
254 |
async function searchMovies(query) {
|
255 |
try {
|
256 |
const response = await fetch(
|
257 |
-
|
|
|
|
|
258 |
);
|
259 |
const data = await response.json();
|
260 |
return data.results;
|
|
|
232 |
|
233 |
<script>
|
234 |
const TMDB_API_KEY = 'c8402e1c7b8bb9bcbf95b3fa3bad4d84';
|
235 |
+
const CORS_PROXY = 'https://api.allorigins.win/raw?url=';
|
236 |
const movieGrid = document.getElementById('movieGrid');
|
237 |
const searchInput = document.getElementById('searchInput');
|
238 |
const searchButton = document.getElementById('searchButton');
|
|
|
242 |
async function getTrendingMovies() {
|
243 |
try {
|
244 |
const response = await fetch(
|
245 |
+
`${CORS_PROXY}${encodeURIComponent(
|
246 |
+
`https://api.themoviedb.org/3/trending/movie/day?api_key=${TMDB_API_KEY}`
|
247 |
+
)}`
|
248 |
);
|
249 |
const data = await response.json();
|
250 |
return data.results;
|
|
|
257 |
async function searchMovies(query) {
|
258 |
try {
|
259 |
const response = await fetch(
|
260 |
+
`${CORS_PROXY}${encodeURIComponent(
|
261 |
+
`https://api.themoviedb.org/3/search/movie?api_key=${TMDB_API_KEY}&query=${query}`
|
262 |
+
)}`
|
263 |
);
|
264 |
const data = await response.json();
|
265 |
return data.results;
|