du13932014807 2015-03-18 19:00
浏览 21
已采纳

在Dailymotion API上检索未发布的视频

I'm trying to retrieve the unpublished videos I have on my DM account, i.e. the videos I've uploaded to DM but are not yet public. I'm using the PHP SDK v1.6.3 and I'm quite a beginner with the Dailymotion API.

I assume (but I'm not 100% sure) that I have to use the private filter as documented here

I've tried

$api->get('/me/videos',array('filters' => array('private')));

which raises a DailymotionApiException exception with the following message

Unrecognized value (private), allowed values are (featured, hd, official, creative, creative-official, ugc, buzz, buzz-premium, 3d, live, live-offair, game, all-live, live-upcoming, no-live, premium, premium-paidvideos, premium-offers, no-premium, history, with-poster, without-poster, promoted-on-games) at index #0 for `filters' parameter

which is strange because from this doc, 'private' is a valid filter for videos.

I've also tried

$api->get('/me/videos',array('filters' => array('private' => true)));

which apparently has a wrong format as it also raises a DailymotionApiException exception

Invalid type (array required, dict given) for `filters' parameter

Is there something wrong with the way I use filters in the PHP SDK ?

  • 写回答

1条回答 默认 最新

  • duanguochi6194 2015-03-19 10:48
    关注

    There are 2 mistakes in what you do:

    • first, "private" is different from "unpublished"
    • they way you call the filters is not the right one.

    1) A private video is only viewable by you on dailymotion as it does not appear on your channel page. You can share it with other users by sharing the private permalink that you can retrieve using the url field.

    An unpublished video is only viewable by you and can't be shared. It should be used when you edit the video (description, title, etc) before publishing it.

    2) Now, about the way you call the PHP SDK: private is a filter by itself, you don't need to add the filters parameter. The filters filter is deprecated (see https://developer.dailymotion.com/documentation#video-filters-filter).

    Your call has to be using either of: flags=private or: private filter. With the PHP SDK, you could use:

    $result = $api->get('/me/videos',array('flags' => array('private')));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?