让代码更简单

当前位置:代码狗 > 经验教程 > 实用教程 > 正文

可获取淘宝商品视频接口分享

重要:本文最后更新于2020-09-20 08:31:10,某些文章具有时效性,若有错误或已失效,请在下方留言或联系代码狗

今天无意中看到了一个神奇的接口,可以直接获取淘宝商品的视频地址,当然得该商品具有视频简介才行,否则是得不到的,该接口用处目前尚未明确,先分享一波,占个位置。

先看接口内容

请求方式:get

请求地址(带参数):

https://h5api.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?jsv=2.5.8&appKey=12574478&api=mtop.taobao.detail.getdetail&v=6.0&isSec=0&ecode=0&AntiFlood=true&AntiCreep=true&H5Request=true&ttid=2018%40taobao_h5_9.9.9&dataType=jsonp&data=%7B%22spm%22%3A%22a21tn.8216370.2278269.8.460357228Vjy1q%22%2C%22id%22%3A%22” + 商品ID + “%22%2C%22scm%22%3A%221007.13381.38597.101200300000000%22%2C%22liveInfo%22%3A%22201420153~269056455686%22%2C%22itemNumId%22%3A%22” + 商品ID + “%22%2C%22itemId%22%3A%22” + 商品ID + “%22%2C%22exParams%22%3A%22%7B%5C%22spm%5C%22%3A%5C%22a21tn.8216370.2278269.8.460357228Vjy1q%5C%22%2C%5C%22id%5C%22%3A%5C%22” + 商品ID + “%5C%22%2C%5C%22scm%5C%22%3A%5C%221007.13381.38597.101200300000000%5C%22%2C%5C%22liveInfo%5C%22%3A%5C%22201420153~269056455686%5C%22%7D%22%2C%22detail_v%22%3A%228.0.0%22%2C%22utdid%22%3A%221%22%7D

其中的商品ID换成你需要获取视频的商品ID就行了,访问拼接的网络地址,返回json数据,我们需要的视频地址在json数据data下的apiStack键下的value键值中。这个数据也是json,只不过是字符串类型的,在解析是注意转换成json对象即可。在新转换的json对象中,取出item键下第一个videos键值下的url键值即可。

下面举个例子:

商品ID:551398178469

请求地址:

https://h5api.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?jsv=2.5.8&appKey=12574478&api=mtop.taobao.detail.getdetail&v=6.0&isSec=0&ecode=0&AntiFlood=true&AntiCreep=true&H5Request=true&ttid=2018%40taobao_h5_9.9.9&dataType=jsonp&data=%7B%22spm%22%3A%22a21tn.8216370.2278269.8.460357228Vjy1q%22%2C%22id%22%3A%22551398178469%22%2C%22scm%22%3A%221007.13381.38597.101200300000000%22%2C%22liveInfo%22%3A%22201420153~269056455686%22%2C%22itemNumId%22%3A%22551398178469%22%2C%22itemId%22%3A%22551398178469%22%2C%22exParams%22%3A%22%7B%5C%22spm%5C%22%3A%5C%22a21tn.8216370.2278269.8.460357228Vjy1q%5C%22%2C%5C%22id%5C%22%3A%5C%22551398178469%5C%22%2C%5C%22scm%5C%22%3A%5C%221007.13381.38597.101200300000000%5C%22%2C%5C%22liveInfo%5C%22%3A%5C%22201420153~269056455686%5C%22%7D%22%2C%22detail_v%22%3A%228.0.0%22%2C%22utdid%22%3A%221%22%7D

返回数据:

可获取淘宝商品视频接口分享

可获取淘宝商品视频接口分享

其中取出视频地址为:

https://cloud.video.taobao.com/play/u/2261839620/p/2/e/6/t/1/218108823346.mp4?appKey=38829

播放效果:

可获取淘宝商品视频接口分享

可获取淘宝商品视频接口分享

感觉很棒!可以赞赏支持我哟~

赞(0) 打赏

评论 抢沙发

×

请作者吃根烤肠!

支付宝