淘宝客商品 获取详情图片

最新方法:

https://mdetail.tmall.com/templates/pages/desc?id= + 商品ID

新的暂用的方法是

这个接口的  pcDescContent 字段

全网商品详情API接口-折淘客

下面的方法都挂了

获取商品详情图API - 淘宝联盟API免费API接口-淘宝联盟API开放API接口-淘宝联盟APICPS接口-喵有券(www.ecapi.cn)  我现在用的是他家的接口   下面的接口不能用了

 $.ajax({
      url: "https://hws.m.taobao.com/cache/desc/5.0?id=" + id,//淘宝商品ID
      timeout: 1000,
      tryCount: 0,
      retryLimit: 3,
      dataType: 'jsonp',
      jsonp: 'callback',
      success: function (result) {
          if (result.sellerId != "") {
             var regx = /<[^>]*>|<\/[^>]*>/gm;
             var len = result.wdescContent.pages.length;
             var image = "";
             for (var i = 0; i < len; i++) {
                 if (result.wdescContent.pages[i].indexOf("<txt>") != -1) {
                     image += "";
                 } else {
                     image += "<img src='http:" + result.wdescContent.pages[i].replace(regx, "") + "' style='width:100%;max-width:100%'>";
                 }
             }
             //console.log(image);
             $('.good_detail').html(image);
          }
      }
   });

我不知道 其他人 进行到$('.good_detail').html(image); 这一步有没有输出不了的情况,我这里没有反应,html() 里面放字符串或其他都能输出,就是放 image不行  。。

测试的可行方法是,把result.wdescContent.pages[i]      url 数据发送到后端再返回给前端重组 img字符串  就能输出了。。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值