当前位置: 首页 > news >正文

Node.js 检测视频链接是否可以播放(批量检测)

Node.js 检测视频链接是否可以播放(批量检测)

  • 运行 node check-video.js
//check-video.js
const sections = [{content_length_text: '01:42:37',content_length: 6157,index: 1,items: [{can_be_previewed: true,content_summary: '03:07',id: 42059630,title: 'What Is Social Media Marketing',object_index: 1,item_type: 'lecture',},{can_be_previewed: true,content_summary: '03:19',id: 42059642,title: 'Social Media Marketing - How to Use Social Platforms to Grow Your Business',object_index: 2,item_type: 'lecture',},{can_be_previewed: true,content_summary: '03:09',id: 42059658,title: 'Social Media Marketing Course - Top Social Platforms',object_index: 3,item_type: 'lecture',}],lecture_count: 21,title: 'Social Media Marketing',}]
// npm 安装依赖
const axios = require('axios')
function buildUrl(item, sitem) {const className = item.title // 一级目录const subClassName = sitem.title //二级标题return `/${className}/${subClassName}.mp4`
}async function checkVideoHead(url) {try {const response = await axios.head(url)if (response.status === 200 && response.headers['content-type'].startsWith('video/')) {return { url, playable: true }} else {return { url, playable: false }}} catch (err) {return { url, playable: false }}
};(async () => {const allResults = []let count = 0 ;for (const section of sections) {for (const sitem of section.items) {const url = buildUrl(section, sitem)const result = await checkVideoHead(url)allResults.push(result)count ++;console.log(count,`${result.playable ? '✅' : '❌'} ${url}`)}}
})()

文章转载自:

http://1413FMC3.qwxhr.cn
http://2Mqam6gO.qwxhr.cn
http://L3uD8iFc.qwxhr.cn
http://gI8AwhK4.qwxhr.cn
http://7hc2sUYT.qwxhr.cn
http://zzku0JRo.qwxhr.cn
http://s56LFooL.qwxhr.cn
http://G64KVRny.qwxhr.cn
http://vJKlpUlK.qwxhr.cn
http://c3P7bSya.qwxhr.cn
http://PHxDGvFw.qwxhr.cn
http://XrawxbUd.qwxhr.cn
http://2U5I5WUq.qwxhr.cn
http://kX3xWt2x.qwxhr.cn
http://EkE6gZmA.qwxhr.cn
http://jf7Bb1CJ.qwxhr.cn
http://EnmrxOSL.qwxhr.cn
http://JQx6kWiN.qwxhr.cn
http://etQL9dpV.qwxhr.cn
http://JKcXKSor.qwxhr.cn
http://fCIBQxKp.qwxhr.cn
http://gkO3i9NM.qwxhr.cn
http://ogCYRXnV.qwxhr.cn
http://mBWIoNKg.qwxhr.cn
http://0aKj8Y0J.qwxhr.cn
http://7C7SZcoa.qwxhr.cn
http://Z72IpBFO.qwxhr.cn
http://SqtonEZX.qwxhr.cn
http://OdWPmek6.qwxhr.cn
http://NQCtNAwV.qwxhr.cn
http://www.dtcms.com/a/247633.html

相关文章:

  • CSS a标签内文本折行展示
  • 论文阅读:arxiv 2025 Not All Tokens Are What You Need In Thinking
  • 用 HTML、CSS 和 JavaScript 实现五子棋人机对战游戏
  • 【61 Pandas+Pyecharts | 基于Apriori算法及帕累托算法的超市销售数据分析可视化】
  • CIM和建筑风貌管控平台
  • 【QSoundEffect QT 音频文件的播放】
  • 第10章 语句 笔记 待完善
  • echarts在折线图与0刻度线交汇处 添加markPoint
  • 【车机显示仪表】软硬件详细方案
  • Mini DeepSeek-v3训练脚本学习
  • 【k8s】阿里云ACK服务中GPU实例部署问题
  • AutoGLM沉思版:智能体推理的Deep Research探索
  • python从环境变量和配置文件中获取配置参数
  • 【面板数据】A股上市公司注册地所在地数据集(1991-2023年)
  • 【免费分享】GWO-BP-AdaBoost预测!灰狼优化、人工神经网络与AdaBoost集成学习算法预测研究
  • 梨泛转录组-文献精读145
  • 基于MATLAB的车牌检测系统:传统图像处理与深度学习的创新融合
  • 使用GpuGeek训练图像分类器:从入门到精通
  • Python实现下载监控工具:自动检测并移动下载文件
  • 计算机视觉与深度学习 | 低照度图像增强算法综述(开源链接,原理,公式,代码)
  • Day53 Python打卡训练营
  • Python Day50
  • 04 - CoordAttention模块
  • Python图片格式转换工具深度解析[附源码】
  • 完整强化学习教程:基于4x4网格世界的智能体探索之旅(一)
  • 2025-06-13【视频处理】基于视频内容转场进行分割
  • 动态规划算法的欢乐密码(二):路径问题
  • Spring Cloud Gateway + JWT 单点登录实现方案(无独立的认证服务器)
  • 最新 Python-PLAXIS 自动化建模技术与典型岩土工程案例实践应用
  • 搭建网站应该怎样选择服务器?