Calling the InnerTubeService Class
Now that we have our classes designed, let's show how we can convert the XML from Figure 4-4 into the objects represented in Figure 4-5. To do this, we'll use another class, our InnerTubeService class. As you can see in Figure 4-6, the common feeds—Top Rated, Most Viewed, etc.—from YouTube's API are all available as methods. The return type for all of the methods in InnerTubeService is an ObservableCollection<Inner TubeVideo>.

Figure 4-6. IntelliSense showing the available methods for retrieving YouTube data
Converting YouTube XML into .NET Objects
The InnerTubeService class actually has only one real method that does the work of converting XML into objects, and that's the ConvertYouTubeXmlIntoObjects method. The reason for this is that each YouTube XML API ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access