Skip to content

Instantly share code, notes, and snippets.

@Krymancer
Created December 20, 2022 19:44
Show Gist options
  • Save Krymancer/d9bb259cfd98f4f5dc251abcc0827b4d to your computer and use it in GitHub Desktop.
Save Krymancer/d9bb259cfd98f4f5dc251abcc0827b4d to your computer and use it in GitHub Desktop.
signos
import { JSDOM } from "jsdom";
const url = 'https://gadget.horoscopovirtual.com.br/horoscopo';
async function getDocument() {
const response = await fetch(url);
const html = await response.text();
return html;
}
const html = await getDocument();
const dom = new JSDOM(html);
const result = Array.from(dom.window.document.querySelectorAll(".on > p")).map((x) => x.textContent);
const signs = result.map(x => x.split('\n')[1]);
console.log(signs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment