# 归档 | 全自动解析 微博/微信 视频


> 本项目开源地址: `https://github.com/zkeq/icodeq-api`

### 视频解析(直链接口示例)

> 若出现卡顿请 <a target="_blank" href="https://icodeq.com/2022/03e4ec0968c8/" >刷新页面</a> 以使用 `Dplayer` 🚀

<script src="https://dream-plan.cn/dplayer/dplayer.js"></script>

<div id='d1'>
<video id="p1" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://api.icodeq.com/api/get_163_mv_vercel?14300943" type="video/mp4" />
</video>
</div>

### 使用说明

- `全自动`：指直接加相关的参数就可以解析。

- `半自动`：指需要运行相关的 `Action` 或 `服务器后台` 来维持链接的可用性。

### 微信公共平台（全自动） 

#### 示例视频

<div id='d2'>
<video id="p2" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://api.icodeq.com/api/wechat_video_public?wxv_2281672366986412045" type="video/mp4" />
</video>
</div>

<div id='d3'>
<video id="p3" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://api.icodeq.com/api/wechat_video_public?wxv_2281669760981450761" type="video/mp4" />
</video>
</div>

#### 接口使用说明

- 本接口为自己搭建的接口，功能是通过 `微信公共平台` 里面的 `素材库`。

- 在 `素材库` 获取到微信视频的 `wxv` 并接在接口后面来实现自动解析。

- 不需要发布文章，只需要上传视频，然后过审，就可以使用本接口。

#### 解析接口

```cmd
https://api.icodeq.com/api/wechat_video_public?wxv_{wxv}
```

#### 接口示例

```cmd
https://api.icodeq.com/api/wechat_video_public?wxv_2281672366986412045
https://api.icodeq.com/api/wechat_video_public?wxv_2281669760981450761
```

#### 图片示例

![2](https://cdn.hashnode.com/res/hashnode/image/upload/v1653446811082/8erLRfbGr.png)

### 微博用户视频直链（全自动）

#### 示例视频

<div id='d4'>
<video id="p4" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://api.icodeq.com/api/weibo_307_video?uid=3908615569&cursor=4696609415234742&hd=2" type="video/mp4" />
</video>
</div>

<div id='d5'>
<video id="p5" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://api.icodeq.com/api/weibo_307_video?uid=1239246050&cursor=4720854242429953&hd=0" type="video/mp4" />
</video>
</div>

<div id='d6'>
<video id="p6" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://api.icodeq.com/api/weibo_307_video?uid=3908615569&cursor=4729250207239479&hd=2" type="video/mp4" />
</video>
</div>

#### 接口使用说明

- 本接口是自己搭建的接口，功能是通过微博视频的信息定位到具体的视频链接

- 使用方法为查看微博视频的 `瀑布流` 信息，获取到 `用户ID` `视频ID` `清晰度ID` 3 个参数

- 本接口获取视频的逻辑是从瀑布流视频的上一个时间戳来获取视频

- 这样获取到视频列表的第一个即为所查询的视频 ID ，可以保证 以后的更新之后此接口依旧可用

- 清晰度排序为 最高清 为 `0` 第二高清为 `1`，依次类推。

#### 解析接口

```cmd
https://api.icodeq.com/api/weibo_307_video?uid={uid}&cursor={cursor}&hd={hd}
```

#### 接口示例

```cmd
https://api.icodeq.com/api/weibo_307_video?uid=3908615569&cursor=4696609415234742&hd=2
https://api.icodeq.com/api/weibo_307_video?uid=1239246050&cursor=4720854242429953&hd=0
https://api.icodeq.com/api/weibo_307_video?uid=3908615569&cursor=4729250207239479&hd=2
```

#### 图片示例

![3](https://cdn.hashnode.com/res/hashnode/image/upload/v1653446812766/Pg16NkG7R.png)

### 网易MV（全自动逆向缓存版）[新增]

> [此 `API` 开源地址](https://github.com/zkeq/163MV-Python-FastAPI)

示例视频（最高清）：

<div id='_163mv_div'>
<video id="_163mv_video" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://163.icodeq.com/?vid=10882549" type="video/mp4" />
</video>
</div>

#### 接口使用说明

- 本接口由后台和前台两部分组成（获取数据的部分和生成数据的部分）

- 获取数据的部分负责查询 `Redis` 数据。如果没有查到数据就去请求后台。

- 后台生成数据后传递到 `Redis` 和前台上，完成 `308` 跳转。

- 外加 `vercel` 的缓存功能，所以 `2小时内` 的速度非常快。

- `vid` 是云音乐网页端地址栏上那个。

#### 解析接口

```cmd
https://163.icodeq.com/?vid={vid}
```

#### `API` 接口

```cmd
https://163mv.icodeq.com/?vid={vid}
```

#### 接口文档

```cmd
https://163mv.icodeq.com/docs
```

#### 接口示例

```cmd
https://163.icodeq.com/?vid=10882549
```

#### `API` 示例

```cmd
https://163mv.icodeq.com/?vid=10882549
```

#### 图片示例

![10](https://cdn.hashnode.com/res/hashnode/image/upload/v1653446817431/mqkoAAWtn.png)


### 网易MV（半自动）

#### 逆向版（最高清）

示例视频：

<div id='d7'>
<video id="p7" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://api.icodeq.com/api/get_163_mv_vercel?14401004" type="video/mp4" />
</video>
</div>

#### 接口使用说明

- 本接口为通过 `JS逆向网易云` 来获取到真实的 `MV` 地址，并且清晰度最高

- 但是因为我没有服务器的原因（高考完买服务器），所以只能通过 `Github` `Action` 来刷新链接

- 具体操作就是通过 `163.js` 来进行加密，之后获取到服务器返回的数据来存储到 `Redis` 上面

- 接着通过 `API`，来获取存储在 `Redis` 上面的数据，所以不部署相应的 `Action` 的话，无法使用该接口

- 具体操作就是在 [/api/get_163_mv_vercel/get-new-url/main_local.py](https://github.com/zkeq/icodeq-api/blob/main/api/get_163_mv_vercel/get-new-url/main_local.py) 修改 `main`，函数里面的列表值，然后运行对于的 `Action` 即可。

- 所对应的 `Action` 为 `Working 163 MV JavaScript Reverse`。

- 详情参见 [Zkeq/icodeq-api](https://github.com/zkeq/icodeq-api)

#### 接口示例

```cmd
https://api.icodeq.com/api/get_163_mv_vercel?14401004
```

#### 图片示例

![4](https://cdn.hashnode.com/res/hashnode/image/upload/v1653446818643/I4PjDShYw.png)

#### 爬虫版（不是最高清）

示例视频：

<div id='d8'>
<video id="p8" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://api.icodeq.com/api/get_163_mv?14351340" type="video/mp4" />
</video>
</div>

#### 接口使用说明

- 具体步骤就是使用 `Selenium` 爬取MV 列表，缺点是只能获取到默认的播放地址

- 没啥技术含量

- `Action` 安装 `Selenium` 的教程见我的上一篇文章

- 推荐使用那个逆向的，比这个好。这个有几率触发报错（重新运行就不报错了，奇怪）

#### 接口示例

```cmd
https://api.icodeq.com/api/get_163_mv?14351340
```

#### 图片示例

![5](https://cdn.hashnode.com/res/hashnode/image/upload/v1653446819870/JQDLNB3HP.png)


### B站视频（全自动）[非作者]

示例视频：

<div id='d9'>
<video id="p9" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://video-direct-link.vercel.app/bili.mp4?aid=254312390&bvid=BV19Y41137fy&cid=515765491" type="video/mp4" />
</video>
</div>

#### 接口使用说明

- 参见原作者自述：https://www.notion.so/B-1080P-Notion-88315db1b76f4e72a610e4e692cd8f96

#### 解析接口

```cmd
https://video-direct-link.vercel.app/bili.mp4?aid={aid}&bvid={bvid}&cid={cid}
```

#### 具体代码摘抄

```javascript
javascript:(()=>{const info = "made by ourongxing（即刻，B站，Github）";try{const link = `https://video-direct-link.vercel.app/bili.mp4?aid=${aid}&bvid=${bvid}&cid=${cid}`;const res = prompt("Command/Ctrl + C 复制，点击确定后直接跳转\n"+info,link);res&&window.open(link)}catch{window.alert("请在 B 站播放界面点击该书签\n"+info)}})()
```

```javascript
javascript: window.open( `https://video-direct-link.vercel.app/bili.mp4?aid=${aid}&bvid=${bvid}&cid=${cid}`)
```

### B站视频（半自动）

示例视频：

<div id='d10'>
<video id="p10" width="100%" height="100%" controls=""  data-poster="https://ik.imagekit.io/zkeq/2022-3-2/1.png">
  <source src="https://icodeq-bpi.vercel.app/api/parwix" type="video/mp4" />
</video>
</div>

#### 接口使用说明

- 本接口为逆向 `parwix` 不保证一直有效，具体源码已开源，有兴趣可以研究下。

#### 接口示例

```cmd
https://icodeq-bpi.vercel.app/api/parwix
```

#### 图片示例

![5](https://cdn.hashnode.com/res/hashnode/image/upload/v1653446820993/YebMbdwOA.png)

### 开源代码地址

- https://github.com/zkeq/icodeq-api

### 赞助

[感谢 `JetBrains` 为本项目提供的许可证。](https://jb.gg/OpenSourceSupport)

{% gallery %}
[![1](https://cdn.hashnode.com/res/hashnode/image/upload/v1653446823326/9EOvS6N0k.png)](https://jb.gg/OpenSourceSupport)
[![2](https://cdn.hashnode.com/res/hashnode/image/upload/v1653446825696/K1cpLGdhk.png)](https://jb.gg/OpenSourceSupport)
{% endgallery %}


### 声明

- 本文提供的所有内容仅供学习交流使用！



<script>
  const p_1 = new Plyr('#p1');
  const p_2 = new Plyr('#p2');
  const p_3 = new Plyr('#p3');
  const p_4 = new Plyr('#p4');
  const p_5 = new Plyr('#p5');
  const p_6 = new Plyr('#p6');
  const p_7 = new Plyr('#p7');
  const p_8 = new Plyr('#p8');
  const p_9 = new Plyr('#p9');
  const p_10 = new Plyr('#p10');
  const _163video = new Plyr('#_163mv_video');
</script>



<script>
(
function () {

const dp1 = new DPlayer({
    container: document.getElementById('d1'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://api.icodeq.com/api/get_163_mv_vercel?14300943'
    },
});
const dp2 = new DPlayer({
    container: document.getElementById('d2'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://api.icodeq.com/api/wechat_video_public?wxv_2281672366986412045'
    },
});
const dp3 = new DPlayer({
    container: document.getElementById('d3'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://api.icodeq.com/api/wechat_video_public?wxv_2281669760981450761'
    },
});
const dp4 = new DPlayer({
    container: document.getElementById('d4'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://api.icodeq.com/api/weibo_307_video?uid=3908615569&cursor=4696609415234742&hd=2'
    },
});
const dp5 = new DPlayer({
    container: document.getElementById('d5'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://api.icodeq.com/api/weibo_307_video?uid=1239246050&cursor=4720854242429953&hd=0'
    },
});
const dp6 = new DPlayer({
    container: document.getElementById('d6'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://api.icodeq.com/api/weibo_307_video?uid=3908615569&cursor=4729250207239479&hd=2'
    },
});
const dp7 = new DPlayer({
    container: document.getElementById('d7'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://api.icodeq.com/api/get_163_mv_vercel?14401004'
    },
});
const dp8 = new DPlayer({
    container: document.getElementById('d8'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://api.icodeq.com/api/get_163_mv?14351340'
    },
});
const dp9 = new DPlayer({
    container: document.getElementById('d9'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://video-direct-link.vercel.app/bili.mp4?aid=254312390&bvid=BV19Y41137fy&cid=515765491'
    },
});
const dp10 = new DPlayer({
    container: document.getElementById('d10'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://icodeq-bpi.vercel.app/api/parwix'
    },
});
const _163mv = new DPlayer({
    container: document.getElementById('_163mv_div'),
    theme:'#00c4b6',
    preload:'none',
    video: {
        pic:'https://ik.imagekit.io/zkeq/2022-3-2/1.png',
        url: 'https://163.icodeq.com/?vid=10882549'
    },
});
}
)()
</script>
