Vimeo API-从频道获取所有视频

时间:2018-08-30 16:05:56

标签: get vimeo vimeo-api

我想从某个频道获取Vimeo的所有视频。

我查看了the Vimeo API,为我的应用创建了a key,但是我发现没有简单的方法来获取所有带有频道ID的视频...

该怎么做?

谢谢。

2 个答案:

答案 0 :(得分:0)

要获取频道中的视频列表,请向<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <main class="site-content" id="main"> <div class="container py-4"> <nav class="glossary__nav mb-4"> <ul class="list-inline"> <li class="glossary__nav__item viewall active"> <a class="card card__content viewall_button" data-nav="#" data-toggle="glossary" href="#">View All</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="#" data-toggle="glossary" href="#">#</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="A" data-toggle="glossary" href="#">A</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="B" data-toggle="glossary" href="#">B</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="C" data-toggle="glossary" href="#">C</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="D" data-toggle="glossary" href="#">D</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="E" data-toggle="glossary" href="#">E</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="F" data-toggle="glossary" href="#">F</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="G" data-toggle="glossary" href="#">G</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="H" data-toggle="glossary" href="#">H</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="I" data-toggle="glossary" href="#">I</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="J" data-toggle="glossary" href="#">J</a> </li><li class="glossary__nav__item"> <a class="card card__content" data-nav="K" data-toggle="glossary" href="#">K</a> </li><li class="glossary__nav__item"> <a class="card card__content" data-nav="L" data-toggle="glossary" href="#">L</a> </li><li class="glossary__nav__item"> <a class="card card__content" data-nav="M" data-toggle="glossary" href="#">M</a> </li><li class="glossary__nav__item"> <a class="card card__content" data-nav="N" data-toggle="glossary" href="#">N</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="O" data-toggle="glossary" href="#">O</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="P" data-toggle="glossary" href="#">P</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="Q" data-toggle="glossary" href="#">Q</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="R" data-toggle="glossary" href="#">R</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="S" data-toggle="glossary" href="#">S</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="T" data-toggle="glossary" href="#">T</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="U" data-toggle="glossary" href="#">U</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="V" data-toggle="glossary" href="#">V</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="W" data-toggle="glossary" href="#">W</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="X" data-toggle="glossary" href="#">X</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="Y" data-toggle="glossary" href="#">Y</a> </li> <li class="glossary__nav__item"> <a class="card card__content" data-nav="Z" data-toggle="glossary" href="#">Z</a> </li> </ul> </nav> <!--END Glossary Nav--> <div class="glossary__search mb-4"> <form action="#" class="glossary__search__form"> <input class="form-control" id="glossarySearchInput" placeholder="Search Keywords" type="search"> </form> </div> <!--END Glossary Search--> <div class="glossary__results mb-6"> <div class="glossary__results__row" data-term="#"> <h3 class="glossary__results__term title-style--three mb-3">#</h3> <div class="row"> <div class="glossary__results__item col-md-3 col-sm-6" data-item="3G"> <a class="card card__content" href="#"> <h4 class="card__title">3G</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="4G"> <a class="card card__content" href="#"> <h4 class="card__title">4G</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> </div> </div> <!--END Glossary Results Row--> <div class="glossary__results__row" data-term="A"> <h3 class="glossary__results__term title-style--three mb-3">A</h3> <div class="row"> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Application Cycle Management"> <a class="card card__content" href="#"> <h4 class="card__title">Application Cycle Management</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="API"> <a class="card card__content" href="#"> <h4 class="card__title">API</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="AVR"> <a class="card card__content" href="#"> <h4 class="card__title">AVR</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="ARP"> <a class="card card__content" href="#"> <h4 class="card__title">ARP</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> </div> </div> <!--END Glossary Results Row--> <div class="glossary__results__row" data-term="B"> <h3 class="glossary__results__term title-style--three mb-3">B</h3> <div class="row"> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Bandwidth"> <a class="card card__content" href="#"> <h4 class="card__title">Bandwidth</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Back Office"> <a class="card card__content" href="#"> <h4 class="card__title">Back Office</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Bluetooth"> <a class="card card__content" href="#"> <h4 class="card__title">Bluetooth</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Backbone Network"> <a class="card card__content" href="#"> <h4 class="card__title">Backbone Network</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> </div> </div> <!--END Glossary Results Row--> <div class="glossary__results__row" data-term="C"> <h3 class="glossary__results__term title-style--three mb-3">C</h3> <div class="row"> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Cable"> <a class="card card__content" href="#"> <h4 class="card__title">Cable</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Citizen"> <a class="card card__content" href="#"> <h4 class="card__title">Citizen</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Coat"> <a class="card card__content" href="#"> <h4 class="card__title">Coat</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Cynagenmod"> <a class="card card__content" href="#"> <h4 class="card__title">Cynagenmod</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> </div> </div> <!--END Glossary Results Row--> <div class="glossary__results__row" data-term="D"> <h3 class="glossary__results__term title-style--three mb-3">D</h3> <div class="row"> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Data"> <a class="card card__content" href="#"> <h4 class="card__title">Data</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Delta"> <a class="card card__content" href="#"> <h4 class="card__title">Delta</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Dragon"> <a class="card card__content" href="#"> <h4 class="card__title">Dragon</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> <div class="glossary__results__item col-md-3 col-sm-6" data-item="Dynasty"> <a class="card card__content" href="#"> <h4 class="card__title">Dynasty</h4> <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste vel, magnam incidunt obcaecati.</p></a> </div> <!--END Glossary Result item--> </div> </div> <!--END Glossary Results Row--> </div> <!--END Glossary Results--> </div> </main> <!-- END Main content -->发送经过身份验证的GET请求。端点文档可以在这里找到:https://developer.vimeo.com/api/reference/channels#GET/channels/{channel_id}/videos

如果您不知道频道的channel_id,则可以将ID替换为该频道的自定义网址。例如,使用https://vimeo.com/channels/staffpicks的“员工精选”频道,向https://api.vimeo.com/channels/[channel_id]/videos

发出经过身份验证的GET请求

也就是说,最佳做法是尽可能使用channel_id代替快捷方式URL名称。例如,“员工精选”频道返回https://api.vimeo.com/channels/staffpicks

答案 1 :(得分:0)

上面的答案是正确的,但我发现自己正在寻找有关如何获取频道 ID 的解决方案。

有两个选项(我发现)来获取频道 ID

  1. 如果您有权在浏览器中运行 js(如在 Puppeteer 中) - 运行以下 js
vimeo.config.channel.id

它会返回频道的id。

  1. 另一种选择是通过正则表达式获取 \"channel\"\:\{\"id\"\:\"(\d*)\"

它从标签中取出以下部分

vimeo.config = _extend((vimeo.config || {}), {"channel":{"id":"164226","url":"\/channels\/fenwn"},"sticky_topnav":{"excluded_pages":["Vimeo\\Controller\\AboutController:main","Vimeo\\Controller\\AboutController:profe