let id = window.location.pathname.replace("/movie/", "").split("-")[0] window.addDirectus = function addDirectus(id) { let ff = fetch(`https://api.themoviedb.org/3/movie/${id}?api_key=8e4c78c6e6fc2df4b056587478315548`).then(async res => { let body = await res.json() let { id, title, vote_average, runtime, poster_path, release_date } = body fetch(apix+"/items/movies", { "headers": { "content-type": "application/json", }, "body": JSON.stringify({ id, title, vote_average, runtime, poster_path, release_date }), "method": "POST", }).then(async res => { console.log(await res.json()); window.location.reload() }) }) } let apix = "https://directus.moosetape.site" fetch(apix + "/items/movies/" + id).then(async res => { if ('data' in await res.json() /*exist*/) { $(`



Adready added. Click here to edit data in Directus



${id}

` ).insertBefore(".movie_wrap"); } else { $(`





${id}

` ).insertBefore(".movie_wrap"); } })