pythondailymotion-api

Unable to set category to 'Education' in Upload


I am using Dailymotion python sdk to upload videos to dailymotion. I am unable to set category to 'Education'

Unable to set category to 'Education', works fine if I set it to 'news'.

upload_folder = r"D:\My Folder\Dailymotion\Download_DM\automated_upload"

for file in os.listdir(upload_folder):
    try:

        d.set_grant_type(
            "password",
            api_key=_API_KEY,
            api_secret=_API_SECRET,
            scope=["manage_videos"],
            info={"username": _USERNAME, "password": _PASSWORD},
        )

        # Uploading the file on dailymotion servers
        file_path = upload_folder +'\\' + os.path.splitext(file)[0] + ".mp4"
        url = d.upload(file_path)

        # Filling the information about the video
        parameters = {
            "url": url,
            "title": os.path.splitext(file)[0],
            "tags": "life,love,reality,god,spirituality,education,truth,saints,scriptures",
            #"description": "my first automatic uplaod",
            "published": 1,
            "channel": "education"
        }

        # Sending the information to create the video on dailymotion
        result = d.post("/me/videos?fields=id,url", parameters)

        print("Uploaded video: ", os.path.splitext(file)[0], "\nDailymotion url: ", result['url'], "\n\n")


    except Exception as e:
        print("An error occured: %s" % str(e))

Error Message: DailymotionApiError: not_found: Can't find object channel for `channel' parameter


Solution

  • Education is the label of the channel, you have to pass its id which is 'school'.

    You can retrieve all the channel ids at this endpoint: https://api.dailymotion.com/channels?fields=id,name