Compare commits

...

14 Commits

Author SHA1 Message Date
haiyangcui
cb7a4af7ae 2.4.10.1 国庆版 2020-10-01 13:34:21 +02:00
haiyangcui
25340b79aa v2.4.9 2020-09-30 21:33:08 +02:00
haiyangcui
381b0a8735 记录窗口大小及位置 2020-09-30 21:11:54 +02:00
haiyangcui
c7b99244bb 更新style 2020-09-29 23:08:23 +02:00
haiyangcui
5b5826e9a6 改进checkbox的点击效果 2020-09-29 17:43:14 +02:00
haiyangcui
03e2f2673b 更新style 2020-09-29 17:37:47 +02:00
haiyangcui
503a90d8da 转移收藏相关操作到收藏页面 2020-09-29 15:23:09 +02:00
haiyangcui
afb92d59ff 可设置快进快退的步长 2020-09-28 23:30:24 +02:00
haiyangcui
d26f1cbdf7 简影 2020-09-28 21:11:48 +02:00
haiyangcui
7f821b05ad 哆咪动漫 2020-09-28 20:53:48 +02:00
haiyangcui
746c93c9d2 樱花动漫 2020-09-28 20:53:15 +02:00
haiyangcui
9fb51ed8fc 点击'播放在线高清视频'也可以控制check box的开关 2020-09-28 17:51:56 +02:00
haiyangcui
6a1c045e0b 解析网站的代码放到onlineVideo里 2020-09-28 16:38:31 +02:00
haiyangcui
756b8ecc33 添加"素白白"的支持 2020-09-27 17:59:13 +02:00
13 changed files with 453 additions and 203 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "zy",
"version": "2.4.8",
"version": "2.4.10.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",

View File

@@ -22,11 +22,61 @@
</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: {

View File

@@ -78,15 +78,21 @@
}
}
}
.zy-checkbox{
.zy-input{
position: relative;
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;

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -34,7 +34,7 @@
<span @click="downloadEvent">下载</span>
<span @click="shareEvent">分享</span>
<span @click="doubanLinkEvent">豆瓣</span>
<span>
<span @click="togglePlayOnlineEvent">
<input type="checkbox" v-model="playOnline"> 播放在线高清视频
</span>
<span>
@@ -60,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 {
@@ -71,7 +72,7 @@ export default {
info: {},
playOnline: false,
selectedOnlineSite: '哔嘀',
onlineSites: ['哔嘀', '1080影视']
onlineSites: ['哔嘀', '素白白', '简影', '1080影视']
}
},
filters: {
@@ -186,96 +187,33 @@ export default {
this.$message.warning('收藏失败')
})
},
togglePlayOnlineEvent () {
this.playOnline = !this.playOnline
},
playVideoOnline (videoName, videoIndex) {
switch (this.selectedOnlineSite) {
case '哔嘀':
this.playVideoOnBde4(videoName, videoIndex)
onlineVideo.playVideoOnBde4(videoName, videoIndex)
break
case '1080影视':
this.playVideoOnK1080(videoName, videoIndex)
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}`)
}
},
playVideoOnBde4 (videoName, videoIndex) {
videoName = videoName.replace(/\s/g, '')
var url = `https://bde4.com/search/${videoName}`
const open = require('open')
const axios = require('axios')
const cheerio = require('cheerio')
axios.get(url).then(res => {
const $ = cheerio.load(res.data)
var e = $('div.search-list')
var firstResult = $(e).find('div>div>div>div>a').toArray()
// 获取第一个搜索结果的视频链接
var detailPageLink = $(firstResult[0]).attr('href')
// 获取第一个搜索结果的title
var title = $(firstResult[0]).attr('title')
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
// 如果第一个搜索结果不符合,打开搜索页面
open(url)
} else {
var detailPageFullLink = 'https://bde4.com/' + detailPageLink
if (this.m3u8List.length === 1) {
open(detailPageFullLink)
} else {
// 解析详情页面
axios.get(detailPageFullLink).then(res => {
const $ = cheerio.load(res.data)
var e = $('div.info1')
var videoList = $(e).find('a').toArray()
var indexVideoLink = $(videoList[videoIndex]).attr('href')
if (indexVideoLink.includes('.htm')) {
var videoFullLink = 'https://bde4.com' + indexVideoLink
open(videoFullLink)
} else {
open(detailPageFullLink)
}
})
}
}
})
},
playVideoOnK1080 (videoName, videoIndex) {
videoName = videoName.replace(/\s/g, '')
var url = `https://k1080.net/vodsearch123/-------------.html?wd=${videoName}&submit=`
const open = require('open')
const axios = require('axios')
const cheerio = require('cheerio')
axios.get(url).then(res => {
const $ = cheerio.load(res.data)
var e = $('#searchList').html()
var firstResult = $(e).find('li>div>a').toArray()
// 获取第一个搜索结果的视频链接
var detailPageLink = $(firstResult[0]).attr('href')
// 获取第一个搜索结果的title
var title = $(firstResult[0]).attr('title')
console.log(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')
// 获取index视频链接
var indexVideoLink = $(videoList[videoIndex]).attr('href')
if (indexVideoLink.includes('.htm')) {
var videoFullLink = 'https://k1080.net' + indexVideoLink
open(videoFullLink)
} else {
open(detailPageFullLink)
}
})
}
})
},
downloadEvent () {
zy.download(this.detail.key, this.info.id).then(res => {
if (res && res.dl && res.dl.dd) {

View File

@@ -3,6 +3,7 @@
<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">

View File

@@ -713,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
}

View File

@@ -42,24 +42,16 @@
</div>
</div>
</div>
<div class='site'>
<div class="title">收藏管理</div>
<div class="site-box">
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="exportFavorites">导出</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="importFavorites">导入</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="clearFavorites">清空收藏</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'>
@@ -72,9 +64,9 @@
<div class="vs-placeholder vs-noAfter" v-show = "editPlayerPath == false">
<label>编辑</label>
</div>
<input class="vs-input" v-show = "editPlayerPath == true" v-model = "d.externalPlayer"
@blur= "updatePlayerPath"
@keyup.enter = "updatePlayerPath">
<input class="zy-input" v-show = "editPlayerPath == true" v-model = "d.externalPlayer"
@blur= "updateSettingEvent"
@keyup.enter = "updateSettingEvent">
</div>
</div>
</div>
@@ -93,8 +85,8 @@
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="resetSites">重置源</div>
</div>
<div class="zy-checkbox">
<input type="checkbox" v-model="setting.excludeR18Films" @change="updateExcludeR18FilmOption($event)"> 屏蔽福利片
<div class="zy-input" @click="toggleExcludeR18Films">
<input type="checkbox" v-model="d.excludeR18Films" @change="updateSettingEvent($event)"> 屏蔽福利片
</div>
</div>
</div>
@@ -169,6 +161,7 @@ export default {
editPlayerPath: false,
excludeR18Films: false,
latestVersion: pkg.version,
forwardTimeInSec: 5,
d: {
id: 0,
site: '',
@@ -178,7 +171,8 @@ export default {
view: 'picture',
externalPlayer: '',
editPlayerPath: false,
excludeR18Films: true
excludeR18Films: true,
forwardTimeInSec: 5
}
}
},
@@ -213,10 +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
excludeR18Films: res.excludeR18Films ? res.excludeR18Films : true,
forwardTimeInSec: res.forwardTimeInSec ? res.forwardTimeInSec : 5
}
this.setting = this.d
})
@@ -252,85 +247,17 @@ export default {
this.show.site = false
})
},
updateSearchOption (e) {
this.d.searchAllSites = this.setting.searchAllSites
setting.update(this.setting)
updateSettingEvent (e) {
this.editPlayerPath = false
setting.update(this.d)
},
updateExcludeR18FilmOption (e) {
this.d.excludeR18Films = this.setting.excludeR18Films
setting.update(this.setting)
toggleSearchAllSites () {
this.d.searchAllSites = !this.d.searchAllSites
setting.update(this.d)
},
exportFavorites () {
this.getFavorites()
const arr = [...this.favoritesList]
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)
})
},
importFavorites () {
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)
})
},
clearFavorites () {
star.clear().then(e => {
this.getFavorites()
this.$message.success('清空所有收藏成功')
})
},
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()
})
toggleExcludeR18Films () {
this.d.excludeR18Films = !this.d.excludeR18Films
setting.update(this.d)
},
selectLocalPlayer () {
const options = {
@@ -345,7 +272,6 @@ export default {
var playerPath = result.filePaths[0].replace(/\\/g, '/')
this.$message.success('设定第三方播放器路径为:' + result.filePaths[0])
this.d.externalPlayer = playerPath
this.externalPlayer = playerPath
setting.update(this.d).then(res => {
this.setting = this.d
})

View File

@@ -3,7 +3,11 @@
<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>
@@ -33,7 +37,7 @@
<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="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>
@@ -52,6 +56,8 @@ import { mapMutations } from 'vuex'
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 {
@@ -101,7 +107,7 @@ export default {
},
watch: {
view () {
this.getStarList()
this.getFavorites()
this.getAllsites()
}
},
@@ -140,7 +146,7 @@ export default {
} else {
this.$message.success('删除成功')
}
this.getStarList()
this.getFavorites()
})
},
shareEvent (e) {
@@ -154,7 +160,7 @@ export default {
star.find({ id: e.id }).then(res => {
res.hasUpdate = false
star.update(e.id, res)
this.getStarList()
this.getFavorites()
})
},
listUpdatedEvent () {
@@ -192,15 +198,15 @@ export default {
this.$message.success(msg)
}
star.update(e.id, doc)
this.getStarList()
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)
})
},
@@ -259,7 +265,7 @@ export default {
return ''
}
},
getStarList () {
getFavorites () {
star.all().then(res => {
this.list = res.reverse()
})
@@ -268,10 +274,81 @@ export default {
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
}
}

219
src/lib/site/onlineVideo.js Normal file
View 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