I am looking to extract data from a website within a Vue application using Cheerio. However, I encountered the following error:
Uncaught (in promise) TypeError: $.find is not a function
Code
export default {
name: "App",
created() {
this.fetchUrl();
},
methods: {
fetchUrl() {
axios
.get("https://cors-anywhere.herokuapp.com/https://stackoverflow.com/")
.then(response => {
const $ = cheerio.load(response.data);
const span = $.find(".fs-headline2");
console.log(span);
});
}
}
};
Sandbox
In this scenario, my goal is to scrape the title 'For developers, by developers' from the homepage of Stack Overflow.