Demo Application
Learn how to integrate different endpoints of the Dailymotion Data API with the help of a Django application.
We'll cover the following
Introduction
This lesson walks us through a Django application that integrates Dailymotion Data API. We'll use the following operations in the application workflow:
- Retrieving videos
- Retrieving playlists
- Retrieving channels
Workflow
We have our demo application in the widget below. In the file views.py
, lines 10 to 55 are the functions that perform API calls. The application works as follows:
- Lines 10–17: We define the
index
function, which calls thevideos
endpoint. - Lines 19–26: We define the
popularChannels
function, which calls thechannels
endpoint and sorts the channels based on their popularity. - Lines 28–35: We define the
playlists
function, which calls theplaylists
endpoint to show all the playlists. - Lines 37–45: We define the
channelVideos
function, which calls thechannel/channel_id/videos
endpoint to get all the videos belonging to a channel. - Lines 47–55: We define the
playlistVideos
function, which calls theplaylist/playlist_id/videos
endpoint that returns the videos from a playlist.
Run the application
Click the “Run” button in the widget below to run the application. Once the server has started, click the URL against “Your app can be found at:” to view the application.
- After running the code below, the home page shows some videos from the Dailymotion website that we can play and watch.
- The playlist page displays the list of playlists. We can also retrieve a specific playlist by clicking it.
- The channel page displays the channel’s ID, name, and description. We can retrieve videos of a specific channel by clicking the channel's ID.
Note: The following widget only shows the necessary files required to explain the Dailymotion Data APIs.
Get hands-on with 1400+ tech skills courses.