Lessons: 18Length: 1.7 hours

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

3.5 Creating the Setup Data for Your Skill

So as I mentioned before, the basic concept of this skill is to be able to get a current list of new courses on Tuts+, or at least the most recent courses on Tuts+, that you can find when you go to tutsplus.com. Go under Courses and select Code. And what you will get is basically what you see here. Now, obviously, depending on when you are watching this course this list could be very different, and that's okay. But for the basics, what we wanna be able to do is to get the courses that are listed on this front page, with their titles, with their teaser descriptions, with their author. And you can add more things too, you could add in the publication date, you could add in the duration, how long they are, things like that. And you can even go as far as adding the full description that you would find if you were to click on each one of these courses. Now I will kind of create a space for that, and I'm not gonna do that for this particular course, but you can definitely take it to that level if you want to enhance it yourself. So now what we want to do is we want to kind of model this idea, or the fact that we have a list of these new courses, or the latest courses, from Tuts+. And we wanna take that concept and we wanna add it into our skill. So the way we're gonna do that is by heading over into Visual Studio Code. And we need a place to be able to hold that information. So the watchlist is gonna be very important for our course, so we're gonnaa go ahead and create that now. Which is going to be a variable, because we're going to adding to it periodically. So we'll simply create a watchList variable, and we're gonna initialize it to an empty array. And then we're gonna need some courses. Like I said before, I'm gonna fudge this a little bit, but you could be making API calls out to different places. You could be doing screen scraping, or whatever have you, whatever you want to do to be able to get this information and make it available in your skills. So what I'm gonna do is I'm actually just going to paste in a rather large array of courses, basically the information that I took from that page. As you can see, I have an array of courses that contains a number of objects, and each object has a number of properties. So it has a name, a teaser, description, which is just kind of the holding place if you wanna add that in there, the author, as well as the duration. So basically, what I've given you now is a list of JSON objects that basically represents the Tuts+ code course's main page there. Now we can do something with it. So the next thing that we're gonna start to do is we're gonna start to use this data. We're gonna use the watchList variable. We're gonna use this list of courses to be able to fill out some handlers. Namely GetNewCourses, GetCourseTeaser, as well as AddToWatchList and GetWatchList. And then any other sort of handlers you could possibly think of. So that's what we're gonna spend our time doing for the remainder of this course.

Back to the top