mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-02-14 16:06:48 +08:00
Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25340b79aa | ||
|
|
381b0a8735 | ||
|
|
c7b99244bb | ||
|
|
5b5826e9a6 | ||
|
|
03e2f2673b | ||
|
|
503a90d8da | ||
|
|
afb92d59ff | ||
|
|
d26f1cbdf7 | ||
|
|
7f821b05ad | ||
|
|
746c93c9d2 | ||
|
|
9fb51ed8fc | ||
|
|
6a1c045e0b | ||
|
|
756b8ecc33 | ||
|
|
b4946a6c99 | ||
|
|
cbde4180ab | ||
|
|
00dab782e8 | ||
|
|
89d6183841 | ||
|
|
efd2095261 | ||
|
|
cbedb859c3 | ||
|
|
65aedc84cf | ||
|
|
95c58095ee | ||
|
|
b5da3c7f81 | ||
|
|
5b0211b2ed | ||
|
|
0bb6409687 | ||
|
|
7078e05668 | ||
|
|
0172a204b1 | ||
|
|
c6b0781a02 | ||
|
|
b3e67bcc7d | ||
|
|
cbca6db97e | ||
|
|
814ecaf25b | ||
|
|
4a07520336 | ||
|
|
2e121a901c | ||
|
|
3a2a16a168 | ||
|
|
881ab6cfa5 | ||
|
|
3151b33a23 | ||
|
|
f154f44772 | ||
|
|
a1458cf8bf | ||
|
|
595136c799 | ||
|
|
b7e497e2d9 | ||
|
|
dce8ad2ef2 | ||
|
|
79ba45b63a | ||
|
|
b6fcbcb934 | ||
|
|
54c4409311 | ||
|
|
5e9c273048 | ||
|
|
197df4e830 | ||
|
|
5271dfa490 | ||
|
|
7efde45aed | ||
|
|
4c92918dc3 | ||
|
|
6c0bd5125b | ||
|
|
785f9b20e7 | ||
|
|
8d052d2904 | ||
|
|
69a397e24e | ||
|
|
c216352268 | ||
|
|
89448d390f | ||
|
|
a853b02aa0 | ||
|
|
0443ce248f | ||
|
|
8009c3197e | ||
|
|
978d4e7181 | ||
|
|
138b70263a | ||
|
|
7f48c91f97 | ||
|
|
7a494a54c0 | ||
|
|
97812af0fd | ||
|
|
490d7c963e | ||
|
|
ed1afa2026 | ||
|
|
7ef114d0e3 | ||
|
|
7f9b7fc2c8 | ||
|
|
511820f873 | ||
|
|
af6dcb11bf | ||
|
|
7ecad1ad8e | ||
|
|
4d169f9d51 | ||
|
|
f3862e8385 | ||
|
|
490d4839b7 | ||
|
|
033bcb3df7 | ||
|
|
df22efa980 | ||
|
|
5428891297 | ||
|
|
bb3502774b | ||
|
|
fa67ad03d2 | ||
|
|
8a196ae52a | ||
|
|
ebfb681205 | ||
|
|
ba9f3246d2 | ||
|
|
51cb181acd | ||
|
|
33537638b0 | ||
|
|
fa9f85a177 | ||
|
|
3e1ecaac74 | ||
|
|
5cc9849e8a | ||
|
|
e353b629c5 | ||
|
|
4d20d5bc68 | ||
|
|
a921ce7adf | ||
|
|
1dd8d0dd24 | ||
|
|
b90c359670 | ||
|
|
27eb8c06ff | ||
|
|
add2bedb61 | ||
|
|
3dc970e198 | ||
|
|
3f2def4455 | ||
|
|
5b8d883af4 | ||
|
|
7113567475 | ||
|
|
e30da35e72 | ||
|
|
55b7396a2e | ||
|
|
83568fa499 | ||
|
|
838d3a64cd | ||
|
|
506be03e3e | ||
|
|
cfdb561473 | ||
|
|
ab2f45189f | ||
|
|
f4b9a73b18 |
196
README.md
196
README.md
@@ -21,160 +21,72 @@
|
||||
<img src="https://img.shields.io/github/workflow/status/Hunlongyu/ZY-Player/release-build?style=for-the-badge">
|
||||
<p>
|
||||
|
||||
# ZY Player 资源播放器
|
||||
|
||||
# 目录
|
||||
- [特性](#特性)
|
||||
- [重要](#重要)
|
||||
- [快捷键](#快捷键)
|
||||
- [下载](#下载)
|
||||
- [赞助](#赞助)
|
||||
- [截图](#截图)
|
||||
- [开发向导](#开发向导)
|
||||
- [准备环境](#准备环境)
|
||||
- [nodejs安装](#nodejs安装)
|
||||
- [yarn新一代包管理器安利](#yarn新一代包管理器安利)
|
||||
- [npm配置](#npm配置)
|
||||
- [翻墙代理设置](#翻墙代理设置)
|
||||
- [镜像源设置](#镜像源设置)
|
||||
- [代码IDE](#代码IDE)
|
||||
- [安装依赖](#安装依赖)
|
||||
- [调试开发](#调试开发)
|
||||
- [打包发布](#打包发布)
|
||||
<h1 align="center">ZY Player 资源播放器</h1>
|
||||
|
||||
## 特性
|
||||
|
||||
1. 全平台支持. Windows, Mac, Linux
|
||||
2. 支持更多视频源,支持自定义视频源
|
||||
3. 支持海报模式和列表模式
|
||||
4. 支持瀑布流 无限加载
|
||||
5. 支持历史播放记录,自动跳转播放进度
|
||||
6. 支持快捷键,使用更便捷,支持自定义快捷键
|
||||
7. 支持搜索历史记录
|
||||
8. 支持分享功能
|
||||
9. 支持精简模式,划水新高度
|
||||
10. 支持导出资源下载链接
|
||||
11. 收藏夹同步功能,追剧更方便
|
||||
12. 自动更新
|
||||
|
||||
觉得软件不错的, 点击右上角 star 收藏关注一波呀~
|
||||
### ✨特性
|
||||
|
||||
## 重要
|
||||
从 V1.x 版本升级到 V2.x 版本, 需要重置软件, 由于数据库改动较大, 重置后收藏的资源会丢失. 重置功能在设置界面里.
|
||||
- 🍕 全平台支持. Windows, Mac, Linux
|
||||
- 🍔 视频源支持自定义, 支持导入, 导出
|
||||
- 🍟 支持海报模式和列表模式浏览资源
|
||||
- 🌭 播放历史, 自动跳转历史进度
|
||||
- 🍿 收藏夹支持导入,导出, 支持同步追剧
|
||||
- 🥙 支持精简模式, 摸鱼划水
|
||||
- 🥪 一键搜索所有资源, 支持历史搜索记录
|
||||
- 🌮 导出资源下载链接
|
||||
- 🍣 支持第三方播放器播放
|
||||
- 🍤 显示豆瓣评分
|
||||
|
||||
#### 快捷键
|
||||
### 🌴 下载
|
||||
|
||||
- 🍓 [Github -- 官方下载](https://github.com/Hunlongyu/ZY-Player/releases)
|
||||
- 🍉 [蓝奏云 -- 快速下载](https://www.lanzoux.com/b04s6a3re) 密码:95px
|
||||
- 🍒 适用于32位操作系统的x86软件,在蓝奏云网盘里, 后缀名: ZY Player * 32位.exe
|
||||
|
||||
### 🚀 快捷键
|
||||
|
||||
播放窗口 和 Mini窗口
|
||||
|
||||
| 快捷键 | 说明 | 快捷键 | 说明 |
|
||||
| :----------------------: | ---------- | :----------------------: | ---------- |
|
||||
| `Alt + Space` | 聚焦或取消聚焦(全局快捷键)| | |
|
||||
| `→` | 快进 5 秒 | `←` | 快退 5 秒 |
|
||||
| `↑` | 音量调高 | `↓` | 音量调低 |
|
||||
| `m` | 静音 | `t` | 置顶或退出置顶 |
|
||||
| `f` | 进入或退出全屏 | `esc` | 退出全屏 |
|
||||
| `Alt + →` | 下一集 | `Alt + ←` | 上一集 |
|
||||
| `Alt + ↑` | 透明度调高 | `Alt + ↓` | 透明度调低 |
|
||||
| `home` | 跳到视频开始位置 | `end` | 跳到视频结束位置 |
|
||||
| `pgUp` | 播放倍速加快 0.25 | `pgDown` | 播放倍速减慢 0.25 |
|
||||
| `Alt + m` | 进入或退出 Mini 模式 | `space` | 播放或暂停 |
|
||||
| 快捷键 | 说明 | 快捷键 | 说明 |
|
||||
| :-----------: | ---------------------------- | :-------: | ----------------- |
|
||||
| `Alt + Space` | 聚焦或取消聚焦(全局快捷键) | | |
|
||||
| `→` | 快进 5 秒 | `←` | 快退 5 秒 |
|
||||
| `↑` | 音量调高 | `↓` | 音量调低 |
|
||||
| `m` | 静音 | `t` | 置顶或退出置顶 |
|
||||
| `f` | 进入或退出全屏 | `esc` | 退出全屏 |
|
||||
| `Alt + →` | 下一集 | `Alt + ←` | 上一集 |
|
||||
| `Alt + ↑` | 透明度调高 | `Alt + ↓` | 透明度调低 |
|
||||
| `home` | 跳到视频开始位置 | `end` | 跳到视频结束位置 |
|
||||
| `pgUp` | 播放倍速加快 0.25 | `pgDown` | 播放倍速减慢 0.25 |
|
||||
| `Alt + m` | 进入或退出 Mini 模式 | `space` | 播放或暂停 |
|
||||
|
||||
#### 下载:
|
||||
### 🎨 截图
|
||||
|
||||
1. [Github -- 官方下载](https://github.com/Hunlongyu/ZY-Player/releases)
|
||||
| 🥼 浏览 (海报模式) | 🧥 浏览 (列表模式) |
|
||||
| :----------------------------------------------------------: | :----------------------------------------------------------: |
|
||||
|  |  |
|
||||
| 👔 搜索 | 👕 详情 |
|
||||
|  |  |
|
||||
| 👖 播放 (普通模式) | 🩳 播放 (精简模式) |
|
||||
|  |  |
|
||||
| 🧣 历史记录 | 🧤 收藏夹 |
|
||||
|  |  |
|
||||
| 👗 白色主题 | 🥻 黑色主题 |
|
||||
|  |  |
|
||||
| 👘 绿色主题 | 👚 粉色主题 |
|
||||
|  |  |
|
||||
|
||||
2. [蓝奏云 -- 快速下载](https://www.lanzous.com/b04s6a3re) 密码:95px
|
||||
### 🍭 开发者
|
||||
|
||||
3. 适用于32位操作系统的x86软件,在蓝奏云网盘里, 后缀名: ZY Player * 32位.exe
|
||||
| [Hunlongyu](https://github.com/Hunlongyu) | [cuiocean](https://github.com/cuiocean) |
|
||||
| :----------------------------------------------------------: | :----------------------------------------------------------: |
|
||||
| <img width="120" src="https://avatars2.githubusercontent.com/u/15273630?s=460&u=48cf3299e2a842c0252233d8be42ef4c5d792138&v=4"/> | <img width="120" src="https://avatars0.githubusercontent.com/u/5760235?s=460&u=9d969dd8d83f069ce7ebd60516770c93ac07a330&v=4" /> |
|
||||
| 💻 🎨 🐛 | 💻 🐛 |
|
||||
|
||||
|
||||
|
||||
### 🧧 赞助
|
||||
|
||||
#### 赞助
|
||||
[](https://latopay.com/@Hunlongyu)
|
||||
|
||||
#### 截图:
|
||||
|
||||
1. 浏览 ⇣ ↓
|
||||

|
||||

|
||||
2. 搜索 ⇣ ↓
|
||||

|
||||
3. 详情 ⇣ ↓
|
||||

|
||||
4. 播放 ⇣ ↓
|
||||

|
||||

|
||||
5. 收藏 ⇣ ↓
|
||||

|
||||
6. 白色主题皮肤 ⇣ ↓
|
||||

|
||||
7. 绿色主题皮肤 ⇣ ↓
|
||||

|
||||
8. 粉色色主题皮肤 ⇣ ↓
|
||||

|
||||
|
||||
### 重要:
|
||||
所有资源来自网上, 该软件不参与任何制作, 上传, 储存, 下载等内容. 该软件仅供学习参考, 请于安装后24小时内删除.
|
||||
|
||||
## 开发指导
|
||||
软件基于nodejs, vue, electron, 如果想成为一个有追求的码农,你先考虑一下自己是否具备上述几个关键词的知识储备,如果没有,建议先百度了解下。这里的开发环境基于linux发行版mint, 其他大同小异,自行发挥。
|
||||
|
||||
### 准备环境
|
||||
|
||||
#### nodejs安装
|
||||
* [LINK1](https://nodejs.org/zh-cn/)
|
||||
* [LINK2](https://www.jianshu.com/p/13f45e24b1de/)
|
||||
|
||||
#### yarn新一代包管理器安利
|
||||
最近管理员用[yarn](https://yarn.bootcss.com/)替换了npm,本人测试后表示非常好用。。连翻墙都不想要了,强烈推荐, 安装好使用yarn代理npm命令即可, [官网安装向导](https://yarn.bootcss.com/docs/install/)
|
||||
|
||||
#### npm配置
|
||||
天朝的网络环境都有耳闻,想顺利开发,要么翻墙,要么镜像源,以下按照自己的水平二选一
|
||||
|
||||
#### 翻墙代理设置
|
||||
自备http代理,sock5代理转换,参考privoxy
|
||||
```bash
|
||||
设置代理
|
||||
npm config set proxy=http://127.0.0.1:8087
|
||||
npm config set registry=http://registry.npmjs.org
|
||||
|
||||
|
||||
关于https
|
||||
经过上面设置使用了http开头的源,因此不需要设https_proxy了,否则还要增加一句:
|
||||
|
||||
npm config set https-proxy http://server:port
|
||||
|
||||
代理用户名和密码
|
||||
npm config set proxy http://username:password@server:port
|
||||
npm confit set https-proxy http://username:password@server:port
|
||||
|
||||
取消代理
|
||||
npm config delete proxy
|
||||
npm config delete https-proxy
|
||||
```
|
||||
|
||||
#### 镜像源设置
|
||||
这里使用阿里的npm镜像
|
||||
```bash
|
||||
npm install -g cnpm --registry=https://registry.npm.taobao.org
|
||||
```
|
||||
搞定后使用cnpm代替所有的npm命令即可,切记使用一致,切记切记
|
||||
|
||||
* [参考网页链接](https://developer.aliyun.com/mirror/NPM?from=tnpm)
|
||||
|
||||
### 代码IDE
|
||||
随心所欲吧,这里安利vscode
|
||||
|
||||
### 安装依赖
|
||||
```bash
|
||||
npm install
|
||||
or
|
||||
cnpm install
|
||||
```
|
||||
### 调试开发
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### 打包发布
|
||||
```
|
||||
npm run electron:build
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zy",
|
||||
"version": "2.4.0",
|
||||
"version": "2.4.9",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
@@ -18,6 +18,8 @@
|
||||
"main": "background.js",
|
||||
"dependencies": {
|
||||
"axios": "^0.19.2",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"child_process": "^1.0.2",
|
||||
"core-js": "^3.6.5",
|
||||
"cors": "^2.8.5",
|
||||
"dexie": "^3.0.1",
|
||||
@@ -29,9 +31,11 @@
|
||||
"modern-normalize": "^0.6.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"qrcode.vue": "^1.7.0",
|
||||
"randomstring": "^1.1.5",
|
||||
"vue": "^2.6.11",
|
||||
"vue-infinite-loading": "^2.4.5",
|
||||
"vue-waterfall-plugin": "^1.0.7",
|
||||
"vuedraggable": "^2.24.1",
|
||||
"vuex": "^3.4.0",
|
||||
"xgplayer": "^2.9.10",
|
||||
"xgplayer-hls.js": "^2.2.3"
|
||||
|
||||
58
src/App.vue
58
src/App.vue
@@ -15,15 +15,68 @@
|
||||
<transition name="slide">
|
||||
<Share v-if="share.show"/>
|
||||
</transition>
|
||||
<transition name="slide">
|
||||
<EditSites v-if="editSites.show"/>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { setting } from './lib/dexie'
|
||||
const { remote } = require('electron')
|
||||
export default {
|
||||
name: 'App',
|
||||
data () {
|
||||
return {
|
||||
appTheme: 'theme-light'
|
||||
appTheme: 'theme-light',
|
||||
winSizePosition: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
// 窗口创建口,检查是否有窗口大小位置的记录,如果有的话,更新窗口位置及大小
|
||||
setting.find().then(res => {
|
||||
if (res.windowSizePosition) {
|
||||
var win = remote.getCurrentWindow()
|
||||
win.setBounds({
|
||||
x: res.windowSizePosition.x,
|
||||
y: res.windowSizePosition.y,
|
||||
width: res.windowSizePosition.width,
|
||||
height: res.windowSizePosition.height
|
||||
})
|
||||
}
|
||||
})
|
||||
var win = remote.getCurrentWindow()
|
||||
this.winSizePosition = {
|
||||
x: win.getPosition()[0],
|
||||
y: win.getPosition()[1],
|
||||
width: win.getSize()[0],
|
||||
height: win.getSize()[1]
|
||||
}
|
||||
},
|
||||
updated () {
|
||||
// 本来想hook up到beforedestroy, 但不工作
|
||||
// 每当窗口更新时,检查窗口大小及位置,记录到setting数据库中
|
||||
const win = remote.getCurrentWindow()
|
||||
var newWinSizePosition = {
|
||||
x: win.getPosition()[0],
|
||||
y: win.getPosition()[1],
|
||||
width: win.getSize()[0],
|
||||
height: win.getSize()[1]
|
||||
}
|
||||
if (newWinSizePosition.x !== this.winSizePosition.x ||
|
||||
newWinSizePosition.y !== this.winSizePosition.y ||
|
||||
newWinSizePosition.width !== this.winSizePosition.width ||
|
||||
newWinSizePosition.height !== this.winSizePosition.height) {
|
||||
this.winSizePosition = newWinSizePosition
|
||||
setting.find().then(res => {
|
||||
res.windowSizePosition = newWinSizePosition
|
||||
setting.update(res)
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -38,6 +91,9 @@ export default {
|
||||
},
|
||||
setting () {
|
||||
return this.$store.getters.getSetting
|
||||
},
|
||||
editSites () {
|
||||
return this.$store.getters.getEditSites
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -78,15 +78,21 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
.zy-input{
|
||||
position: relative;
|
||||
display: flex;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
width: 200px;
|
||||
height: 30px;
|
||||
vertical-align: middle;
|
||||
align-items: center;
|
||||
.search-all-check-input{
|
||||
cursor: pointer;
|
||||
cursor: pointer;
|
||||
input{
|
||||
vertical-align: bottom;
|
||||
position: relative;
|
||||
border: none;
|
||||
width: 20px;
|
||||
height: 15px;
|
||||
background-color: #ffffff00;
|
||||
text-indent: 10px;
|
||||
}
|
||||
}
|
||||
.zy-highlighted{
|
||||
@@ -101,13 +107,14 @@
|
||||
.tHeader{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
height: 50px;
|
||||
min-height: 50px;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid;
|
||||
.btn{
|
||||
user-select: none;
|
||||
margin-left: 15px;
|
||||
margin-right: 15px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
}
|
||||
}
|
||||
.vs-input{
|
||||
color: var(--d-fc-1);
|
||||
background-color: var(--d-bgc-1);
|
||||
input{
|
||||
color: var(--d-fc-1);
|
||||
&::-webkit-input-placeholder{
|
||||
@@ -32,6 +34,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-input{
|
||||
color: var(--d-fc-1);
|
||||
background-color: var(--d-bgc-1);
|
||||
input{
|
||||
color: var(--d-fc-1);
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
color: var(--d-fc-1);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
|
||||
@@ -32,6 +32,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-input{
|
||||
color: var(--g-fc-1);
|
||||
background-color: var(--g-bgc-1);
|
||||
input{
|
||||
color: var(--g-fc-1);
|
||||
background-color: var(--g-bgc-1);
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
color: var(--g-fc-1);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-input{
|
||||
color: var(--l-fc-1);
|
||||
background-color: var(--l-bgc-1);
|
||||
input{
|
||||
color: var(--l-fc-1);
|
||||
background-color: var(--l-bgc-1);
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
color: var(--l-fc-1);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-input{
|
||||
color: var(--p-fc-1);
|
||||
background-color: var(--p-bgc-1);
|
||||
input{
|
||||
color: var(--p-fc-1);
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
color: var(--p-fc-1);
|
||||
}
|
||||
|
||||
@@ -54,12 +54,37 @@ export default {
|
||||
set (val) {
|
||||
this.SET_VIEW(val)
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
get () {
|
||||
return this.$store.getters.getDetail
|
||||
},
|
||||
set (val) {
|
||||
this.SET_DETAIL(val)
|
||||
}
|
||||
},
|
||||
editSites: {
|
||||
get () {
|
||||
return this.$store.getters.getEditSites
|
||||
},
|
||||
set (val) {
|
||||
this.SET_EDITSITES(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW']),
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_EDITSITES']),
|
||||
changeView (e) {
|
||||
this.view = e
|
||||
// ChangeView 的时候关闭Detail和EditSites页面
|
||||
this.detail = {
|
||||
show: false
|
||||
}
|
||||
if (this.editSites.show === true) {
|
||||
this.editSites = {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<div class="year" v-show="info.year">上映: {{info.year}}</div>
|
||||
<div class="last" v-show="info.last">更新: {{info.last}}</div>
|
||||
<div class="note" v-show="info.note">备注: {{info.note}}</div>
|
||||
<div class="rate" v-show="info.rate">豆瓣评分: {{info.rate}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operate">
|
||||
@@ -32,6 +33,16 @@
|
||||
<span @click="starEvent">收藏</span>
|
||||
<span @click="downloadEvent">下载</span>
|
||||
<span @click="shareEvent">分享</span>
|
||||
<span @click="doubanLinkEvent">豆瓣</span>
|
||||
<span @click="togglePlayOnlineEvent">
|
||||
<input type="checkbox" v-model="playOnline"> 播放在线高清视频
|
||||
</span>
|
||||
<span>
|
||||
<select v-model="selectedOnlineSite" class="vs-options">
|
||||
<option disabled value="">Please select one</option>
|
||||
<option v-for="(i, j) in onlineSites" :key="j">{{i}}</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
<div class="desc" v-show="info.des">{{info.des}}</div>
|
||||
<div class="m3u8">
|
||||
@@ -49,6 +60,7 @@
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import zy from '../lib/site/tools'
|
||||
import onlineVideo from '../lib/site/onlineVideo'
|
||||
import { star, history } from '../lib/dexie'
|
||||
const { clipboard } = require('electron')
|
||||
export default {
|
||||
@@ -57,7 +69,10 @@ export default {
|
||||
return {
|
||||
loading: true,
|
||||
m3u8List: [],
|
||||
info: {}
|
||||
info: {},
|
||||
playOnline: false,
|
||||
selectedOnlineSite: '哔嘀',
|
||||
onlineSites: ['哔嘀', '素白白', '简影', '1080影视']
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -119,25 +134,44 @@ export default {
|
||||
}
|
||||
},
|
||||
playEvent (n) {
|
||||
history.find({ site: this.detail.key, ids: this.detail.info.id }).then(res => {
|
||||
if (res) {
|
||||
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: n, site: this.detail.site } }
|
||||
} else {
|
||||
this.video = { key: this.detail.key, info: { id: this.detail.info.id, name: this.detail.info.name, index: n, site: this.detail.site } }
|
||||
}
|
||||
})
|
||||
|
||||
this.view = 'Play'
|
||||
this.detail.show = false
|
||||
if (!this.playOnline) {
|
||||
history.find({ site: this.detail.key, ids: this.detail.info.id }).then(res => {
|
||||
if (res) {
|
||||
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: n, site: this.detail.site } }
|
||||
} else {
|
||||
this.video = { key: this.detail.key, info: { id: this.detail.info.id, name: this.detail.info.name, index: n, site: this.detail.site } }
|
||||
}
|
||||
})
|
||||
this.view = 'Play'
|
||||
this.detail.show = false
|
||||
} else {
|
||||
history.find({ site: this.detail.key, ids: this.detail.info.id }).then(res => {
|
||||
if (res) {
|
||||
res.index = n
|
||||
history.update(res.id, res)
|
||||
} else {
|
||||
const doc = {
|
||||
site: this.detail.key,
|
||||
ids: this.detail.info.id,
|
||||
name: this.detail.info.name,
|
||||
type: this.detail.info.type,
|
||||
year: this.detail.info.year,
|
||||
index: n,
|
||||
time: ''
|
||||
}
|
||||
history.add(doc)
|
||||
}
|
||||
})
|
||||
this.playVideoOnline(this.detail.info.name, n)
|
||||
}
|
||||
},
|
||||
starEvent () {
|
||||
star.find({ key: this.detail.key, ids: this.info.id }).then(res => {
|
||||
if (res) {
|
||||
this.$message.info('已存在')
|
||||
this.$message.info('该影片已被收藏')
|
||||
} else {
|
||||
const docs = {
|
||||
key: this.detail.site.key,
|
||||
site: this.detail.site,
|
||||
key: this.detail.key,
|
||||
ids: this.info.id,
|
||||
name: this.info.name,
|
||||
type: this.info.type,
|
||||
@@ -153,9 +187,36 @@ export default {
|
||||
this.$message.warning('收藏失败')
|
||||
})
|
||||
},
|
||||
togglePlayOnlineEvent () {
|
||||
this.playOnline = !this.playOnline
|
||||
},
|
||||
playVideoOnline (videoName, videoIndex) {
|
||||
switch (this.selectedOnlineSite) {
|
||||
case '哔嘀':
|
||||
onlineVideo.playVideoOnBde4(videoName, videoIndex)
|
||||
break
|
||||
case '1080影视':
|
||||
onlineVideo.playVideoOnK1080(videoName, videoIndex)
|
||||
break
|
||||
case '素白白':
|
||||
onlineVideo.playVideoOnSubaibai(videoName, videoIndex)
|
||||
break
|
||||
case '哆咪动漫':
|
||||
onlineVideo.playVideoOndmdm2020(videoName, videoIndex)
|
||||
break
|
||||
case '樱花动漫':
|
||||
onlineVideo.playVideoOnYhdm(videoName, videoIndex)
|
||||
break
|
||||
case '简影':
|
||||
onlineVideo.playVideoOnSyrme(videoName, videoIndex)
|
||||
break
|
||||
default:
|
||||
this.$message.console.error(`不支持该网站:${this.selectedOnlineSite}`)
|
||||
}
|
||||
},
|
||||
downloadEvent () {
|
||||
zy.download(this.detail.key, this.info.id).then(res => {
|
||||
if (res) {
|
||||
if (res && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
@@ -188,12 +249,72 @@ export default {
|
||||
info: this.detail.info
|
||||
}
|
||||
},
|
||||
doubanLinkEvent () {
|
||||
const open = require('open')
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const name = this.detail.info.name.trim()
|
||||
// 豆瓣搜索链接
|
||||
var doubanSearchLink = 'https://www.douban.com/search?q=' + name
|
||||
var link = doubanSearchLink
|
||||
axios.get(doubanSearchLink).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
// 比较第一和第二豆瓣搜索结果, 如果名字相符, 就打开该链接,否则打开搜索页面
|
||||
var nameInDouban = $($('div.result')[0]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
} else {
|
||||
nameInDouban = $($('div.result')[1]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
}
|
||||
}
|
||||
open(link)
|
||||
})
|
||||
},
|
||||
getDoubanRate () {
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const name = this.detail.info.name.trim()
|
||||
// 豆瓣搜索链接
|
||||
var doubanSearchLink = 'https://www.douban.com/search?q=' + name
|
||||
axios.get(doubanSearchLink).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
// 比较第一和第二给豆瓣搜索结果, 看名字是否相符
|
||||
var link = ''
|
||||
var nameInDouban = $($('div.result')[0]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
} else {
|
||||
nameInDouban = $($('div.result')[1]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
}
|
||||
}
|
||||
// 如果找到链接,就打开该链接获取评分
|
||||
if (link) {
|
||||
axios.get(link).then(response => {
|
||||
const parsedHtml = cheerio.load(response.data)
|
||||
var rating = parsedHtml('body').find('#interest_sectl').first().find('strong').first()
|
||||
if (rating.text()) {
|
||||
this.info.rate = rating.text()
|
||||
} else {
|
||||
this.info.rate = '暂无评分'
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.info.rate = '暂无评分'
|
||||
}
|
||||
})
|
||||
},
|
||||
getDetailInfo () {
|
||||
const id = this.detail.info.ids || this.detail.info.id
|
||||
zy.detail(this.detail.key, id).then(res => {
|
||||
if (res) {
|
||||
this.info = res
|
||||
this.$set(this.info, 'rate', '')
|
||||
this.m3u8Parse(res)
|
||||
this.getDoubanRate()
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
@@ -207,9 +328,10 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.detail{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
left: 80px;
|
||||
right: 20px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
width: calc(100% - 100px);
|
||||
height: calc(100% - 40px);
|
||||
z-index: 888;
|
||||
.detail-content{
|
||||
@@ -264,6 +386,11 @@ export default {
|
||||
font-size: 14px;
|
||||
line-height: 26px;
|
||||
}
|
||||
.rate{
|
||||
font-size: 16px;
|
||||
line-height: 26px;
|
||||
font-weight: bolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
.operate{
|
||||
|
||||
200
src/components/EditSites.vue
Normal file
200
src/components/EditSites.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<div class="detail">
|
||||
<div class="detail-content">
|
||||
<div class="detail-header">
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="openAddSite">添加新源</div>
|
||||
</div>
|
||||
<span class="detail-close zy-svg" @click="close">
|
||||
<svg role="img" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-labelledby="closeIconTitle">
|
||||
<title id="closeIconTitle">关闭</title>
|
||||
<path d="M6.34314575 6.34314575L17.6568542 17.6568542M6.34314575 17.6568542L17.6568542 6.34314575"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
<div class="detail-body zy-scroll">
|
||||
<div class="zy-table">
|
||||
<div class="tBody zy-scroll">
|
||||
<div class="addSites-box zy-scroll" v-show="showAddSite">
|
||||
<ul>
|
||||
<li >
|
||||
<span class="name">源名称</span>
|
||||
<span class="name">API接口</span>
|
||||
<span class="name">DOWNLOAD接口</span>
|
||||
<span class="operate">
|
||||
<span class="btn"></span>
|
||||
<span class="btn"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="name" style="display:inline-block;vertical-align:middle">
|
||||
<input style="height: 30px" v-model="newSite.name">
|
||||
</span>
|
||||
<span class="name" style="display:inline-block;vertical-align:middle">
|
||||
<input style="height: 30px" v-model="newSite.api">
|
||||
</span>
|
||||
<span class="name" style="display:inline-block;vertical-align:middle">
|
||||
<input style="height: 30px" v-model="newSite.download" placeholder="可以为空">
|
||||
</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click="addNewSite">添加</span>
|
||||
<span class="btn" @click="closeAddSite">关闭</span>
|
||||
</span>
|
||||
</li>
|
||||
<li ></li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul>
|
||||
<draggable v-model="sites" @change="listUpdatedEvent">
|
||||
<transition-group>
|
||||
<li v-for="(i, j) in sites" :key="j">
|
||||
<span class="name">{{i.name}}</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="removeEvent(i)">删除</span>
|
||||
</span>
|
||||
</li>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { sites } from '../lib/dexie'
|
||||
import draggable from 'vuedraggable'
|
||||
export default {
|
||||
name: 'editSites',
|
||||
data () {
|
||||
return {
|
||||
show: false,
|
||||
sites: [],
|
||||
showAddSite: false,
|
||||
newSite: {
|
||||
name: '',
|
||||
api: '',
|
||||
download: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
draggable
|
||||
},
|
||||
computed: {
|
||||
setting: {
|
||||
get () {
|
||||
return this.$store.getters.getSetting
|
||||
},
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
},
|
||||
editSites: {
|
||||
get () {
|
||||
return this.$store.getters.getEditSites
|
||||
},
|
||||
set (val) {
|
||||
this.SET_EDITSITES(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_SETTING', 'SET_EDITSITES']),
|
||||
close () {
|
||||
this.editSites.show = false
|
||||
},
|
||||
getSites () {
|
||||
sites.all().then(res => {
|
||||
this.sites = res
|
||||
})
|
||||
},
|
||||
removeEvent (e) {
|
||||
sites.remove(e.id).then(res => {
|
||||
this.getSites()
|
||||
}).catch(err => {
|
||||
this.$message.warning('删除源失败, 错误信息: ' + err)
|
||||
})
|
||||
},
|
||||
listUpdatedEvent () {
|
||||
sites.clear().then(res1 => {
|
||||
// 重新排序
|
||||
var id = 1
|
||||
this.sites.forEach(element => {
|
||||
element.id = id
|
||||
sites.add(element)
|
||||
id += 1
|
||||
})
|
||||
})
|
||||
},
|
||||
openAddSite () {
|
||||
this.showAddSite = true
|
||||
},
|
||||
closeAddSite () {
|
||||
this.showAddSite = false
|
||||
},
|
||||
addNewSite () {
|
||||
if (!this.newSite.name || !this.newSite.api) {
|
||||
this.$message.error('名称和API接口不能为空。')
|
||||
return
|
||||
}
|
||||
var randomstring = require('randomstring')
|
||||
var doc = {
|
||||
key: randomstring.generate(6),
|
||||
id: this.sites[this.sites.length - 1].id + 1,
|
||||
name: this.newSite.name,
|
||||
api: this.newSite.api,
|
||||
download: this.newSite.download
|
||||
}
|
||||
sites.add(doc).then(res => {
|
||||
this.newSite = {
|
||||
name: '',
|
||||
api: '',
|
||||
download: ''
|
||||
}
|
||||
this.$message.success('添加新源成功!')
|
||||
this.getSites()
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getSites()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.detail{
|
||||
position: absolute;
|
||||
left: 80px;
|
||||
right: 20px;
|
||||
bottom: 0;
|
||||
width: calc(100% - 100px);
|
||||
height: calc(100% - 40px);
|
||||
z-index: 888;
|
||||
.detail-content{
|
||||
height: calc(100% - 10px);
|
||||
padding: 0 60px;
|
||||
position: relative;
|
||||
.detail-header{
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.detail-title{
|
||||
font-size: 16px;
|
||||
}
|
||||
.detail-close{
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
.detail-body{
|
||||
height: calc(100% - 50px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -35,7 +35,7 @@
|
||||
animationEffect="fadeInUp"
|
||||
backgroundColor="rgba(0, 0, 0, 0)">
|
||||
<template slot="item" slot-scope="props">
|
||||
<div class="card">
|
||||
<div class="card" v-show="!setting.excludeR18Films || !containsR18Keywords(props.data.type)">
|
||||
<div class="img">
|
||||
<img style="width: 100%" :src="props.data.pic" alt="" @load="$refs.waterfall.refresh()" @click="detailEvent(site, props.data)">
|
||||
<div class="operate">
|
||||
@@ -49,6 +49,7 @@
|
||||
<div class="name" @click="detailEvent(site, props.data)">{{props.data.name}}</div>
|
||||
<div class="info">
|
||||
<span>{{props.data.year}}</span>
|
||||
<span>{{props.data.note}}</span>
|
||||
<span>{{props.data.type}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,10 +61,11 @@
|
||||
<div class="zy-table">
|
||||
<div class="tBody">
|
||||
<ul>
|
||||
<li v-for="(i, j) in list" :key="j" @click="detailEvent(site, i)">
|
||||
<li v-for="(i, j) in list" :key="j" @click="detailEvent(site, i)" v-show="!setting.excludeR18Films || !containsR18Keywords(i.type)">
|
||||
<span class="name">{{i.name}}</span>
|
||||
<span class="type">{{i.type}}</span>
|
||||
<span class="time">{{i.year}}</span>
|
||||
<span class="time">{{i.note}}</span>
|
||||
<span class="last">{{i.last}}</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="playEvent(site, i)">播放</span>
|
||||
@@ -134,7 +136,9 @@ export default {
|
||||
infiniteId: +new Date(),
|
||||
searchList: [],
|
||||
searchTxt: '',
|
||||
searchContents: []
|
||||
searchContents: [],
|
||||
// 福利片关键词
|
||||
r18KeyWords: ['伦理', '倫理', '福利', '激情', '理论', '写真', '情色', '美女', '街拍', '赤足', '性感', '里番']
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -185,11 +189,14 @@ export default {
|
||||
searchTxt () {
|
||||
this.searchChangeEvent()
|
||||
},
|
||||
'setting.site': {
|
||||
'setting.sitesList': {
|
||||
handler (nv) {
|
||||
this.getAllsites(nv)
|
||||
this.getAllsites()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
'$store.state.editSites.sites': function () {
|
||||
this.getAllsites()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -225,17 +232,39 @@ export default {
|
||||
getClass () {
|
||||
return new Promise((resolve, reject) => {
|
||||
const key = this.site.key
|
||||
// 屏蔽主分类
|
||||
const classToHide = ['电影', '电影片', '电视剧', '连续剧', '综艺', '动漫']
|
||||
zy.class(key).then(res => {
|
||||
this.classList = res.class
|
||||
var allClass = [{ name: '最新', tid: 0 }]
|
||||
res.class.forEach(element => {
|
||||
if (!classToHide.includes(element.name)) {
|
||||
if (this.setting.excludeR18Films) {
|
||||
const containKeyWord = this.containsR18Keywords(element.name)
|
||||
if (!containKeyWord) {
|
||||
allClass.push(element)
|
||||
}
|
||||
} else {
|
||||
allClass.push(element)
|
||||
}
|
||||
}
|
||||
})
|
||||
this.classList = allClass
|
||||
this.show.class = true
|
||||
this.pagecount = res.pagecount
|
||||
this.type = { name: '最新', tid: 0 }
|
||||
this.type = this.classList[0]
|
||||
resolve(true)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
containsR18Keywords (name) {
|
||||
var containKeyWord = false
|
||||
if (!name) {
|
||||
return containKeyWord
|
||||
}
|
||||
return this.r18KeyWords.some(v => name.includes(v))
|
||||
},
|
||||
getPage () {
|
||||
return new Promise((resolve, reject) => {
|
||||
const key = this.site.key
|
||||
@@ -265,7 +294,8 @@ export default {
|
||||
$state.complete()
|
||||
}
|
||||
if (type === '[object Array]') {
|
||||
this.list.push(...res)
|
||||
// zy.list 返回的是按时间从旧到新排列, 我门需要翻转为从新到旧
|
||||
this.list.push(...res.reverse())
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
this.list.push(res)
|
||||
@@ -301,7 +331,6 @@ export default {
|
||||
} else {
|
||||
const docs = {
|
||||
key: site.key,
|
||||
site: site,
|
||||
ids: e.id,
|
||||
name: e.name,
|
||||
type: e.type,
|
||||
@@ -326,7 +355,7 @@ export default {
|
||||
},
|
||||
downloadEvent (site, e) {
|
||||
zy.download(site.key, e.id).then(res => {
|
||||
if (res.length > 0) {
|
||||
if (res && res.length > 0 && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
@@ -393,12 +422,9 @@ export default {
|
||||
}
|
||||
this.getAllSearch()
|
||||
})
|
||||
sites.forEach(site =>
|
||||
sites.forEach(site => {
|
||||
zy.search(site.key, wd).then(res => {
|
||||
const type = Object.prototype.toString.call(res)
|
||||
if (type === '[object Undefined]') {
|
||||
this.$message.info(site.name + ' 无搜索结果')
|
||||
}
|
||||
if (type === '[object Array]') {
|
||||
res.forEach(element => {
|
||||
element.site = site
|
||||
@@ -410,7 +436,7 @@ export default {
|
||||
this.searchContents.push(res)
|
||||
}
|
||||
})
|
||||
)
|
||||
})
|
||||
} else {
|
||||
this.show.find = false
|
||||
this.getClass().then(res => {
|
||||
|
||||
@@ -3,17 +3,30 @@
|
||||
<div class="body zy-scroll">
|
||||
<div class="zy-table">
|
||||
<div class="tHeader">
|
||||
<span class="btn"></span>
|
||||
<span class="btn" @click="clearAllHistory">清空</span>
|
||||
</div>
|
||||
<div class="tBody zy-scroll">
|
||||
<ul>
|
||||
<li v-show="this.history.length === 0">无数据</li>
|
||||
<li v-show="this.history.length > 0">
|
||||
<span class="name">名字</span>
|
||||
<span class="site">片源</span>
|
||||
<span class="note">观看至</span>
|
||||
<span class="operate">
|
||||
<span class="btn"></span>
|
||||
<span class="btn"></span>
|
||||
<span class="btn"></span>
|
||||
<span class="btn"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li v-for="(i, j) in history" :key="j" @click="historyItemEvent(i)">
|
||||
<span class="name" @click.stop="playEvent(i)">{{i.name}}</span>
|
||||
<span class="name" @click.stop="detailEvent(i)">{{i.name}}</span>
|
||||
<span class="site">{{getSiteName(i.site)}}</span>
|
||||
<span class="note">第{{i.index+1}}集</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="playEvent(i)">播放</span>
|
||||
<span class="btn" @click.stop="shareEvent(i)">分享</span>
|
||||
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
|
||||
<span class="btn" @click.stop="removeHistoryItem(i)">删除</span>
|
||||
</span>
|
||||
@@ -99,9 +112,16 @@ export default {
|
||||
})
|
||||
this.view = 'Play'
|
||||
},
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: e.site,
|
||||
info: e
|
||||
}
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(e.site, e.ids).then(res => {
|
||||
if (res) {
|
||||
if (res && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
@@ -116,14 +136,28 @@ export default {
|
||||
this.$message.warning('没有查询到下载链接.')
|
||||
}
|
||||
} else {
|
||||
const list = [...this.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
var m3u8List = {}
|
||||
zy.detail(e.site, e.ids).then(res => {
|
||||
const dd = res.dl.dd
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
m3u8List = i._t.split('#')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m3u8List = dd._t.split('#')
|
||||
}
|
||||
const list = [...m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
<div class="box">
|
||||
<div class="title">
|
||||
<span v-if="this.right.list.length > 1">『第 {{(video.info.index + 1)}} 集』</span>{{name}}
|
||||
<span v-if="video.key" class="right" @click="playWithExternalPalyerEvent" title="使用第三方播放器">
|
||||
<svg role="img" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<polygon points="20 8 20 20 4 20 4 8"></polygon>
|
||||
<polyline stroke-linejoin="round" points="8 4 12 7.917 16 4"></polyline>
|
||||
</svg>
|
||||
</span>
|
||||
<span v-if="video.key" class="right" @click="issueEvent" title="复制调试信息">
|
||||
<svg t="1596338860607" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3127" width="24" height="24">
|
||||
<path d="M503.803829 63.578014c-247.050676 0-447.328072 200.277396-447.328072 447.327048 0 247.054769 200.277396 447.333188 447.328072 447.333188 247.054769 0 447.332165-200.278419 447.332165-447.333188C951.13497 263.85541 750.858598 63.578014 503.803829 63.578014L503.803829 63.578014zM503.803829 894.313336c-211.749682 0-383.408273-171.659615-383.408273-383.408273 0-211.749682 171.659615-383.40725 383.408273-383.40725 211.753775 0 383.412366 171.658591 383.412366 383.40725C887.216195 722.653721 715.557604 894.313336 503.803829 894.313336L503.803829 894.313336zM447.745069 255.897158l127.914298 0L575.659367 383.576095 447.745069 383.576095 447.745069 255.897158 447.745069 255.897158zM447.745069 425.470251l127.914298 0 0 342.058516L447.745069 767.528767 447.745069 425.470251 447.745069 425.470251zM447.745069 425.470251" p-id="3128"></path>
|
||||
@@ -378,7 +384,6 @@ export default {
|
||||
history.find({ site: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
if (res) {
|
||||
const doc = {
|
||||
id: res.id,
|
||||
site: res.site,
|
||||
ids: res.ids,
|
||||
name: res.name,
|
||||
@@ -387,7 +392,8 @@ export default {
|
||||
index: this.video.info.index,
|
||||
time: res.time
|
||||
}
|
||||
history.update(res.id, doc)
|
||||
history.remove(res.id)
|
||||
history.add(doc)
|
||||
} else {
|
||||
const doc = {
|
||||
site: this.video.key,
|
||||
@@ -401,6 +407,7 @@ export default {
|
||||
history.add(doc)
|
||||
}
|
||||
})
|
||||
this.updateStar()
|
||||
this.timerEvent()
|
||||
},
|
||||
changeVideo () {
|
||||
@@ -459,23 +466,34 @@ export default {
|
||||
this.right.history = res.reverse()
|
||||
})
|
||||
},
|
||||
starEvent () {
|
||||
updateStar () {
|
||||
const info = this.video.info
|
||||
star.find({ key: this.video.key, ids: info.id }).then(res => {
|
||||
if (res) {
|
||||
this.$message.info('已存在')
|
||||
res.index = info.index
|
||||
star.update(res.id, res)
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.warning('检查收藏失败')
|
||||
})
|
||||
},
|
||||
starEvent () {
|
||||
const info = this.video.info
|
||||
star.find({ key: this.video.key, ids: info.id }).then(res => {
|
||||
const doc = {
|
||||
key: this.video.key,
|
||||
ids: info.id,
|
||||
name: info.name,
|
||||
type: info.type,
|
||||
year: info.year,
|
||||
last: info.last,
|
||||
note: info.note,
|
||||
index: info.index
|
||||
}
|
||||
if (res) {
|
||||
star.update(res.id, doc)
|
||||
} else {
|
||||
const docs = {
|
||||
key: this.video.key,
|
||||
site: this.video.site,
|
||||
ids: info.id,
|
||||
name: info.name,
|
||||
type: info.type,
|
||||
year: info.year,
|
||||
last: info.last,
|
||||
note: info.note
|
||||
}
|
||||
star.add(docs).then(res => {
|
||||
star.add(doc).then(starRes => {
|
||||
this.$message.success('收藏成功')
|
||||
this.isStar = true
|
||||
})
|
||||
@@ -535,8 +553,47 @@ export default {
|
||||
clipboard.writeText(JSON.stringify(info, null, 4))
|
||||
this.$message.success('视频信息复制成功')
|
||||
},
|
||||
playWithExternalPalyerEvent () {
|
||||
this.fetchM3u8List().then(m3u8Arr => {
|
||||
const fs = require('fs')
|
||||
var externalPlayer = this.setting.externalPlayer
|
||||
if (!externalPlayer) {
|
||||
this.$message.error('请设置第三方播放器路径')
|
||||
// 在线播放该视频
|
||||
var link = 'https://www.m3u8play.com/?play=' + m3u8Arr[this.video.info.index]
|
||||
const open = require('open')
|
||||
open(link)
|
||||
} else {
|
||||
var m3uFile = this.generateM3uFile(this.video.info.name, m3u8Arr, this.video.info.index)
|
||||
if (fs.existsSync(externalPlayer)) {
|
||||
var execFile = require('child_process').execFile
|
||||
execFile(externalPlayer, [m3uFile])
|
||||
} else {
|
||||
var exec = require('child_process').exec
|
||||
exec(externalPlayer, [m3uFile])
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
generateM3uFile (fileName, m3u8Arr, startIndex) {
|
||||
const path = require('path')
|
||||
const os = require('os')
|
||||
const fs = require('fs')
|
||||
var filePath = path.join(os.tmpdir(), fileName + '.m3u')
|
||||
if (fs.existsSync(filePath)) {
|
||||
fs.unlinkSync(filePath)
|
||||
}
|
||||
var str = '#EXTM3U' + os.EOL
|
||||
for (let ind = startIndex; ind < m3u8Arr.length; ind++) {
|
||||
str += `#EXTINF: -1, 第${ind + 1}集` + os.EOL
|
||||
str += m3u8Arr[ind] + os.EOL
|
||||
}
|
||||
str += '#EXT-X-ENDLIST' + os.EOL
|
||||
fs.writeFileSync(filePath, str)
|
||||
return filePath
|
||||
},
|
||||
checkStar () {
|
||||
star.find({ site: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
star.find({ key: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
if (res) {
|
||||
this.isStar = true
|
||||
} else {
|
||||
@@ -656,13 +713,13 @@ export default {
|
||||
}
|
||||
if (e === 'forward') {
|
||||
if (this.xg && !this.xg.paused) {
|
||||
this.xg.currentTime += 5
|
||||
this.xg.currentTime += parseInt(this.setting.forwardTimeInSec)
|
||||
}
|
||||
return false
|
||||
}
|
||||
if (e === 'back') {
|
||||
if (this.xg && !this.xg.paused) {
|
||||
this.xg.currentTime -= 5
|
||||
this.xg.currentTime -= parseInt(this.setting.forwardTimeInSec)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
<div class="info">
|
||||
<a @click="linkOpen('http://zyplayer.fun/')">官网</a>
|
||||
<a @click="linkOpen('https://github.com/Hunlongyu/ZY-Player')">Github</a>
|
||||
<a @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/issues')">v{{pkg.version}} 反馈</a>
|
||||
<a @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/issues')">当前版本v{{pkg.version}} 反馈</a>
|
||||
<a style="color:#38dd77" @click="linkOpen('https://github.com/Hunlongyu/ZY-Player/releases/tag/v' + latestVersion)" v-show="latestVersion !== pkg.version" >最新版本v{{latestVersion}}</a>
|
||||
</div>
|
||||
<div class="view">
|
||||
<div class="title">视图</div>
|
||||
@@ -39,37 +40,54 @@
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="impShortcut">导入</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="openDoc('shortcut')">说明文档</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="site">
|
||||
<div class="title">定位时间设置</div>
|
||||
<div class="zy-input">
|
||||
左/右方向键:<input style="width:50px" type="number" v-model = "d.forwardTimeInSec" @change="updateSettingEvent($event)">秒
|
||||
</div>
|
||||
</div>
|
||||
<div class='search'>
|
||||
<div class="title">搜索</div>
|
||||
<div class="zy-checkbox">
|
||||
<input type="checkbox" v-model="setting.searchAllSites" @change="updateSearchOption($event)"> 搜索所有资源
|
||||
<div class="zy-input" @click="toggleSearchAllSites">
|
||||
<input type="checkbox" v-model="d.searchAllSites" @change="updateSettingEvent($event)"> 搜索所有资源
|
||||
</div>
|
||||
</div>
|
||||
<div class='site'>
|
||||
<div class="title">第三方播放</div>
|
||||
<div class="site-box">
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="selectLocalPlayer">选择本地播放器</div>
|
||||
</div>
|
||||
<div class="zy-select" @click = "editPlayerPath = true">
|
||||
<div class="vs-placeholder vs-noAfter" v-show = "editPlayerPath == false">
|
||||
<label>编辑</label>
|
||||
</div>
|
||||
<input class="zy-input" v-show = "editPlayerPath == true" v-model = "d.externalPlayer"
|
||||
@blur= "updateSettingEvent"
|
||||
@keyup.enter = "updateSettingEvent">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="site">
|
||||
<div class="title">源管理</div>
|
||||
<div class="site-box">
|
||||
<div class="zy-select" @mouseleave="show.site = false">
|
||||
<div class="vs-placeholder" @click="show.site = true">默认源</div>
|
||||
<div class="vs-options" v-show="show.site">
|
||||
<ul class="zy-scroll" style="height: 300px">
|
||||
<li :class="d.site === i.key ? 'active' : ''" v-for="(i, j) in sitesList" :key="j" @click="siteClick(i.key)">{{ i.name }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="exportSites">导出</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="expSites">导出</div>
|
||||
<div class="vs-placeholder vs-noAfter" @click="importSites">导入</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="impSites">导入</div>
|
||||
<div class="vs-placeholder vs-noAfter" @click="editSitesEvent">编辑源</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="openDoc('sites')">说明文档</div>
|
||||
<div class="vs-placeholder vs-noAfter" @click="resetSites">重置源</div>
|
||||
</div>
|
||||
<div class="zy-input" @click="toggleExcludeR18Films">
|
||||
<input type="checkbox" v-model="d.excludeR18Films" @change="updateSettingEvent($event)"> 屏蔽福利片
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="theme">
|
||||
@@ -121,9 +139,11 @@
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import pkg from '../../package.json'
|
||||
import { setting, sites, shortcut } from '../lib/dexie'
|
||||
import { setting, sites, shortcut, star } from '../lib/dexie'
|
||||
import { shell, clipboard, remote } from 'electron'
|
||||
import db from '../lib/dexie/dexie'
|
||||
import { sites as defaultSites } from '../lib/dexie/initData'
|
||||
import fs from 'fs'
|
||||
export default {
|
||||
name: 'setting',
|
||||
data () {
|
||||
@@ -131,18 +151,28 @@ export default {
|
||||
pkg: pkg,
|
||||
sitesList: [],
|
||||
shortcutList: [],
|
||||
favoritesList: [],
|
||||
show: {
|
||||
site: false,
|
||||
shortcut: false,
|
||||
view: false
|
||||
},
|
||||
externalPlayer: '',
|
||||
editPlayerPath: false,
|
||||
excludeR18Films: false,
|
||||
latestVersion: pkg.version,
|
||||
forwardTimeInSec: 5,
|
||||
d: {
|
||||
id: 0,
|
||||
site: '',
|
||||
theme: '',
|
||||
shortcut: true,
|
||||
searchAllSites: true,
|
||||
view: 'picture'
|
||||
view: 'picture',
|
||||
externalPlayer: '',
|
||||
editPlayerPath: false,
|
||||
excludeR18Films: true,
|
||||
forwardTimeInSec: 5
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -154,10 +184,18 @@ export default {
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
},
|
||||
editSites: {
|
||||
get () {
|
||||
return this.$store.getters.getEditSites
|
||||
},
|
||||
set (val) {
|
||||
this.SET_EDITSITES(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_SETTING']),
|
||||
...mapMutations(['SET_SETTING', 'SET_EDITSITES']),
|
||||
linkOpen (e) {
|
||||
shell.openExternal(e)
|
||||
},
|
||||
@@ -169,7 +207,11 @@ export default {
|
||||
theme: res.theme,
|
||||
shortcut: res.shortcut,
|
||||
view: res.view,
|
||||
searchAllSites: res.searchAllSites
|
||||
searchAllSites: res.searchAllSites ? res.searchAllSites : true,
|
||||
externalPlayer: res.externalPlayer,
|
||||
editPlayerPath: false,
|
||||
excludeR18Films: res.excludeR18Films ? res.excludeR18Films : true,
|
||||
forwardTimeInSec: res.forwardTimeInSec ? res.forwardTimeInSec : 5
|
||||
}
|
||||
this.setting = this.d
|
||||
})
|
||||
@@ -184,6 +226,11 @@ export default {
|
||||
this.shortcutList = res
|
||||
})
|
||||
},
|
||||
getFavorites () {
|
||||
star.all().then(res => {
|
||||
this.favoritesList = res
|
||||
})
|
||||
},
|
||||
changeView (e) {
|
||||
this.d.view = e
|
||||
setting.update(this.d).then(res => {
|
||||
@@ -200,30 +247,116 @@ export default {
|
||||
this.show.site = false
|
||||
})
|
||||
},
|
||||
updateSearchOption (e) {
|
||||
this.d.searchAllSites = this.setting.searchAllSites
|
||||
updateSettingEvent (e) {
|
||||
this.editPlayerPath = false
|
||||
setting.update(this.d)
|
||||
},
|
||||
toggleSearchAllSites () {
|
||||
this.d.searchAllSites = !this.d.searchAllSites
|
||||
setting.update(this.d)
|
||||
},
|
||||
toggleExcludeR18Films () {
|
||||
this.d.excludeR18Films = !this.d.excludeR18Films
|
||||
setting.update(this.d)
|
||||
},
|
||||
selectLocalPlayer () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'Executable file', extensions: ['exe'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
],
|
||||
properties: ['openFile']
|
||||
}
|
||||
remote.dialog.showOpenDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
var playerPath = result.filePaths[0].replace(/\\/g, '/')
|
||||
this.$message.success('设定第三方播放器路径为:' + result.filePaths[0])
|
||||
this.d.externalPlayer = playerPath
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
resetLocalPlayer () {
|
||||
this.d.externalPlayer = ''
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
this.$message.success('重置第三方播放器成功')
|
||||
})
|
||||
},
|
||||
updatePlayerPath () {
|
||||
this.$message.success('设定第三方播放器路径为:' + this.d.externalPlayer)
|
||||
this.editPlayerPath = false
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
})
|
||||
},
|
||||
expSites () {
|
||||
exportSites () {
|
||||
this.getSites()
|
||||
const arr = [...this.sitesList]
|
||||
const str = JSON.stringify(arr)
|
||||
clipboard.writeText(str)
|
||||
this.$message.success('已复制到剪贴板')
|
||||
const str = JSON.stringify(arr, null, 4)
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
]
|
||||
}
|
||||
remote.dialog.showSaveDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
this.$message.success('已保存成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
impSites () {
|
||||
const str = clipboard.readText()
|
||||
const json = JSON.parse(str)
|
||||
sites.clear().then(res => {
|
||||
this.$message.info('已清空原数据')
|
||||
sites.add(json).then(e => {
|
||||
this.$message.success('已添加成功')
|
||||
this.getSites()
|
||||
this.d.site = json[0].key
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
importSites () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
],
|
||||
properties: ['openFile']
|
||||
}
|
||||
remote.dialog.showOpenDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
sites.clear()
|
||||
result.filePaths.forEach(file => {
|
||||
var str = fs.readFileSync(file)
|
||||
const json = JSON.parse(str)
|
||||
sites.bulkAdd(json).then(e => {
|
||||
this.getSites()
|
||||
this.d.site = json[0].key
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
})
|
||||
})
|
||||
this.$message.success('导入成功')
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
editSitesEvent () {
|
||||
this.editSites = {
|
||||
show: true,
|
||||
sites: this.sitesList
|
||||
}
|
||||
},
|
||||
resetSites () {
|
||||
sites.clear()
|
||||
sites.bulkAdd(defaultSites).then(e => {
|
||||
this.getSites()
|
||||
this.d.site = defaultSites[0].key
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
this.$message.success('重置源成功')
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -243,7 +376,7 @@ export default {
|
||||
},
|
||||
expShortcut () {
|
||||
const arr = [...this.shortcutList]
|
||||
const str = JSON.stringify(arr)
|
||||
const str = JSON.stringify(arr, null, 4)
|
||||
clipboard.writeText(str)
|
||||
this.$message.success('已复制到剪贴板')
|
||||
},
|
||||
@@ -274,12 +407,25 @@ export default {
|
||||
this.linkOpen('http://zyplayer.fun/doc/shortcut/')
|
||||
return false
|
||||
}
|
||||
},
|
||||
getLatestVersion () {
|
||||
const cheerio = require('cheerio')
|
||||
const axios = require('axios')
|
||||
var url = 'https://github.com/Hunlongyu/ZY-Player/releases'
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.release-header')[0]
|
||||
var firstResult = $(e).find('div>div>a')
|
||||
this.latestVersion = firstResult.text()
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getSetting()
|
||||
this.getSites()
|
||||
this.getShortcut()
|
||||
this.getFavorites()
|
||||
this.getLatestVersion()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -70,16 +70,22 @@ export default {
|
||||
zy.detail(this.share.key, id).then(res => {
|
||||
if (res) {
|
||||
this.pic = res.pic
|
||||
const text = res.dl.dd
|
||||
for (const i of text) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
const arr = i._t.split('#')
|
||||
const url = arr[0].split('$')[1]
|
||||
this.link = 'http://zyplayer.fun/player/player.html?url=' + url + '&title=' + this.share.info.name
|
||||
var m3u8List = {}
|
||||
const dd = res.dl.dd
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
m3u8List = i._t.split('#')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m3u8List = dd._t.split('#')
|
||||
}
|
||||
this.loading = false
|
||||
const url = m3u8List[1]
|
||||
this.link = 'http://zyplayer.fun/player/player.html?url=' + url + '&title=' + this.share.info.name
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
picLoadEvent () {
|
||||
|
||||
@@ -3,24 +3,48 @@
|
||||
<div class="body">
|
||||
<div class="zy-table">
|
||||
<div class="tHeader">
|
||||
<span class="btn" @click="updateAllEvent(list)">同步所有收藏</span>
|
||||
<span class="btn" @click="exportFavoritesEvent()">导出</span>
|
||||
<span class="btn" @click="importFavoritesEvent()">导入</span>
|
||||
<span class="btn" @click="clearFavoritesEvent()">清空</span>
|
||||
<span class="btn"></span>
|
||||
<span class="btn" @click="updateAllEvent()">同步所有收藏</span>
|
||||
</div>
|
||||
<div class="tBody zy-scroll">
|
||||
<ul>
|
||||
<li v-for="(i, j) in list" :key="j" @click="detailEvent(i)" :class="[i.hasUpdate ? 'zy-highlighted': '']">
|
||||
<span class="name">{{i.name}}</span>
|
||||
<span class="type">{{i.type}}</span>
|
||||
<span class="time">{{i.year}}</span>
|
||||
<span class="site">{{i.site.name}}</span>
|
||||
<span class="note">{{i.note}}</span>
|
||||
<li v-show="this.list.length > 0">
|
||||
<span class="name">名字</span>
|
||||
<span class="type">类型</span>
|
||||
<span class="time">上映</span>
|
||||
<span class="site">片源</span>
|
||||
<span class="note">备注</span>
|
||||
<span class="note">观看至</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="playEvent(i)">播放</span>
|
||||
<span class="btn" @click.stop="deleteEvent(i)">删除</span>
|
||||
<span class="btn" @click.stop="shareEvent(i)">分享</span>
|
||||
<span class="btn" @click.stop="updateEvent(i)">同步</span>
|
||||
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
|
||||
<span class="btn"></span>
|
||||
<span class="btn"></span>
|
||||
<span class="btn"></span>
|
||||
<span class="btn"></span>
|
||||
<span class="btn"></span>
|
||||
</span>
|
||||
</li>
|
||||
<draggable v-model="list" @change="listUpdatedEvent">
|
||||
<transition-group>
|
||||
<li v-for="(i, j) in list" :key="j" @click="detailEvent(i)" :class="[i.hasUpdate ? 'zy-highlighted': '']">
|
||||
<span class="name">{{i.name}}</span>
|
||||
<span class="type">{{i.type}}</span>
|
||||
<span class="time">{{i.year}}</span>
|
||||
<span class="site">{{getSiteName(i.key)}}</span>
|
||||
<span class="note">{{i.note}}</span>
|
||||
<span class="note">{{getHistoryNote(i.index)}}</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="playEvent(i)">播放</span>
|
||||
<span class="btn" @click.stop="shareEvent(i)">分享</span>
|
||||
<span class="btn" @click.stop="updateEvent(i)">同步</span>
|
||||
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
|
||||
<span class="btn" @click.stop="deleteEvent(i)">删除</span>
|
||||
</span>
|
||||
</li>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -29,16 +53,24 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { star, history } from '../lib/dexie'
|
||||
import { star, history, sites } from '../lib/dexie'
|
||||
import zy from '../lib/site/tools'
|
||||
import draggable from 'vuedraggable'
|
||||
import { remote } from 'electron'
|
||||
import fs from 'fs'
|
||||
|
||||
const { clipboard } = require('electron')
|
||||
export default {
|
||||
name: 'star',
|
||||
data () {
|
||||
return {
|
||||
list: []
|
||||
list: [],
|
||||
sites: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
draggable
|
||||
},
|
||||
computed: {
|
||||
view: {
|
||||
get () {
|
||||
@@ -75,7 +107,8 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
view () {
|
||||
this.getStarList()
|
||||
this.getFavorites()
|
||||
this.getAllsites()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -83,23 +116,27 @@ export default {
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
key: e.site.key,
|
||||
key: e.key,
|
||||
info: {
|
||||
id: e.ids,
|
||||
name: e.name
|
||||
}
|
||||
}
|
||||
this.clearHasUpdateFlag(e)
|
||||
if (e.hasUpdate) {
|
||||
this.clearHasUpdateFlag(e)
|
||||
}
|
||||
},
|
||||
playEvent (e) {
|
||||
history.find({ site: e.site.key, ids: e.ids }).then(res => {
|
||||
history.find({ site: e.key, ids: e.ids }).then(res => {
|
||||
if (res) {
|
||||
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: res.index, site: e.site } }
|
||||
this.video = { key: e.key, info: { id: res.ids, name: res.name, index: res.index } }
|
||||
} else {
|
||||
this.video = { key: e.site.key, info: { id: e.ids, name: e.name, index: 0, site: e.site } }
|
||||
this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 } }
|
||||
}
|
||||
})
|
||||
this.clearHasUpdateFlag(e)
|
||||
if (e.hasUpdate) {
|
||||
this.clearHasUpdateFlag(e)
|
||||
}
|
||||
this.view = 'Play'
|
||||
},
|
||||
deleteEvent (e) {
|
||||
@@ -109,13 +146,13 @@ export default {
|
||||
} else {
|
||||
this.$message.success('删除成功')
|
||||
}
|
||||
this.getStarList()
|
||||
this.getFavorites()
|
||||
})
|
||||
},
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: e.site.key,
|
||||
key: e.key,
|
||||
info: e
|
||||
}
|
||||
},
|
||||
@@ -123,45 +160,59 @@ export default {
|
||||
star.find({ id: e.id }).then(res => {
|
||||
res.hasUpdate = false
|
||||
star.update(e.id, res)
|
||||
this.getStarList()
|
||||
this.getFavorites()
|
||||
})
|
||||
},
|
||||
listUpdatedEvent () {
|
||||
star.clear().then(res1 => {
|
||||
// 重新排序
|
||||
var id = this.list.length
|
||||
this.list.forEach(element => {
|
||||
element.id = id
|
||||
star.add(element)
|
||||
id -= 1
|
||||
})
|
||||
})
|
||||
},
|
||||
updateEvent (e) {
|
||||
zy.detail(e.site.key, e.ids).then(res => {
|
||||
if (e.last === res.last) {
|
||||
var msg = `同步"${e.name}"成功, 未查询到更新。`
|
||||
this.$message.info(msg)
|
||||
} else {
|
||||
const doc = {
|
||||
id: e.id,
|
||||
ids: res.id,
|
||||
last: res.last,
|
||||
name: res.name,
|
||||
site: e.site,
|
||||
type: res.type,
|
||||
year: res.year,
|
||||
note: res.note,
|
||||
hasUpdate: true
|
||||
}
|
||||
star.update(e.id, doc).then(res => {
|
||||
var msg = `同步"${e.name}"成功, 检查到更新。`
|
||||
this.$message.success(msg)
|
||||
})
|
||||
this.getStarList()
|
||||
zy.detail(e.key, e.ids).then(res => {
|
||||
var doc = {
|
||||
key: e.key,
|
||||
id: e.id,
|
||||
ids: res.id,
|
||||
last: res.last,
|
||||
name: res.name,
|
||||
type: res.type,
|
||||
year: res.year,
|
||||
note: res.note
|
||||
}
|
||||
star.get(e.id).then(resStar => {
|
||||
doc.hasUpdate = resStar.hasUpdate
|
||||
var msg = ''
|
||||
if (e.last === res.last) {
|
||||
msg = `同步"${e.name}"成功, 未查询到更新。`
|
||||
this.$message.info(msg)
|
||||
} else {
|
||||
doc.hasUpdate = true
|
||||
msg = `同步"${e.name}"成功, 检查到更新。`
|
||||
this.$message.success(msg)
|
||||
}
|
||||
star.update(e.id, doc)
|
||||
this.getFavorites()
|
||||
})
|
||||
}).catch(err => {
|
||||
var msg = `同步"${e.name}"失败, 请重试。`
|
||||
this.$message.warning(msg, err)
|
||||
})
|
||||
},
|
||||
updateAllEvent (list) {
|
||||
list.forEach(e => {
|
||||
updateAllEvent () {
|
||||
this.list.forEach(e => {
|
||||
this.updateEvent(e)
|
||||
})
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(e.site.key, e.ids).then(res => {
|
||||
if (res) {
|
||||
zy.download(e.key, e.ids).then(res => {
|
||||
if (res && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
@@ -176,25 +227,129 @@ export default {
|
||||
this.$message.warning('没有查询到下载链接.')
|
||||
}
|
||||
} else {
|
||||
const list = [...this.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
var m3u8List = {}
|
||||
zy.detail(e.key, e.ids).then(res => {
|
||||
const dd = res.dl.dd
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
m3u8List = i._t.split('#')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m3u8List = dd._t.split('#')
|
||||
}
|
||||
const list = [...m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getStarList () {
|
||||
getSiteName (key) {
|
||||
var site = this.sites.find(e => e.key === key)
|
||||
if (site) {
|
||||
return site.name
|
||||
}
|
||||
},
|
||||
getHistoryNote (index) {
|
||||
if (index !== null && index !== undefined) {
|
||||
return `第${index + 1}集`
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
getFavorites () {
|
||||
star.all().then(res => {
|
||||
this.list = res.reverse()
|
||||
})
|
||||
},
|
||||
getAllsites () {
|
||||
sites.all().then(res => {
|
||||
this.sites = res
|
||||
})
|
||||
},
|
||||
exportFavoritesEvent () {
|
||||
const arr = [...this.list]
|
||||
const str = JSON.stringify(arr, null, 4)
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
]
|
||||
}
|
||||
remote.dialog.showSaveDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
this.$message.success('已保存成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
importFavoritesEvent () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
],
|
||||
properties: ['openFile', 'multiSelections']
|
||||
}
|
||||
remote.dialog.showOpenDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
result.filePaths.forEach(file => {
|
||||
var str = fs.readFileSync(file)
|
||||
const json = JSON.parse(str)
|
||||
star.bulkAdd(json).then(e => {
|
||||
this.getFavorites()
|
||||
})
|
||||
this.upgradeFavorites()
|
||||
})
|
||||
this.$message.success('导入收藏成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
upgradeFavorites () {
|
||||
star.all().then(res => {
|
||||
res.forEach(element => {
|
||||
const docs = {
|
||||
key: element.key,
|
||||
ids: element.ids,
|
||||
name: element.name,
|
||||
type: element.type,
|
||||
year: element.year,
|
||||
last: element.last,
|
||||
note: element.note
|
||||
}
|
||||
star.find({ key: element.key, ids: element.ids }).then(res => {
|
||||
if (!res) {
|
||||
star.add(docs)
|
||||
}
|
||||
})
|
||||
})
|
||||
this.getFavorites()
|
||||
})
|
||||
},
|
||||
clearFavoritesEvent () {
|
||||
star.clear().then(e => {
|
||||
this.getFavorites()
|
||||
this.$message.success('清空所有收藏成功')
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getStarList()
|
||||
this.getFavorites()
|
||||
window.Sortable = require('sortablejs').Sortable
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -8,6 +8,7 @@ import Setting from './Setting'
|
||||
import Detail from './Detail'
|
||||
import Share from './Share'
|
||||
import History from './History'
|
||||
import EditSites from './EditSites'
|
||||
|
||||
export default {
|
||||
registerComponents () {
|
||||
@@ -20,5 +21,6 @@ export default {
|
||||
Vue.component('Detail', Detail)
|
||||
Vue.component('Share', Share)
|
||||
Vue.component('History', History)
|
||||
Vue.component('EditSites', EditSites)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,16 @@ export default {
|
||||
async clear () {
|
||||
return await sites.clear()
|
||||
},
|
||||
async add (doc) {
|
||||
async bulkAdd (doc) {
|
||||
return await sites.bulkAdd(doc)
|
||||
},
|
||||
async find (doc) {
|
||||
return await sites.get(doc)
|
||||
},
|
||||
async add (doc) {
|
||||
return await sites.add(doc)
|
||||
},
|
||||
async remove (id) {
|
||||
return await sites.delete(id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ export default {
|
||||
async add (doc) {
|
||||
return await star.add(doc)
|
||||
},
|
||||
async bulkAdd (doc) {
|
||||
return await star.bulkAdd(doc)
|
||||
},
|
||||
async find (doc) {
|
||||
return await star.get(doc)
|
||||
},
|
||||
@@ -15,5 +18,11 @@ export default {
|
||||
},
|
||||
async remove (id) {
|
||||
return await star.delete(id)
|
||||
},
|
||||
async get (id) {
|
||||
return await star.get(id)
|
||||
},
|
||||
async clear () {
|
||||
return await star.clear()
|
||||
}
|
||||
}
|
||||
|
||||
219
src/lib/site/onlineVideo.js
Normal file
219
src/lib/site/onlineVideo.js
Normal file
@@ -0,0 +1,219 @@
|
||||
import open from 'open'
|
||||
import axios from 'axios'
|
||||
import cheerio from 'cheerio'
|
||||
|
||||
const onlineVideo = {
|
||||
playVideoOnBde4 (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://bde4.com/search/${videoName}`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.search-list')
|
||||
var searchResult = $(e).find('div>div>div>div>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).attr('title')
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
var detailPageFullLink = 'https://bde4.com/' + detailPageLink
|
||||
// 解析详情页面
|
||||
axios.get(detailPageFullLink).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.info1')
|
||||
var videoList = $(e).find('a').toArray()
|
||||
var videoFullLink = detailPageFullLink
|
||||
// 获取index视频链接
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = 'https://bde4.com' + indexVideoLink
|
||||
}
|
||||
}
|
||||
open(videoFullLink)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
playVideoOnK1080 (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://k1080.net/vodsearch123/-------------.html?wd=${videoName}&submit=`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('#searchList')
|
||||
var searchResult = $(e).find('li>div>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).attr('title')
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'https://k1080.net' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('#playlist1')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
var videoFullLink = detailPageFullLink
|
||||
// 获取index视频链接
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = 'https://k1080.net' + indexVideoLink
|
||||
}
|
||||
}
|
||||
open(videoFullLink)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
playVideoOnSubaibai (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://www.subaibai.com/xssearch?q=${videoName}`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.search_list')
|
||||
var searchResult = $(e).find('div>ul>li>h3>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).text()
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('div.paly_list_btn')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = indexVideoLink
|
||||
}
|
||||
}
|
||||
open(videoFullLink)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
playVideoOnYhdm (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `http://www.yhdm.tv/search/${videoName}`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.lpic')
|
||||
var searchResult = $(e).find('div>ul>li>h2>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).attr('title')
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'http://www.yhdm.tv/' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('div.movurl')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = 'http://www.yhdm.tv/' + indexVideoLink
|
||||
}
|
||||
}
|
||||
open(videoFullLink)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
playVideoOndmdm2020 (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `http://www.dmdm2020.com/dongmansearch.html?wd=${videoName}&submit=`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('#searchList')
|
||||
var searchResult = $(e).find('ul>li>div>h4>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).text()
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'http://www.dmdm2020.com' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('#playlist1')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = 'http://www.dmdm2020.com' + indexVideoLink
|
||||
}
|
||||
}
|
||||
open(videoFullLink)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
playVideoOnSyrme (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://syrme.top/searchs?q=${videoName}`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('ul.MovieList')
|
||||
var searchResult = $(e).find('ul>li>article>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).find('a>h2').text()
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'https://syrme.top' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('#categories-2')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
videoFullLink = 'https://syrme.top' + indexVideoLink
|
||||
}
|
||||
open(videoFullLink)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
export default onlineVideo
|
||||
@@ -130,14 +130,18 @@ const zy = {
|
||||
this.getSite(key).then(res => {
|
||||
const site = res
|
||||
wd = encodeURI(wd)
|
||||
axios.post(`http://localhost:${this.ports}/api`, { url: site.api + '?wd=' + wd }).then(res => {
|
||||
axios.post(`http://localhost:${this.ports}/api`, { url: site.api + '?wd=' + wd }, { timeout: 2000 }).then(res => {
|
||||
const data = res.data.info
|
||||
const json = parser.parse(data, this.xmlConfig)
|
||||
const videoList = json.rss.list.video
|
||||
resolve(videoList)
|
||||
if (json && json.rss && json.rss.list) {
|
||||
const videoList = json.rss.list.video
|
||||
resolve(videoList)
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@@ -23,13 +23,16 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<span class="top" @click="frameClickEvent('top')" title="置顶">
|
||||
<svg t="1595919317571" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1188" style="width:12px;height:16px"><path d="M43.072 974.72l380.864-301.952 151.936 161.6c0 0 63.424 17.28 67.328-30.72l-3.904-163.584 225.088-259.648 98.048-5.696c0 0 76.928-15.488 21.184-82.752l-275.072-276.928c0 0-74.944-9.6-69.248 59.584l0 75.008L383.552 367.104 225.856 376.64c0 0-57.728 19.2-36.608 69.248l148.16 146.176L43.072 974.72 43.072 974.72z" p-id="1189" :fill="isAlwaysOnTop ? '#555555' : '#ffffff'"></path></svg>
|
||||
<svg t="1595919317571" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1188" style="width:10px;height:14px"><path d="M43.072 974.72l380.864-301.952 151.936 161.6c0 0 63.424 17.28 67.328-30.72l-3.904-163.584 225.088-259.648 98.048-5.696c0 0 76.928-15.488 21.184-82.752l-275.072-276.928c0 0-74.944-9.6-69.248 59.584l0 75.008L383.552 367.104 225.856 376.64c0 0-57.728 19.2-36.608 69.248l148.16 146.176L43.072 974.72 43.072 974.72z" p-id="1189" :fill="isAlwaysOnTop ? '#555555' : '#ffffff'"></path></svg>
|
||||
</span>
|
||||
<span class="min" @click="frameClickEvent('min')" title="最小化">
|
||||
<svg t="1595917239849" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1155" style="width:10px;height:16px"><path d="M0 479.936C0 444.64 28.448 416 64.064 416L959.936 416C995.328 416 1024 444.736 1024 479.936L1024 544.064C1024 579.392 995.552 608 959.936 608L64.064 608C28.672 608 0 579.264 0 544.064L0 479.936Z" p-id="1156" fill="#ffffff"></path></svg>
|
||||
<svg t="1595917239849" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1155" style="width:8px;height:14px"><path d="M0 479.936C0 444.64 28.448 416 64.064 416L959.936 416C995.328 416 1024 444.736 1024 479.936L1024 544.064C1024 579.392 995.552 608 959.936 608L64.064 608C28.672 608 0 579.264 0 544.064L0 479.936Z" p-id="1156" fill="#ffffff"></path></svg>
|
||||
</span>
|
||||
<span class="max" @click="frameClickEvent('max')" title="最大化">
|
||||
<svg t="1595917343956" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1540" style="width:8px;height:14px"><path d="M416 416 64.064 416C28.448 416 0 444.64 0 479.936L0 544.064C0 579.264 28.672 608 64.064 608L416 608 416 959.936C416 995.552 444.64 1024 479.936 1024L544.064 1024C579.264 1024 608 995.328 608 959.936L608 608 959.936 608C995.552 608 1024 579.36 1024 544.064L1024 479.936C1024 444.736 995.328 416 959.936 416L608 416 608 64.064C608 28.448 579.36 0 544.064 0L479.936 0C444.736 0 416 28.672 416 64.064L416 416Z" p-id="1541" fill="#ffffff"></path></svg>
|
||||
</span>
|
||||
<span class="close" @click="frameClickEvent('close')" title="关闭">
|
||||
<svg t="1595917372551" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1685" style="width:10px;height:16px"><path d="M511.968 376.224 796.096 92.096C833.536 54.624 894.4 54.624 931.84 92.096 969.312 129.568 969.312 190.4 931.84 227.872L647.744 512 931.84 796.096C969.312 833.568 969.312 894.4 931.84 931.872 894.4 969.344 833.536 969.344 796.096 931.872L511.968 647.744 227.84 931.872C190.4 969.344 129.536 969.344 92.096 931.872 54.624 894.4 54.624 833.568 92.096 796.096L376.224 512 92.096 227.872C54.624 190.4 54.624 129.568 92.096 92.096 129.536 54.624 190.4 54.624 227.84 92.096L511.968 376.224Z" p-id="1686" fill="#ffffff"></path></svg>
|
||||
<svg t="1595917372551" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1685" style="width:8px;height:14px"><path d="M511.968 376.224 796.096 92.096C833.536 54.624 894.4 54.624 931.84 92.096 969.312 129.568 969.312 190.4 931.84 227.872L647.744 512 931.84 796.096C969.312 833.568 969.312 894.4 931.84 931.872 894.4 969.344 833.536 969.344 796.096 931.872L511.968 647.744 227.84 931.872C190.4 969.344 129.536 969.344 92.096 931.872 54.624 894.4 54.624 833.568 92.096 796.096L376.224 512 92.096 227.872C54.624 190.4 54.624 129.568 92.096 92.096 129.536 54.624 190.4 54.624 227.84 92.096L511.968 376.224Z" p-id="1686" fill="#ffffff"></path></svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -80,10 +83,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
frameClickEvent (e) {
|
||||
const win = remote.getCurrentWindow()
|
||||
if (e === 'min') {
|
||||
const win = remote.getCurrentWindow()
|
||||
win.minimize()
|
||||
return false
|
||||
}
|
||||
if (e === 'max') {
|
||||
win.isMaximized() ? win.unmaximize() : win.maximize()
|
||||
}
|
||||
if (e === 'close') {
|
||||
ipcRenderer.send('win')
|
||||
@@ -91,7 +96,6 @@ export default {
|
||||
}
|
||||
if (e === 'top') {
|
||||
this.isAlwaysOnTop = !this.isAlwaysOnTop
|
||||
const win = remote.getCurrentWindow()
|
||||
win.setAlwaysOnTop(this.isAlwaysOnTop)
|
||||
}
|
||||
},
|
||||
@@ -125,54 +129,6 @@ export default {
|
||||
}
|
||||
})
|
||||
})
|
||||
// zy.detail(res.site, res.ids).then(e => {
|
||||
// this.name = e.name
|
||||
// this.detail = e
|
||||
// const dd = e.dl.dd
|
||||
// const type = Object.prototype.toString.call(dd)
|
||||
// let m3u8Txt = []
|
||||
// if (type === '[object Array]') {
|
||||
// for (const i of dd) {
|
||||
// if (i._t.indexOf('m3u8') >= 0) {
|
||||
// m3u8Txt = i._t.split('#')
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// m3u8Txt = dd._t.split('#')
|
||||
// }
|
||||
// const m3u8Arr = []
|
||||
// for (const i of m3u8Txt) {
|
||||
// const j = i.split('$')
|
||||
// if (j.length > 1) {
|
||||
// for (let m = 0; m < j.length; m++) {
|
||||
// if (j[m].indexOf('m3u8') >= 0) {
|
||||
// m3u8Arr.push(j[m])
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// m3u8Arr.push(j[0])
|
||||
// }
|
||||
// }
|
||||
// this.m3u8Arr = m3u8Arr
|
||||
// this.xg.src = m3u8Arr[res.index]
|
||||
// if (res.time !== 0 || res.time !== '') {
|
||||
// this.xg.play()
|
||||
// this.xg.once('playing', () => {
|
||||
// this.xg.currentTime = res.time
|
||||
// })
|
||||
// } else {
|
||||
// this.xg.play()
|
||||
// }
|
||||
// this.videoPlaying()
|
||||
// this.xg.once('ended', () => {
|
||||
// if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > res.index)) {
|
||||
// this.video.time = 0
|
||||
// this.video.index++
|
||||
// this.xg.src = m3u8Arr[this.video.index]
|
||||
// this.xg.play()
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
})
|
||||
},
|
||||
fetchM3u8List (info) {
|
||||
@@ -507,15 +463,18 @@ html,body{
|
||||
span{
|
||||
-webkit-app-region: no-drag;
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
text-align: center;
|
||||
line-height: 16px;
|
||||
line-height: 14px;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
cursor: pointer;
|
||||
opacity: 0.4;
|
||||
&.min{
|
||||
background-color: #32dc36;
|
||||
}
|
||||
&.max{
|
||||
background-color: #ffbe2a;
|
||||
}
|
||||
&.close{
|
||||
|
||||
@@ -25,6 +25,10 @@ export default new Vuex.Store({
|
||||
video: {
|
||||
key: '',
|
||||
info: {}
|
||||
},
|
||||
editSites: {
|
||||
show: false,
|
||||
sites: []
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
@@ -42,6 +46,9 @@ export default new Vuex.Store({
|
||||
},
|
||||
getVideo: state => {
|
||||
return state.video
|
||||
},
|
||||
getEditSites: state => {
|
||||
return state.editSites
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
@@ -59,6 +66,9 @@ export default new Vuex.Store({
|
||||
},
|
||||
SET_VIDEO: (state, payload) => {
|
||||
state.video = payload
|
||||
},
|
||||
SET_EDITSITES: (state, payload) => {
|
||||
state.editSites = payload
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user