How does the search query work with Vimeo API for my videos (/me/videos)?

删除回忆录丶 提交于 2021-02-07 11:22:48

问题


Description

I'm trying to understand how the "search query" via Vimeo API works. I've even tried it out via their "playground" on Vimeo API for developers.

Screenshot of the playground on Vimeo. As you can see the query takes in a "string" but there is not description on how it works.

I'm attempting to find a video via the a keyword that I put in the title. I've used the playground to test and see how the query actually works.

What I've tried

Filling out the "query" text box in the image above with NOTHING returns 2 results.

{
    "total": 2,
    /* Rest of data here */
}

This is expected because I've only uploaded two videos so far.

I've attempted to put a word from the title in the query but they always return 0 results.

Here is the PHP code I'm using, which of course returns 0 results.

public function findVimeoVideoByKeyword($keyword) {
    $response = $this->lib->request('/me/videos', [
        'query' => $keyword
    ]);

    # handle response code here...
}

This is the return data that I've dumped when searching for a specific word in a title (0 results):

VimeoService.php on line 168:
array:3 [▼
  "body" => array:5 [▼
    "total" => 0 //0 results
    "page" => 1
    "per_page" => 25
    "paging" => array:4 [▶]
    "data" => []
  ]
  "status" => 200
  "headers" => array:20 [▶]
]

This is the data returned when I do not search for anything (3 results):

VimeoService.php on line 167:
array:3 [▼
  "body" => array:5 [▼
    "total" => 3 //3 results
    "page" => 1
    "per_page" => 25
    "paging" => array:4 [▶]
    "data" => array:3 [▶]
  ]
  "status" => 200
  "headers" => array:21 [▶]
]

Searching for a video by querying with the FULL title returns 0 results.

Question

How do I correctly use the "query" property to search for specific videos according to their title with Vimeo API ?


回答1:


I went ahead and asked the same question on the VIMEO forums, and got a quick response from one of the devs.

When querying /me/videos only videos publicly available on vimeo.com are returned. Private videos are not indexed in search, and will not return when performing search queries.

I had originally thought that this was only for /videos and not for /me/videos

Apparently there is another approach for the search query to work on private videos.

Not yet implemented. We do have a workaround where if you enable Private Mode on your PRO account, you can then query videos on your account. Otherwise private videos are not available when performing search queries.

The key would be to put the PRO account in private mode which enables you to query videos on the account.

I have tested this. All that there is required to do is to set private mode by: Account Settings -> General -> Private Mode -> Enable It will then set your account to Private Mode and put all your videos as Private. The Search Query then works.




回答2:


Have a look at this example code they have in the repo of the lib. Looks like you need to urlencode the query value.



来源:https://stackoverflow.com/questions/38332615/how-does-the-search-query-work-with-vimeo-api-for-my-videos-me-videos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!