作者nottt (无)
看板Web_Design
标题Re: [问题] 新手问题js
时间Sun Feb 5 23:31:37 2017
试了一下,不顺利,後来想到好像有这件事
Google Drive 档案外连功能将於 2016 年 8 月关闭, 站长须即早准备
http://www.wfublog.com/2016/04/google-drive-disable-direct-link.html
不过我都弄了,还是贴一下好了
http://codepen.io/not0000/pen/NdzXPe
左边html只是把该放的js放一放而已,不太重要
右边前面var obj那一大块都是你的google driver点下去的内容
卷到下面就会看到obj[0]['file']在取得json的值,我有把取到的值印到连结上
确认可正常取到json资料
但正常要从url取json的话,可以用$.getJSON的方式取,如下
$.getJSON('
http://api.getlinkdrive.com/get....总之很长的url',
function(data) {
//在这边依照上面的范例,用data[0]['file']就能取到资料了
var VideoUrl = data[0]['file'];
});
但是因为google挡外连了,所以按F12会看到错误讯息
No 'Access-Control-Allow-Origin' header is present on the requested resource.
因此..换空间吧
※ 引述《tregfd654321 (B.Milk)》之铭言:
: 好吧,小弟真的爬文爬很久了,所以才上来问,对js真的不会,所以上来问
: 小弟目前在用
: google drive影片
: 用videojs播放器播出来的
: 影音网页
: 小弟的code是这样
:
: <video id='example_video_1' class="video-js
: vjs-default-skin"width="1385"></video>
: <script>
: videojs('example_video_1', {
: controls: true,
: plugins: {
: videoJsResolutionSwitcher: {
: default: 'high', // Default resolution [{Number}, 'low', 'high'],
: dynamicLabel: false
: }
: }
: }, function(){
: var player = this;
: window.player = player
: player.updateSrc
: (
: /*需要插入的外部网址的地方*/
: )
: player.on('resolutionchange', function(){
: console.info('Source changed to %s', player.src())
: })
: })
: </script>
: https://goo.gl/IYeus6图片好读,请问要怎麽把drive转出来的连结code
: https://goo.gl/1Cf21h加入到上面的code里面呢
: p.s为什麽不直接把网页里面的code复制到里面呢,因为他code每段时间会变。
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 218.187.101.186
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Web_Design/M.1486308699.A.C42.html
1F:推 tregfd654321: 大大给我一点时间消化 02/06 00:16