I have the current piece, which I want is to get the video´s URL, but it just shows an unstyled text.
async function start() {
let url = "https://www.tiktok.com/@tiagogreis/video/6830059644233223429";
let contentlist = document.querySelector("#content");
let data = await loadDataFromURL(url);
contentlist.innerHTML = data.html;
}
async function loadDataFromURL(url) {
let oembed = `https://www.tiktok.com/oembed?url=${url}`;
console.log("the oembed link", oembed);
let dataFromOembed = await fetch(oembed);
let data = await dataFromOembed.json();
if (data === undefined) {
throw Error("No data received from oembed");
}
console.log("the data from oembed", data);
return data;
}
start();
It is the video URL I want. Can you help, please?
You can use the
/embed/v2/:videoId
api. Like this: