当前位置: 首页 > 后端技术 > Node.js

最近很火的节点版“对不起随便gif”

时间:2023-04-03 18:32:08 Node.js

Sorry最近很流行做节点版gif上线。思路来自原来ruby版的Xuty。本文档还参考了原始文档。如果对node-sorry仓库的在线demo地址有任何疑问,欢迎提issue。如果您喜欢这个项目,请给它一个star,谢谢!项目描述服务端使用koa+fluent-ffmpeg,生成字幕和gif,存在缓存目录。该api使用RESTful规范页面使用ejs呈现。构建脚本build.js。生成的页面和资源在dist目录中。项目配置在config.js(请deploy删除或替换统计代码)源码结构├──package├──package.lock├──common#tools├──server#node源码├──view#pagesourcecode├──template#gif模板├──config.js#配置├──build.js#页面构建脚本├──README.md└──cache#gif和字幕缓存其他版本的ruby原版,@Xuty写了python版,@East196写了java版,@East196写了li24361写了C#ASP.NET版,@shuangrain写了微信小程序,@CoXier写了制作GIF的API:POST{host}/api/{template_name}/{subtitle:['OK',.....]}#ReturnhashofGIF->200{status:200,data:'c2f4069ed207dc38e0f2d9359a2fa6b7'}GetGIF:GET{host}/api/{template_name}/{gif_hash}目前支持的template_name有:-sorry-wangjingzedeploymentguideinstallationnpmi@ffmpeg-installer/ffmpegmaynotbeinstalled。多次安装npmi以构建页面。npmrunbuilddeployment用于本地开发。使用npmrunserver进行在线部署。推荐使用pm2管理。首先安装npmipm2-g。,然后用pm2startserver/index.js启动项目创建字幕模板template.ass首先使用aegisub为模板视频创建字幕并保存为template.ass(可以看这个https://贴吧.baidu.com/pfortheaegisubtutorial/136...)并将文本替换为模板字符串<%=sentences[n]%>