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

胶州建设信息网站简述网站的制作步骤

胶州建设信息网站,简述网站的制作步骤,做app网站的软件,企业网站设计推广方案这篇是在上一篇的基础上写的#xff0c;这篇负责抖音作者详情页的视频转声音提取#xff0c;这篇需要用到后端。 本地启动后端后#xff0c;在控制台输入对应代码#xff0c;即可实现hover在封面上#xff0c;按d一键下载音频 控制台代码 // 获取作者的视频列表var liEle…这篇是在上一篇的基础上写的这篇负责抖音作者详情页的视频转声音提取这篇需要用到后端。 本地启动后端后在控制台输入对应代码即可实现hover在封面上按d一键下载音频 控制台代码 // 获取作者的视频列表var liElements document.querySelectorAll(ul[data-e2escroll-list] li);// 添加鼠标悬停事件监听器liElements.forEach(function(li) {li.addEventListener(mouseenter, function() {// 添加键盘按下事件监听器document.addEventListener(keydown, keydownHandler);});li.addEventListener(mouseleave, function() {// 移除键盘按下事件监听器document.removeEventListener(keydown, keydownHandler);});});// 处理键盘按下事件function keydownHandler(event) {// 判断按下的键是否为 D 键keyCode为 68if (event.keyCode 68) {// 获取下载链接var sourceTag document.querySelector(.basePlayerContainer xg-video-container video source:nth-child(1));const alt document.querySelector(.basePlayerContainer).previousElementSibling.querySelector(img).getAttribute(alt);// 找到第一个冒号并截取之后的部分let contentAfterColon alt.includes() ? alt.split().slice(1).join():alt;// 去除所有的.和空格let resultString contentAfterColon.replace(/[.\s]/g, );// 如果最终结果为空替换为空const name resultString ? 空 : resultString;// 提取src属性值var url sourceTag.getAttribute(src);// 执行下载操作这里使用一个假设的下载函数downloadFile(url, name);}}function downloadFile(url, name) {// 发送POST请求到后台接口fetch(http://localhost:3000/convert, {method: POST,headers: {Content-Type: application/json,},body: JSON.stringify({ videoUrl: url }),}).then((response) response.blob()).then((blob) {// 创建一个临时的a元素用于下载const a document.createElement(a);const url window.URL.createObjectURL(blob);a.href url;a.download name .mp3;// 触发点击事件以启动下载a.click();// 释放URL对象window.URL.revokeObjectURL(url);}).catch((error) {console.error(Error:, error);alert(下载失败原因 error)}); } 后端 node 代码 const express require(express); const axios require(axios); const ffmpeg require(fluent-ffmpeg); const fs require(fs); const path require(path); const cors require(cors); const app express();app.use(express.json()); // 允许所有域的请求 app.use(cors());app.post(/convert, async (req, res) {try {const { videoUrl } req.body;if (!videoUrl) {return res.status(400).json({ error: Missing videoUrl parameter });}const videoFileName inputVideo.mp4;const audioFileName outputAudio.mp3;// Download the video fileconst response await axios.get(videoUrl, { responseType: arraybuffer });fs.writeFileSync(videoFileName, Buffer.from(response.data));// Convert video to audio using ffmpegawait new Promise((resolve, reject) {ffmpeg().input(videoFileName).audioCodec(libmp3lame).toFormat(mp3).on(end, () resolve()).on(error, (err) reject(err)).save(audioFileName);});// Send the converted audio file to the clientres.download(audioFileName, (err) {if (err) {console.error(err);res.status(500).json({ error: Internal server error });}// Clean up temporary filesfs.unlinkSync(videoFileName);fs.unlinkSync(audioFileName);});} catch (err) {console.error(err);res.status(500).json({ error: Internal server error });} });const PORT process.env.PORT || 3000; app.listen(PORT, () {console.log(Server is running on port ${PORT}); }); 如果不想用控制台也可以用暴力猴暴力猴脚本如下 // UserScript // name New Userscript // namespace http://tampermonkey.net/ // version 2024-01-12 // description try to take over the world! // author You // match https://www.douyin.com/* // icon https://www.google.com/s2/favicons?sz64domaindouyin.com // grant none // /UserScript(function() {use strict;// Your code here...// 目标节点var targetNode document.querySelector(ul[data-e2escroll-list]);// 初始时的li数量var initialCount targetNode.children.length;// 配置观察器的设置var config { childList: true };// 观察器回调var callback function(mutationsList, observer) {// 当前的li数量var currentCount targetNode.children.length;// 检查li数量是否增加if (currentCount initialCount) {// 执行你的函数addWatch();console.log(添加监听器)// 更新初始时的li数量initialCount currentCount;}};// 创建一个观察器实例并传入回调函数var observer new MutationObserver(callback);// 使用配置和目标节点开始观察observer.observe(targetNode, config);// 给所有 li 添加监听器function addWatch() {// 获取作者的视频列表var liElements document.querySelectorAll(ul[data-e2escroll-list] li);// 添加鼠标悬停事件监听器liElements.forEach(function(li) {li.addEventListener(mouseenter, function() {// 添加键盘按下事件监听器document.addEventListener(keydown, keydownHandler);});li.addEventListener(mouseleave, function() {// 移除键盘按下事件监听器document.removeEventListener(keydown, keydownHandler);});});}// 处理键盘按下事件function keydownHandler(event) {// 判断按下的键是否为 D 键keyCode为 68if (event.keyCode 68) {// 获取下载链接var sourceTag document.querySelector(.basePlayerContainer xg-video-container video source:nth-child(1));const alt document.querySelector(.basePlayerContainer).previousElementSibling.querySelector(img).getAttribute(alt);// 找到第一个冒号并截取之后的部分let contentAfterColon alt.includes() ?alt.split().slice(1).join():alt;// 去除所有的.和空格let resultString contentAfterColon.replace(/[.\s]/g, );// 如果最终结果为空替换为空const name resultString ? 空 : resultString;// 提取src属性值var url sourceTag.getAttribute(src);// 执行下载操作这里使用一个假设的下载函数downloadFile(url, name);}}function downloadFile(url, name) {// 发送POST请求到后台接口fetch(http://localhost:3000/convert, {method: POST,headers: {Content-Type: application/json,},body: JSON.stringify({ videoUrl: url }),}).then((response) response.blob()).then((blob) {// 创建一个临时的a元素用于下载const a document.createElement(a);const url window.URL.createObjectURL(blob);a.href url;a.download name .mp3;// 触发点击事件以启动下载a.click();// 释放URL对象window.URL.revokeObjectURL(url);}).catch((error) {console.error(Error:, error);alert(下载失败原因 error)});}})();
文章转载自:
http://www.morning.jgmlb.cn.gov.cn.jgmlb.cn
http://www.morning.jbmsp.cn.gov.cn.jbmsp.cn
http://www.morning.zqkms.cn.gov.cn.zqkms.cn
http://www.morning.qpsxz.cn.gov.cn.qpsxz.cn
http://www.morning.sskhm.cn.gov.cn.sskhm.cn
http://www.morning.whnps.cn.gov.cn.whnps.cn
http://www.morning.mwqbp.cn.gov.cn.mwqbp.cn
http://www.morning.ztqj.cn.gov.cn.ztqj.cn
http://www.morning.kqbjy.cn.gov.cn.kqbjy.cn
http://www.morning.jhxtm.cn.gov.cn.jhxtm.cn
http://www.morning.dodoking.cn.gov.cn.dodoking.cn
http://www.morning.xwlmg.cn.gov.cn.xwlmg.cn
http://www.morning.dnzyx.cn.gov.cn.dnzyx.cn
http://www.morning.tkryt.cn.gov.cn.tkryt.cn
http://www.morning.wmcng.cn.gov.cn.wmcng.cn
http://www.morning.ksgjn.cn.gov.cn.ksgjn.cn
http://www.morning.ktblf.cn.gov.cn.ktblf.cn
http://www.morning.hflrz.cn.gov.cn.hflrz.cn
http://www.morning.rjynd.cn.gov.cn.rjynd.cn
http://www.morning.mingjiangds.com.gov.cn.mingjiangds.com
http://www.morning.bqpg.cn.gov.cn.bqpg.cn
http://www.morning.jjrsk.cn.gov.cn.jjrsk.cn
http://www.morning.nsfxt.cn.gov.cn.nsfxt.cn
http://www.morning.wgrl.cn.gov.cn.wgrl.cn
http://www.morning.ntnml.cn.gov.cn.ntnml.cn
http://www.morning.rkfxc.cn.gov.cn.rkfxc.cn
http://www.morning.wnbqy.cn.gov.cn.wnbqy.cn
http://www.morning.mqffm.cn.gov.cn.mqffm.cn
http://www.morning.gbcxb.cn.gov.cn.gbcxb.cn
http://www.morning.ljhnn.cn.gov.cn.ljhnn.cn
http://www.morning.qmwzr.cn.gov.cn.qmwzr.cn
http://www.morning.dkqbc.cn.gov.cn.dkqbc.cn
http://www.morning.blfll.cn.gov.cn.blfll.cn
http://www.morning.kdlzz.cn.gov.cn.kdlzz.cn
http://www.morning.sh-wj.com.cn.gov.cn.sh-wj.com.cn
http://www.morning.srsln.cn.gov.cn.srsln.cn
http://www.morning.pyswr.cn.gov.cn.pyswr.cn
http://www.morning.zxdhp.cn.gov.cn.zxdhp.cn
http://www.morning.mcqhb.cn.gov.cn.mcqhb.cn
http://www.morning.ychrn.cn.gov.cn.ychrn.cn
http://www.morning.bwnd.cn.gov.cn.bwnd.cn
http://www.morning.jjxxm.cn.gov.cn.jjxxm.cn
http://www.morning.bhwz.cn.gov.cn.bhwz.cn
http://www.morning.mkyny.cn.gov.cn.mkyny.cn
http://www.morning.lgznf.cn.gov.cn.lgznf.cn
http://www.morning.rcjyc.cn.gov.cn.rcjyc.cn
http://www.morning.yxplz.cn.gov.cn.yxplz.cn
http://www.morning.mnwmj.cn.gov.cn.mnwmj.cn
http://www.morning.ymrq.cn.gov.cn.ymrq.cn
http://www.morning.ftzll.cn.gov.cn.ftzll.cn
http://www.morning.wrtpk.cn.gov.cn.wrtpk.cn
http://www.morning.hdlhh.cn.gov.cn.hdlhh.cn
http://www.morning.dyfmh.cn.gov.cn.dyfmh.cn
http://www.morning.qbrdg.cn.gov.cn.qbrdg.cn
http://www.morning.qrlsy.cn.gov.cn.qrlsy.cn
http://www.morning.tpwrm.cn.gov.cn.tpwrm.cn
http://www.morning.xwbld.cn.gov.cn.xwbld.cn
http://www.morning.vnuwdy.cn.gov.cn.vnuwdy.cn
http://www.morning.tdldh.cn.gov.cn.tdldh.cn
http://www.morning.tkchg.cn.gov.cn.tkchg.cn
http://www.morning.yfcbf.cn.gov.cn.yfcbf.cn
http://www.morning.c7630.cn.gov.cn.c7630.cn
http://www.morning.hytr.cn.gov.cn.hytr.cn
http://www.morning.ntyanze.com.gov.cn.ntyanze.com
http://www.morning.yrms.cn.gov.cn.yrms.cn
http://www.morning.krjyq.cn.gov.cn.krjyq.cn
http://www.morning.wjlhp.cn.gov.cn.wjlhp.cn
http://www.morning.gfrjs.cn.gov.cn.gfrjs.cn
http://www.morning.yqndr.cn.gov.cn.yqndr.cn
http://www.morning.ntqqm.cn.gov.cn.ntqqm.cn
http://www.morning.brbmf.cn.gov.cn.brbmf.cn
http://www.morning.gynkr.cn.gov.cn.gynkr.cn
http://www.morning.kgnrh.cn.gov.cn.kgnrh.cn
http://www.morning.bzsqr.cn.gov.cn.bzsqr.cn
http://www.morning.hqwxm.cn.gov.cn.hqwxm.cn
http://www.morning.mhnb.cn.gov.cn.mhnb.cn
http://www.morning.ylph.cn.gov.cn.ylph.cn
http://www.morning.srcth.cn.gov.cn.srcth.cn
http://www.morning.qpqcq.cn.gov.cn.qpqcq.cn
http://www.morning.dfdhx.cn.gov.cn.dfdhx.cn
http://www.tj-hxxt.cn/news/247734.html

相关文章:

  • 开发一个网站要学什么软件网站建设销售应答技巧
  • 企业网站制作开发合肥网站建站报广告代理
  • 惠州学院网站建设无锡网站制作电话
  • 有哪些官方网站做的比较好枣庄建设网站
  • 合肥网络科技有限公司做网站建设局工资一年多少钱
  • 做淘宝客网站需要备案吗网站cms下载
  • 企业做淘宝客网站微博推广的优势
  • h5微网站建设多少钱东莞最近三天的新闻大事
  • 杭州市建设厅网站深圳网站建设电话
  • 嘉兴网站建设运营网题 做问卷的网站
  • 做网站的把网站写成一行企业网站建设熊掌号
  • 专业做网站厂家广告设计介绍
  • 免费手机网站空间申请三杰网站建设
  • 没有rss源的网站如何做rss订阅宁波网络推广联系方式
  • 商洛网站建设电话iis添加网站无法访问
  • 做好网站建设深圳专业建网站多少钱
  • 重庆技术网站建设中国的网站域名是什么
  • wordpress更改站点ps课堂网站
  • 青岛网站有限公司太原做企业网站的
  • 请问网上有没有比较好的网站可以做照片书的呀?要求质量比较好的!网站设计方案及报价单
  • 湖南专业外贸建站公司建设银行报网站
  • 郑州网站建设价位自己怎么学电商运营
  • 合肥seo网站优化国外外贸网站大全
  • 舟山市网站建设如何开拓海外市场
  • 功能性质网站有哪些网站wordpress设置专题页
  • 建设银行 福州招聘网站南京理工大学电子工程网官网
  • 企业网站底部河南建设工程信息网官网首页
  • 海口网站建设美丽湖北网站推广服务
  • 台州小型网站建设上市公司协会网站建设汇报
  • 做网站必须用对方服务器邻水网站建设