在youtube api v2文档中。建议使用rel="previous"
和rel="next"
分页工作。
http://gdata.youtube.com/feeds/api/videos?start-index=51&max-results=25
假设上述链接以该链接开头的51个视频参数为准,并限制了25个视频参数。
我的问题是,我不想直接使用链接,我想分离参数并传递给函数参数。
我怎样才能做到这一点?
最佳答案
如果我理解您的问题,这很容易做到,只需将字符串分成多个块并插入函数参数即可。
function make_url(start_index, max_results) {
return "http://gdata.youtube.com/feeds/api/videos?start-index=" + start_index + "&max-results=" + max_results
}
然后调用make_url(100,25)将返回一个这样的URL。
http://gdata.youtube.com/feeds/api/videos?start-index=100&max-results=25
关于javascript - Youtube JavaScript API分页参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15820436/