We need to access the HTML of a page if we want to collect data from a web page. We are using request so we can get the HTML of a page. Request is an npm package that allows us to send HTTP requests. To get started, we need to install two packages: Request and Cheerio. If you are using VS Code, I am assuming you know what you’re doing so I won’t dive into it too deep.Ĭreate your project, run npm init in your terminal, and also create an index.js file. This is the instruction set if you’re using VS Code. Skip the next section “VS Code Preparation” and head to “Installing Packages” to get started. And then you can name your project whatever you want. So it’s easy to get started.įor the template, select Node.js. You don’t have to install anything on your computer. Replit is an online IDE that can compile NodeJS. Otherwise, if you’re a beginner, head over to Replit. It will be extremely easy to follow along. If you already have NodeJS and VS Code installed, feel free to use that. If you don’t know what NodeJS, I encourage you to read my Introduction to NodeJS.īut for this project, I think we’re going to go an easier route so the process isn’t that extensive and intimidating. Usually, as shown in my Axios tutorial or React tutorial, I recommend installing Node.js and VS Code. To get started, we are going to need a few tools. Follow me and maybe you’ll see that tutorial in the near future. Personally, I used it to create an API - but that’s beyond the scope of this tutorial. ![]() For example, you can display it on your website. We are going to get the artist’s name, their rank, and their monthly listeners.Īfter we collect this data, you can do whatever you want with it. The data is going to change as time goes on. This table shows Spotify’s top artists with the most monthly listeners (obviously for the past 30 days).
0 Comments
Leave a Reply. |