全平台短视频去水印小程序

69¥
类型 完整应用
版本 1.0.1
版本更新时间 4天前
大小 7.89 MB
开发商
wanzi
评分

php版本的短视频去水印流量小程序,提供前后端源码核心解析也包含在本仓库,同时项目也对接了第三方平台,保证解析的稳定性。

案例

特性

  1. 提供流量小程序源码。
  2. 支持主流短视频平台(小红书、抖音、微博、快手、头条、B站、西瓜视频等)的解析。

使用教程

插件市场下载应用插件:shortVideoParse

  • 安装
    首次安装
    composer install -vvv
  • 后续更新
    
    # v1.0.0版本需要执行
    php webman app-plugin:install admin
    php webman app-plugin:install shortVideoParse

## 第三方去水印解析接口配置
目前平台对接了一家 [keke](https://api.ake999.com/)。这样的配置保证了小程序的稳定性。需要说明的是,本项目采用多引擎解析,保证了解析的稳定性。因此如果你想更稳定,还可以自行实现解析驱动(这部分代码看:`plugin/shortVideoParse/app/core/videoParse/Gateway.php`)。当然,每次解析第一个解析引擎是自己开发的php版本,这个版本也是2024年最新的php视频解析包,还是很稳定。
配置keke(具体大家注册平台账号获取配置信息),修改`plugin/shortVideoParse/config/keke.php`文件:
```php
<?php

return [
    'api' => 'https://api.ake999.com/',
    'clientId' => '',
    'clientSecretKey' => '',
];

运行小程序

解压docs\micro-v.1.0.0(版本号跟随版本更新调整),里面就是源码了

微信小程序配置

修改.env, 配置源码在plugin/shortVideoParse/config/easywechat.php文件:

WECHAT_MINI_APP_ID=自己的
WECHAT_MINI_APP_SECRET=自己的

对象存储配置(可选)

默认使用腾讯云对象存储存储解析的视频和图片,如果不配置OSS_COS_BUKET则不会保存解析的视频和图片。
修改plugin/shortVideoParse/config/oss.php配置文件:

<?php

use plugin\shortVideoParse\app\core\oss\AliOss;
use plugin\shortVideoParse\app\core\oss\CosOss;

return [
    'default' => env('OSS_DEFAULT', 'CosOss'),
    'CosOss' => [
        'class' => CosOss::class,
        'bucket' => env('OSS_COS_BUKET'),
        'appId' => env('OSS_COS_APPID'),
        'secretId' => env('OSS_COS_SECRET_ID'),
        'secretKey' => env('OSS_COS_SECRET_KEY'),
        'region' => env('OSS_COS_REGION', 'cd'),
        'domain' => env('OSS_COS_DOMAIN'),
        'host' => env('OSS_COS_HOST'),
    ],
    'AliOss' => [
        'class' => AliOss::class,
        'bucket' => env('OSS_ALI_BUKET'),
        'accessKey' => env('OSS_ALI_ACCESS_KEY'),
        'accessSecret' => env('OSS_ALI_ACCESS_SECRET'),
        'endPoint' => env('OSS_ALI_ENDPOINT', 'oss-cn-chengdu.aliyuncs.com'),
        'region' => env('OSS_ALI_REGION', 'cn-chengdu'),
        'host' => env('OSS_ALI_HOST')
    ]
];

或者(推荐)修改.env文件:

OSS_DEFAULT=CosOss
OSS_COS_APPID=自己的
OSS_COS_SECRET_ID=自己的
OSS_COS_SECRET_KEY=自己的
OSS_COS_BUKET=自己的
OSS_COS_WATERMARK_BUKET=自己的
OSS_COS_WATERMARK_REGION=自己的
OSS_COS_WATERMARK_DOMAIN=自己的
OSS_COS_WATERMARK_HOST=自己的
OSS_COS_REGION=自己的
OSS_COS_DOMAIN=自己的
OSS_COS_HOST=自己的
OSS_ALI_BUKET=自己的
OSS_ALI_ACCESS_KEY=自己的
OSS_ALI_ACCESS_SECRET=自己的
OSS_ALI_ENDPOINT=自己的
OSS_ALI_REGION=自己的
OSS_ALI_HOST=自己的

微信小程序上线配置

微信小程序上线request请求域名配置参考

  • 首先是自己的请求域名,比如https://api.example.com
  • 然后是视频平台的请求域名,以下是我累计的视频平台的地址,可以添加到微信小程序的request请求域名配置中,这样会减少不合法的域名请求
    https://ali2.a.kwimgs.com
    https://aweme.snssdk.com
    https://cn-hncs-cu-01-07.bilivideo.com
    https://cn-hncs-cu-01-09.bilivideo.com
    https://cn-lnsy-cu-01-01.bilivideo.com
    https://cn-nmghhht-cu-01-07.bilivideo.com
    https://cn-sccd-ct-01-05.bilivideo.com
    https://cn-sccd-ct-01-07.bilivideo.com
    https://cn-sccd-ct-01-08.bilivideo.com
    https://cn-sccd-ct-01-22.bilivideo.com
    https://cn-sccd-ct-01-30.bilivideo.com
    https://cn-sccd-ct-01-31.bilivideo.com
    https://cn-sdqd-cu-01-33.bilivideo.com
    https://cn-tj-cu-01-01.bilivideo.com
    https://cn-tj-cu-01-07.bilivideo.com
    https://cn-tj-cu-01-08.bilivideo.com
    https://cn-zjhz-cu-01-06.bilivideo.com
    https://cn-zjjh-ct-04-35.bilivideo.com
    https://f.video.weibocdn.com
    https://i0.hdslb.com
    https://i1.hdslb.com
    https://i2.hdslb.com
    https://image1.pearvideo.com
    https://img.momocdn.com
    https://mvimg10.meitudata.com
    https://mvvideo10.meitudata.com
    https://p11-sign.douyinpic.com
    https://p3-pc-sign.douyinpic.com
    https://p6-ppx-sign.byteimg.com
    https://p9-pc-sign.douyinpic.com
    https://pic640.weishi.qq.com
    https://sf5-hl-cdn-tos.douyinstatic.com
    https://sns-video-hw.xhscdn.com
    https://sns-webpic-qc.xhscdn.com
    https://txmov2.a.yximgs.com
    https://upos-sz-mirrorali.bilivideo.com
    https://upos-sz-mirrorcos.bilivideo.com
    https://v.weishi.qq.com
    https://v26-default.365yg.com
    https://v3-cha.toutiaovod.com
    https://v3-default.365yg.com
    https://video.momocdn.com
    https://video.pearvideo.com
    https://watermark-1255543940.cos.ap-chengdu.myqcloud.com
    https://web-f01.izuiyou.com
    https://web-v01.izuiyou.com
    https://wx2.sinaimg.cn

    微信小程序上线downloadFile合法域名配置参考

    • 首先是自己的合法域名,比如https://api.example.com
    • 然后是视频平台的合法域名,以下是我累计的视频平台的地址,可以添加到微信小程序的downloadFile合法域名配置中,这样会减少不合法的域名请求
      https://ali2.a.kwimgs.com
      https://aweme.snssdk.com
      https://cn-ahwh-ct-01-05.bilivideo.com
      https://cn-ahwh-ct-01-06.bilivideo.com
      https://cn-ahwh-ct-01-09.bilivideo.com
      https://cn-ahwh-ct-01-10.bilivideo.com
      https://cn-cq-ct-01-01.bilivideo.com
      https://cn-fjqz-cm-01-06.bilivideo.com
      https://cn-gddg-cm-01-02.bilivideo.com
      https://cn-gddg-ct-01-13.bilivideo.com
      https://cn-gddg-ct-01-22.bilivideo.com
      https://cn-gddg-cu-01-06.bilivideo.com
      https://cn-gdfs-ct-01-07.bilivideo.com
      https://cn-gdfs-ct-01-09.bilivideo.com
      https://cn-gdfs-ct-01-10.bilivideo.com
      https://cn-gdfs-ct-01-12.bilivideo.com
      https://cn-gdfs-ct-01-18.bilivideo.com
      https://cn-gdfs-ct-01-19.bilivideo.com
      https://cn-gdgz-cm-01-01.bilivideo.com
      https://cn-gdgz-cm-01-02.bilivideo.com
      https://cn-gdgz-cm-01-03.bilivideo.com
      https://cn-gdgz-cm-01-04.bilivideo.com
      https://cn-gdgz-cm-01-05.bilivideo.com
      https://cn-gdgz-cm-01-08.bilivideo.com
      https://cn-gdgz-cm-01-09.bilivideo.com
      https://cn-gdgz-cm-01-10.bilivideo.com
      https://cn-gdgz-cm-01-11.bilivideo.com
      https://cn-gdgz-cm-01-14.bilivideo.com
      https://cn-hbsjz-cm-02-02.bilivideo.com
      https://cn-hbsjz-cm-02-03.bilivideo.com
      https://cn-hbsjz-cm-02-05.bilivideo.com
      https://cn-hbsjz-cm-02-08.bilivideo.com
      https://cn-hbsjz-cm-02-09.bilivideo.com
      https://cn-hbsjz-cm-02-10.bilivideo.com
      https://cn-hbsjz-cm-02-11.bilivideo.com
      https://cn-hbsjz-cm-02-13.bilivideo.com
      https://cn-hbwh-cm-01-03.bilivideo.com
      https://cn-hbwh-cm-01-04.bilivideo.com
      https://cn-hbwh-cm-01-05.bilivideo.com
      https://cn-hbwh-cm-01-06.bilivideo.com
      https://cn-hbwh-cm-01-07.bilivideo.com
      https://cn-hbwh-cm-01-09.bilivideo.com
      https://cn-hbwh-cm-01-10.bilivideo.com
      https://cn-hbwh-cm-01-13.bilivideo.com
      https://cn-hbwh-cm-01-17.bilivideo.com
      https://cn-hbwh-cm-01-19.bilivideo.com
      https://cn-hbyc-ct-02-05.bilivideo.com
      https://cn-hbyc-ct-02-12.bilivideo.com
      https://cn-hbyc-ct-02-23.bilivideo.com
      https://cn-hbyc-ct-02-24.bilivideo.com
      https://cn-hbyc-ct-02-25.bilivideo.com
      https://cn-hljheb-ct-01-03.bilivideo.com
      https://cn-hncs-cu-01-02.bilivideo.com
      https://cn-hncs-cu-01-03.bilivideo.com
      https://cn-hncs-cu-01-05.bilivideo.com
      https://cn-hncs-cu-01-10.bilivideo.com
      https://cn-hnld-ct-01-22.bilivideo.com
      https://cn-hnld-ct-01-24.bilivideo.com
      https://cn-hnld-ct-01-39.bilivideo.com
      https://cn-hnld-ct-01-47.bilivideo.com
      https://cn-hnld-ct-01-51.bilivideo.com
      https://cn-hnzz-cm-01-01.bilivideo.com
      https://cn-jsnt-ct-01-10.bilivideo.com
      https://cn-jsnt-ct-01-21.bilivideo.com
      https://cn-jsnt-ct-01-25.bilivideo.com
      https://cn-jsnt-ct-01-32.bilivideo.com
      https://cn-jsnt-ct-01-38.bilivideo.com
      https://cn-jsnt-ct-01-52.bilivideo.com
      https://cn-jxnc-cm-01-13.bilivideo.com
      https://cn-sdjn-cm-02-11.bilivideo.com
      https://cn-sh-ct-01-10.bilivideo.com
      https://cn-sxty-cu-03-05.bilivideo.com
      https://cn-zjjh-ct-04-06.bilivideo.com
      https://f.video.weibocdn.com
      https://i0.hdslb.com
      https://i1.hdslb.com
      https://i2.hdslb.com
      https://image1.pearvideo.com
      https://img.momocdn.com
      https://mvimg10.meitudata.com
      https://mvvideo10.meitudata.com
      https://n98-v-ncdnon.toutiaovod.com
      https://p11-sign.douyinpic.com
      https://p26-sign.douyinpic.com
      https://p26.douyinpic.com
      https://p29.douyinpic.com
      https://p3-b-sign.douyinpic.com
      https://p3-ch-a-sign.douyinpic.com
      https://p3-d.douyinpic.com
      https://p3-pc-sign.douyinpic.com
      https://p3-sign.toutiaoimg.com
      https://p6-ch-b.douyinpic.com
      https://p6-ppx-sign.byteimg.com
      https://p9-pc-sign.douyinpic.com
      https://p9-sign.douyinpic.com
      https://p9-tt-video-play-sign.byteimg.com
      https://p9.douyinpic.com
      https://p95-sign.douyinpic.com
      https://pic640.weishi.qq.com
      https://sf5-hl-cdn-tos.douyinstatic.com
      https://sns-img-hw.xhscdn.com
      https://sns-video-al.xhscdn.com
      https://sns-video-bd.xhscdn.com
      https://sns-video-hw.xhscdn.com
      https://sns-webpic-qc.xhscdn.com
      https://txmov2.a.yximgs.com
      https://upos-sz-mirrorali.bilivideo.com
      https://upos-sz-mirrorcos.bilivideo.com
      https://v.weishi.qq.com
      https://v11-x.toutiaovod.com
      https://v26-default.365yg.com
      https://v3-cha.toutiaovod.com
      https://v3-default.365yg.com
      https://v5-x.toutiaovod.com
      https://v6-default.365yg.com
      https://v9-default.365yg.com
      https://v9-x.toutiaovod.com
      https://v95-zj-colda.douyinvod.com
      https://video.momocdn.com
      https://video.pearvideo.com
      https://watermark-1255543940.cos.ap-chengdu.myqcloud.com
      https://web-f01.izuiyou.com
      https://web-v01.izuiyou.com
      https://wx2.sinaimg.cn

uploadFile合法域名

  • 首先是自己的合法域名,比如https://api.example.com。此项目目前没有使用oss,所以不需要配置,然后是个人头像使用了上传
  • 然后是如果使用了oss,则是oss的合法域名,比如https://oss.example.com

上线隐私协议配置

项目已经开发好。开发者只需要更新隐私协议即可。具体流程参考:小程序隐私协议开发指南
-接入流程

下载代理配置

由于短视频平台都是oss+cdn地址太多,不可能在小程序downloadFile合法域名里面全部配置,那现在需要保证下载成果,就需要代理。
同时目前的代理机制是:

  1. 对于特殊的平台(比如:微博、头条、抖音)是在解析程序里面就增加了代理地址覆盖的逻辑(这个看下面)
  2. 其他平台是小程序首先请求原始的视频下载地址下载,如果下载失败,就请求代理地址下载,如果代理地址下载失败,就返回下载失败。

    以下是代理的详细处理方案(暂时只对WanzijVideoParser解析驱动做了代理处理,后续根据情况调整):

头条、抖音

.env里面设置:

TOUTIAO_MP4_DOWNLOAD_PROXY=自己的域名/proxy_video.php
TOUTIAO_IMG_DOWNLOAD_PROXY=自己的域名/proxy_img.php

这部分代码处理使用了php fpm,因此也需要配置nginx,以下提供宝塔配置:
宝塔的根目录是项目下的public

 location /proxy_video {
    try_files $uri =404;
    fastcgi_pass  unix:/tmp/php-cgi-74.sock;
    fastcgi_index proxy_video.php;
    include fastcgi.conf;
    include pathinfo.conf;
  }
  location /proxy_img {
    try_files $uri =404;
    fastcgi_pass  unix:/tmp/php-cgi-74.sock;
    fastcgi_index proxy_img.php;
    include fastcgi.conf;
    include pathinfo.conf;
  }

通用代理

  1. 通过在nginx下配置代理,以下是宝塔配置参考:

    resolver 8.8.8.8 114.114.114.114 valid=300s;
    location /download {
    # 提取 url 参数并存储到变量
    if ($query_string ~* "^url=(.*)$") {
        set $target_url $1;  # 设置变量 $target_url 存储解析出的 URL
    }
    if ($target_url = "") {
        return 400 "Missing URL parameter.";
    }
    # 代理请求到目标 URL
    proxy_pass $target_url;
    # 设置请求头
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    #proxy_set_header Referer "https://m.toutiao.com/";
    proxy_set_header Accept-Encoding "";
    
    # 支持断点续传
    proxy_set_header Range $http_range;
    proxy_cache_bypass $http_range;
    
    # 启用错误拦截
    proxy_intercept_errors on;
    }
  2. .env里配置:VIDEO_DOWNLOAD_PROXY=自己的/proxy_video.php

注意

消息队列任务

  • remove-watermark-video:如果设置oss存储,删除就会清理资源
  • watermark-parse-video-after:如果有设置oss存储,则会存储

联系我

  • 邮箱:wzj177@163.com
版本历史记录
1.0.1
5天前
增加菜单导入
修复cms更新内容状态字段不回显bug
1.0.0
6天前
- 完成解析
评分及评论
0 满分5分
×
🔝