<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      如何從HTML字符串中提取Img、video的標(biāo)簽和地址

      getImageAndVideoURL (con) {
          let obj = {}
      
          const imgReg = /<img.*?(?:>|\/>)/gi // 匹配圖片中的img標(biāo)簽
          const videoReg = /<video(([\s\S])*?)<\/video>/gi // 匹配圖片中的img標(biāo)簽
          const srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i // 匹配圖片中的src
          const ImageArr = con.match(imgReg) || [] // 篩選出所有的img
          const VideoArr = con.match(videoReg) || [] // 篩選出所有的video
      
          const indexImg = con.search(imgReg)
          const indexVideo = con.search(videoReg)
          // 去除所有圖片和視頻后的帖子內(nèi)容
          const narrowHandle = con.replace(/&nbsp;/gi, '').replace(/<img.*?(?:>|\/>)/gi, '').replace(/<video(([\s\S])*?)<\/video>/gi, '').replace(/<p(.*)><\/p>/gi, '').replace(/<[^<>]+>/g, '')
          const ImageSrcArr = [] // 圖片地址數(shù)組
          const VideoSrcArr = [] // 視頻地址數(shù)組
      
          for (let i = 0; i < ImageArr.length; i++) {
            const imgSrc = ImageArr[i].match(srcReg)
            // 獲取圖片地址
            ImageSrcArr.push(imgSrc[1])
          }
          for (let i = 0; i < VideoArr.length; i++) {
            const videoSrc = VideoArr[i].match(srcReg)
            // 獲取圖片地址
            VideoSrcArr.push(videoSrc[1])
          }
      
          let haveImageOrVideo = false
          let showImageOrVideo = ''
          if (indexImg === -1 && indexVideo === -1) {
            haveImageOrVideo = false
          } else if (indexImg > 0 && indexImg < indexVideo) {
            haveImageOrVideo = true
            showImageOrVideo = 'IMG'
          } else if (indexImg > 0 && indexVideo < 0) {
            haveImageOrVideo = true
            showImageOrVideo = 'IMG'
          } else if (indexVideo > 0 && indexVideo < indexImg) {
            haveImageOrVideo = true
            showImageOrVideo = 'VIDEO'
          } else if (indexVideo > 0 && indexImg < 0) {
            haveImageOrVideo = true
            showImageOrVideo = 'VIDEO'
          }
          obj = {
            ImageSrcArr,
            VideoSrcArr,
            haveImageOrVideo,
            showImageOrVideo,
            narrowHandle,
            showLeft: true
          }
          return obj
        }
      
      posted @ 2021-05-20 15:17  yangAL  閱讀(1297)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 天堂国产一区二区三区四区不卡| 精品久久人人做爽综合| 日韩av一区二区三区精品| 婷婷久久综合九色综合88| 一区二区亚洲精品国产精| 麻豆国产传媒精品视频| 99久久亚洲精品无码毛片| 精品人妻伦一二三区久久| 精品国产亚洲午夜精品av| 欧美亚洲另类制服卡通动漫| 五月婷婷中文字幕| 国产老熟女乱子一区二区| 99久久国产福利自产拍| 亚洲成人动漫av在线| 国产日韩久久免费影院| 国产中文字幕日韩精品| 久久一卡二卡三卡四卡| 日韩av一区二区精品不卡| 偷自拍另类亚洲清纯唯美| 久久久精品2019中文字幕之3| 国产精品免费久久久免费| 日韩精品一区二区亚洲专区| 国产成人一区二区三区在线| 亚洲欧美日韩在线码| 97色成人综合网站| 亚洲综合一区二区三区不卡| 777奇米四色成人影视色区| 91精品国产自产91精品| 欧美日韩精品一区二区三区在线 | 人妻无码中文专区久久app| 亚洲国产大片永久免费看| 男女性高爱潮免费网站| 浪潮av色综合久久天堂| 超碰成人人人做人人爽 | 欧美人成在线播放网站免费| 亚洲午夜成人精品电影在线观看| 色综合色天天久久婷婷基地| 国产熟女老阿姨毛片看爽爽 | 久久精品免视看国产成人| 无码日韩精品一区二区三区免费| 日韩av一区二区精品不卡|