pythondailymotion-api

Unable to download list of all Videos on Dailymotion


I am using Dailymotion API to get the list of all videos on my channel. Although my channel has more than 3000 videos, I am able to scan and download the list of only 1000 videos. Please help.

Channel link: https://www.dailymotion.com/prashant_advait

Below is the code:

import dailymotion

d = dailymotion.Dailymotion()

d.set_grant_type(
            "password",
            api_key=_API_KEY_HINDI,
            api_secret=_API_SECRET_HINDI,
            scope=["manage_videos"],
            info={"username": _USERNAME_HINDI, "password": _PASSWORD_HINDI},
        )


page = 1

while(True):
    api_call = '/me/videos?fields=id,title,url,tags&limit=100&page=' + str(page)
    r = d.get(api_call)

    print(r)

    if r['has_more'] is False:
        break

    page = r['page']+1

At page 10, the GET request has 'has_more' field set to False and no more videos are there.

Below call gives no result:

api_call = '/me/videos?fields=id,title,url&limit=100&page=' + str(11)
r = d.get(api_call)

Result:

{'page': 11, 'limit': 100, 'explicit': False, 'total': 0, 'has_more': False, 'list': []}


Solution

  • You can use parameters like created_after and sort=old to reduce the set of videos returned by the API. Once arrived to the last video of the last page, use the created_time field value to perform a new API call from this date.

    Example:

    1. https://api.dailymotion.com/me/videos?fields=id,title,url,created_time&limit=100&page=10&sort=old
    2. https://api.dailymotion.com/me/videos?fields=id,title,url,created_time&limit=100&page=1&sort=old&created_after=123456789

    If this is not enough to browse all your catalog please reach out to your Dailymotion contact to find a solution.