-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
40 lines (37 loc) · 1.64 KB
/
script.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
let getRocket = () => {
fetch(`https://fdo.rocketlaunch.live/json/launches/next/5`)
.then(response => {
return response.json();
})
.then(data => {
console.log(data);
let missionName = document.getElementsByClassName("missionName");
let provider = document.getElementsByClassName("provider");
let country = document.getElementsByClassName("country");
let date = document.getElementsByClassName("date");
let discription = document.getElementsByClassName("discription");
let youtube = document.getElementsByClassName("youtube-link");
let title
for (let i = 0; i < missionName.length; i++) {
missionName[i].innerHTML = data["result"][i].name;
}
for (let i = 0; i < provider.length; i++) {
provider[i].innerHTML = data["result"][i].provider.name;
}
for (let i = 0; i < country.length; i++) {
country[i].innerHTML = data["result"][i].pad.location.country
}
for (let i = 0; i < date.length; i++) {
date[i].innerHTML = data["result"][i].date_str;
}
for (let i = 0; i < discription.length; i++) {
discription[i].innerHTML = data["result"][i].launch_description;
}
for (let i = 0; i < youtube.length; i++) {
title = data["result"][i].provider.name
console.log(title)
youtube[i].href = `https://www.youtube.com/results?search_query=${title}+rocket+live`
}
})
}
getRocket();