Skip to content

Instantly share code, notes, and snippets.

@juliandavidmr
Created February 24, 2019 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliandavidmr/31efe318bf1c42d564b051c1707b3ad1 to your computer and use it in GitHub Desktop.
Save juliandavidmr/31efe318bf1c42d564b051c1707b3ad1 to your computer and use it in GitHub Desktop.
Get a list of movies from Cinecalidad
function getDetailsMovie(htmlString) {
var div = document.createElement('div');
div.innerHTML = htmlString.trim();
div = div.querySelectorAll('#content_inside > .post_box');
var listMovies = [];
div.forEach(element => {
var a = element.querySelector("a")
if (a) {
listMovies.push(a.href)
}
});
return listMovies;
}
fetch("https://www.cinecalidad.to")
.then(response => {
if (response.status === 200) {
return response.text();
} else {
throw new Error('Something went wrong on api server!');
}
})
.then(response => {
console.log('Movies:', getDetailsMovie(response));
// ...
}).catch(error => {
console.error(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment