This repository has been archived by the owner on Feb 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
movie.js
60 lines (51 loc) · 1.61 KB
/
movie.js
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
const apiURL="https://animescrapperr.herokuapp.com"
const animeUrl = window.location.search.match(/url=(.*)/)[1];
const info = document.querySelector('.info')
console.log(animeUrl)
search();
function search(){
const searchTerm=animeUrl;
getAnime(searchTerm).then(show)
}
function getAnime(searchTerm){
return fetch(`${apiURL}/anime?url=${searchTerm}`).then(
res=>res.json()
)
}
function show(results){
let temp=1;
results.forEach((e,i)=> {
if(e.num=="Episodio 1"){
info.innerHTML+=`
<div class=season-title><h3>Temporada `+ temp+`</h3></div>
`;
temp++;
}
info.innerHTML+=`
<div class="anime">
<div class="title-anime">
<a href="video.html?url=`+e.link+`">
<p>`+e.num+`</p>
</a>
</div>
<div class="info-anime">
<div class="img-anime">
<a href="video.html?url=`+e.link+`">
<img src="`+e.img+`">
</a>
</div>
</div>
</div>
`
console.log(e)
// const li=document.createElement('li');
// const img=document.createElement('img');
// img.src=movie.poster;
// const a = document.createElement('a');
// a.href = '/movie.html?url='+movie.url;
// a.textContent=movie.title;
// li.appendChild(a);
// li.appendChild(img);
// resultList.appendChild(li);
});
}