mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-05-16 14:04:24 +08:00
@@ -173,9 +173,9 @@ export default {
|
|||||||
},
|
},
|
||||||
getFilters () {
|
getFilters () {
|
||||||
const groups = [...new Set(this.sites.map(site => site.group))]
|
const groups = [...new Set(this.sites.map(site => site.group))]
|
||||||
const filters = []
|
var filters = []
|
||||||
groups.forEach(g => {
|
groups.forEach(g => {
|
||||||
const doc = {
|
var doc = {
|
||||||
text: g,
|
text: g,
|
||||||
value: g
|
value: g
|
||||||
}
|
}
|
||||||
@@ -327,8 +327,8 @@ export default {
|
|||||||
if (!this.checkSiteKey()) {
|
if (!this.checkSiteKey()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const randomstring = require('randomstring')
|
var randomstring = require('randomstring')
|
||||||
const doc = {
|
var doc = {
|
||||||
key: this.dialogType === 'edit' ? this.siteInfo.key : this.siteInfo.key ? this.siteInfo.key : randomstring.generate(6),
|
key: this.dialogType === 'edit' ? this.siteInfo.key : this.siteInfo.key ? this.siteInfo.key : randomstring.generate(6),
|
||||||
id: this.dialogType === 'edit' ? this.siteInfo.id : this.sites.length ? this.sites[this.sites.length - 1].id + 1 : 1,
|
id: this.dialogType === 'edit' ? this.siteInfo.id : this.sites.length ? this.sites[this.sites.length - 1].id + 1 : 1,
|
||||||
name: this.siteInfo.name,
|
name: this.siteInfo.name,
|
||||||
@@ -387,7 +387,7 @@ export default {
|
|||||||
remote.dialog.showOpenDialog(options).then(result => {
|
remote.dialog.showOpenDialog(options).then(result => {
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
result.filePaths.forEach(file => {
|
result.filePaths.forEach(file => {
|
||||||
const str = fs.readFileSync(file)
|
var str = fs.readFileSync(file)
|
||||||
const json = JSON.parse(str)
|
const json = JSON.parse(str)
|
||||||
json.forEach(ele => {
|
json.forEach(ele => {
|
||||||
if (ele.api && this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.api === ele.api).length === 0) {
|
if (ele.api && this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.api === ele.api).length === 0) {
|
||||||
@@ -436,7 +436,7 @@ export default {
|
|||||||
sites.add(row)
|
sites.add(row)
|
||||||
},
|
},
|
||||||
resetId (inArray) {
|
resetId (inArray) {
|
||||||
const id = 1
|
var id = 1
|
||||||
inArray.forEach(ele => {
|
inArray.forEach(ele => {
|
||||||
ele.id = id
|
ele.id = id
|
||||||
id += 1
|
id += 1
|
||||||
@@ -446,7 +446,7 @@ export default {
|
|||||||
// 因为el-table的数据是单向绑定,我们先同步el-table里的数据和其绑定的数据
|
// 因为el-table的数据是单向绑定,我们先同步el-table里的数据和其绑定的数据
|
||||||
this.syncTableData()
|
this.syncTableData()
|
||||||
sites.clear().then(res => {
|
sites.clear().then(res => {
|
||||||
const id = 1
|
var id = 1
|
||||||
this.sites.forEach(ele => {
|
this.sites.forEach(ele => {
|
||||||
ele.id = id
|
ele.id = id
|
||||||
id += 1
|
id += 1
|
||||||
@@ -467,7 +467,7 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const tbody = document.getElementById('sites-table').querySelector('.el-table__body-wrapper tbody')
|
const tbody = document.getElementById('sites-table').querySelector('.el-table__body-wrapper tbody')
|
||||||
const _this = this
|
var _this = this
|
||||||
Sortable.create(tbody, {
|
Sortable.create(tbody, {
|
||||||
onEnd ({ newIndex, oldIndex }) {
|
onEnd ({ newIndex, oldIndex }) {
|
||||||
const currRow = _this.sites.splice(oldIndex, 1)[0]
|
const currRow = _this.sites.splice(oldIndex, 1)[0]
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ export default {
|
|||||||
return a.localeCompare(b, 'zh')
|
return a.localeCompare(b, 'zh')
|
||||||
},
|
},
|
||||||
dateFormat (row, column) {
|
dateFormat (row, column) {
|
||||||
const date = row[column.property]
|
var date = row[column.property]
|
||||||
if (date === undefined) {
|
if (date === undefined) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ export default {
|
|||||||
// 屏蔽主分类
|
// 屏蔽主分类
|
||||||
const classToHide = ['电影', '电影片', '电视剧', '连续剧', '综艺', '动漫']
|
const classToHide = ['电影', '电影片', '电视剧', '连续剧', '综艺', '动漫']
|
||||||
zy.class(key).then(res => {
|
zy.class(key).then(res => {
|
||||||
const allClass = [{ name: '最新', tid: 0 }]
|
var allClass = [{ name: '最新', tid: 0 }]
|
||||||
res.class.forEach(element => {
|
res.class.forEach(element => {
|
||||||
if (!this.setting.excludeRootClasses || !classToHide.includes(element.name)) {
|
if (!this.setting.excludeRootClasses || !classToHide.includes(element.name)) {
|
||||||
if (this.setting.excludeR18Films) {
|
if (this.setting.excludeR18Films) {
|
||||||
@@ -629,7 +629,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
containsR18Keywords (name) {
|
containsR18Keywords (name) {
|
||||||
const containKeyWord = false
|
var containKeyWord = false
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return containKeyWord
|
return containKeyWord
|
||||||
}
|
}
|
||||||
@@ -750,8 +750,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
querySearch (queryString, cb) {
|
querySearch (queryString, cb) {
|
||||||
const searchList = this.searchList.slice(0, -1)
|
var searchList = this.searchList.slice(0, -1)
|
||||||
const results = queryString ? searchList.filter(this.createFilter(queryString)) : this.searchList
|
var results = queryString ? searchList.filter(this.createFilter(queryString)) : this.searchList
|
||||||
// 调用 callback 返回建议列表的数据
|
// 调用 callback 返回建议列表的数据
|
||||||
cb(results)
|
cb(results)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ export default {
|
|||||||
remote.dialog.showOpenDialog(options).then(result => {
|
remote.dialog.showOpenDialog(options).then(result => {
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
result.filePaths.forEach(file => {
|
result.filePaths.forEach(file => {
|
||||||
const str = fs.readFileSync(file)
|
var str = fs.readFileSync(file)
|
||||||
const json = JSON.parse(str)
|
const json = JSON.parse(str)
|
||||||
history.bulkAdd(json).then(res => {
|
history.bulkAdd(json).then(res => {
|
||||||
this.$message.success('导入成功')
|
this.$message.success('导入成功')
|
||||||
@@ -319,7 +319,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getSiteName (key) {
|
getSiteName (key) {
|
||||||
const site = this.sites.find(e => e.key === key)
|
var site = this.sites.find(e => e.key === key)
|
||||||
if (site) {
|
if (site) {
|
||||||
return site.name
|
return site.name
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ export default {
|
|||||||
},
|
},
|
||||||
updateDatabase () {
|
updateDatabase () {
|
||||||
history.clear().then(res => {
|
history.clear().then(res => {
|
||||||
const id = length
|
var id = length
|
||||||
this.history.forEach(ele => {
|
this.history.forEach(ele => {
|
||||||
ele.id = id
|
ele.id = id
|
||||||
id -= 1
|
id -= 1
|
||||||
|
|||||||
@@ -168,9 +168,9 @@ export default {
|
|||||||
},
|
},
|
||||||
getFilters () {
|
getFilters () {
|
||||||
const groups = [...new Set(this.channelList.map(iptv => iptv.group))]
|
const groups = [...new Set(this.channelList.map(iptv => iptv.group))]
|
||||||
const filters = []
|
var filters = []
|
||||||
groups.forEach(g => {
|
groups.forEach(g => {
|
||||||
const doc = {
|
var doc = {
|
||||||
text: g,
|
text: g,
|
||||||
value: g
|
value: g
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mergeChannel () {
|
mergeChannel () {
|
||||||
if (this.inputContent && this.multipleSelection.length) {
|
if (this.inputContent && this.multipleSelection.length) {
|
||||||
const channels = []
|
var channels = []
|
||||||
const id = this.multipleSelection[0].id
|
const id = this.multipleSelection[0].id
|
||||||
this.multipleSelection.forEach(ele => {
|
this.multipleSelection.forEach(ele => {
|
||||||
channels = channels.concat(ele.channels)
|
channels = channels.concat(ele.channels)
|
||||||
@@ -320,7 +320,7 @@ export default {
|
|||||||
remote.dialog.showSaveDialog(options).then(result => {
|
remote.dialog.showSaveDialog(options).then(result => {
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
if (result.filePath.endsWith('m3u')) {
|
if (result.filePath.endsWith('m3u')) {
|
||||||
const writer = require('m3u').extendedWriter()
|
var writer = require('m3u').extendedWriter()
|
||||||
this.iptvList.forEach(e => {
|
this.iptvList.forEach(e => {
|
||||||
writer.file(e.url, -1, e.name)
|
writer.file(e.url, -1, e.name)
|
||||||
})
|
})
|
||||||
@@ -364,7 +364,7 @@ export default {
|
|||||||
const urls = ele.url.split('#').filter(e => e.startsWith('http')) // 网址带#时自动分割
|
const urls = ele.url.split('#').filter(e => e.startsWith('http')) // 网址带#时自动分割
|
||||||
urls.forEach(url => {
|
urls.forEach(url => {
|
||||||
if (ele.name && url && new URL.URL(url).pathname.endsWith('.m3u8')) { // 网址可能带参数
|
if (ele.name && url && new URL.URL(url).pathname.endsWith('.m3u8')) { // 网址可能带参数
|
||||||
const doc = {
|
var doc = {
|
||||||
id: id,
|
id: id,
|
||||||
name: ele.name,
|
name: ele.name,
|
||||||
url: url,
|
url: url,
|
||||||
@@ -438,12 +438,12 @@ export default {
|
|||||||
res = res.filter(o => !this.iptvList.find(e => o.url === e.url))
|
res = res.filter(o => !this.iptvList.find(e => o.url === e.url))
|
||||||
const resClone = JSON.parse(JSON.stringify(res))
|
const resClone = JSON.parse(JSON.stringify(res))
|
||||||
const uniqueChannelName = {}
|
const uniqueChannelName = {}
|
||||||
for (const i = 0; i < resClone.length; i++) {
|
for (var i = 0; i < resClone.length; i++) {
|
||||||
const channelName = resClone[i].name.trim().replace(/[- ]?(1080p|蓝光|超清|高清|标清|hd|cq|4k)(\d{1,2})?$/i, '')
|
var channelName = resClone[i].name.trim().replace(/[- ]?(1080p|蓝光|超清|高清|标清|hd|cq|4k)(\d{1,2})?$/i, '')
|
||||||
if (channelName.match(/cctv/i)) channelName = channelName.replace('-', '')
|
if (channelName.match(/cctv/i)) channelName = channelName.replace('-', '')
|
||||||
if (Object.keys(uniqueChannelName).some(name => channelName.match(new RegExp(`${name}(1080p|4k|(?!\\d))`, 'i')))) continue // 避免重复
|
if (Object.keys(uniqueChannelName).some(name => channelName.match(new RegExp(`${name}(1080p|4k|(?!\\d))`, 'i')))) continue // 避免重复
|
||||||
const matchRule = new RegExp(`${channelName}(1080p|4k|(?!\\d))`, 'i')
|
const matchRule = new RegExp(`${channelName}(1080p|4k|(?!\\d))`, 'i')
|
||||||
for (const j = i; j < resClone.length; j++) {
|
for (var j = i; j < resClone.length; j++) {
|
||||||
if (resClone[j].name.match(/cctv/i)) {
|
if (resClone[j].name.match(/cctv/i)) {
|
||||||
resClone[j].name = resClone[j].name.replace('-', '')
|
resClone[j].name = resClone[j].name.replace('-', '')
|
||||||
}
|
}
|
||||||
@@ -513,7 +513,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
resetId (channelList) {
|
resetId (channelList) {
|
||||||
const id = 1
|
var id = 1
|
||||||
channelList.forEach(ele => {
|
channelList.forEach(ele => {
|
||||||
ele.id = id
|
ele.id = id
|
||||||
id += 1
|
id += 1
|
||||||
@@ -575,7 +575,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async checkChannelsBySite (channels) {
|
async checkChannelsBySite (channels) {
|
||||||
const siteList = {}
|
var siteList = {}
|
||||||
channels.forEach(channel => {
|
channels.forEach(channel => {
|
||||||
const site = channel.url.split('/')[2]
|
const site = channel.url.split('/')[2]
|
||||||
if (siteList[site]) {
|
if (siteList[site]) {
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ export default {
|
|||||||
const index = this.video.info.index || 0
|
const index = this.video.info.index || 0
|
||||||
const db = await history.find({ site: this.video.key, ids: this.video.info.id })
|
const db = await history.find({ site: this.video.key, ids: this.video.info.id })
|
||||||
const key = this.video.key + '@' + this.video.info.id
|
const key = this.video.key + '@' + this.video.info.id
|
||||||
const time = this.video.info.time
|
var time = this.video.info.time
|
||||||
this.xg.removeAllProgressDot()
|
this.xg.removeAllProgressDot()
|
||||||
this.startPosition = this.endPosition = { min: '00', sec: '00' }
|
this.startPosition = this.endPosition = { min: '00', sec: '00' }
|
||||||
if (db) {
|
if (db) {
|
||||||
@@ -752,9 +752,9 @@ export default {
|
|||||||
},
|
},
|
||||||
prevEvent () {
|
prevEvent () {
|
||||||
if (this.video.iptv) {
|
if (this.video.iptv) {
|
||||||
const index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID)
|
var index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID)
|
||||||
if (index >= 1) {
|
if (index >= 1) {
|
||||||
const channel = this.channelList[index - 1]
|
var channel = this.channelList[index - 1]
|
||||||
this.playChannel(channel)
|
this.playChannel(channel)
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning('这已经是第一个频道了。')
|
this.$message.warning('这已经是第一个频道了。')
|
||||||
@@ -770,9 +770,9 @@ export default {
|
|||||||
},
|
},
|
||||||
nextEvent () {
|
nextEvent () {
|
||||||
if (this.video.iptv) {
|
if (this.video.iptv) {
|
||||||
const index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID)
|
var index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID)
|
||||||
if (index < (this.channelList.length - 1)) {
|
if (index < (this.channelList.length - 1)) {
|
||||||
const channel = this.channelList[index + 1]
|
var channel = this.channelList[index + 1]
|
||||||
this.playChannel(channel)
|
this.playChannel(channel)
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning('这已经是最后一个频道了。')
|
this.$message.warning('这已经是最后一个频道了。')
|
||||||
@@ -904,7 +904,7 @@ export default {
|
|||||||
playWithExternalPalyerEvent () {
|
playWithExternalPalyerEvent () {
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
if (this.video.iptv) {
|
if (this.video.iptv) {
|
||||||
const externalPlayer = this.setting.externalPlayer
|
var externalPlayer = this.setting.externalPlayer
|
||||||
if (!externalPlayer) {
|
if (!externalPlayer) {
|
||||||
this.$message.error('请设置第三方播放器路径')
|
this.$message.error('请设置第三方播放器路径')
|
||||||
return
|
return
|
||||||
@@ -917,12 +917,12 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.fetchPlaylist().then(playlistUrls => {
|
this.fetchPlaylist().then(playlistUrls => {
|
||||||
const externalPlayer = this.setting.externalPlayer
|
var externalPlayer = this.setting.externalPlayer
|
||||||
if (!externalPlayer) {
|
if (!externalPlayer) {
|
||||||
this.$message.error('请设置第三方播放器路径')
|
this.$message.error('请设置第三方播放器路径')
|
||||||
// 在线播放该视频
|
// 在线播放该视频
|
||||||
if (playlistUrls[this.video.info.index].endsWith('.m3u8')) {
|
if (playlistUrls[this.video.info.index].endsWith('.m3u8')) {
|
||||||
const link = 'https://www.m3u8play.com/?play=' + playlistUrls[this.video.info.index]
|
var link = 'https://www.m3u8play.com/?play=' + playlistUrls[this.video.info.index]
|
||||||
const open = require('open')
|
const open = require('open')
|
||||||
open(link)
|
open(link)
|
||||||
}
|
}
|
||||||
@@ -945,11 +945,11 @@ export default {
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const filePath = path.join(os.tmpdir(), fileName + '.m3u')
|
var filePath = path.join(os.tmpdir(), fileName + '.m3u')
|
||||||
if (fs.existsSync(filePath)) {
|
if (fs.existsSync(filePath)) {
|
||||||
fs.unlinkSync(filePath)
|
fs.unlinkSync(filePath)
|
||||||
}
|
}
|
||||||
const str = '#EXTM3U' + os.EOL
|
var str = '#EXTM3U' + os.EOL
|
||||||
for (let ind = startIndex; ind < m3u8Arr.length; ind++) {
|
for (let ind = startIndex; ind < m3u8Arr.length; ind++) {
|
||||||
str += `#EXTINF: -1, 第${ind + 1}集` + os.EOL
|
str += `#EXTINF: -1, 第${ind + 1}集` + os.EOL
|
||||||
str += m3u8Arr[ind] + os.EOL
|
str += m3u8Arr[ind] + os.EOL
|
||||||
@@ -1017,7 +1017,7 @@ export default {
|
|||||||
},
|
},
|
||||||
listItemEvent (n) {
|
listItemEvent (n) {
|
||||||
if (this.video.iptv) {
|
if (this.video.iptv) {
|
||||||
const channel = this.channelList[n]
|
var channel = this.channelList[n]
|
||||||
// 是直播源,直接播放
|
// 是直播源,直接播放
|
||||||
this.playChannel(channel)
|
this.playChannel(channel)
|
||||||
} else {
|
} else {
|
||||||
@@ -1381,7 +1381,7 @@ export default {
|
|||||||
this.channelTree = []
|
this.channelTree = []
|
||||||
const groups = [...new Set(this.channelList.map(iptv => iptv.group))]
|
const groups = [...new Set(this.channelList.map(iptv => iptv.group))]
|
||||||
groups.forEach(g => {
|
groups.forEach(g => {
|
||||||
const doc = {
|
var doc = {
|
||||||
label: g,
|
label: g,
|
||||||
children: this.channelList.filter(x => x.group === g).map(i => { return { label: i.name, channel: i } })
|
children: this.channelList.filter(x => x.group === g).map(i => { return { label: i.name, channel: i } })
|
||||||
}
|
}
|
||||||
@@ -1468,7 +1468,7 @@ export default {
|
|||||||
this.videoStop()
|
this.videoStop()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const historyItem = this.right.history[0]
|
var historyItem = this.right.history[0]
|
||||||
this.video = { key: historyItem.site, info: { id: historyItem.ids, name: historyItem.name, index: historyItem.index } }
|
this.video = { key: historyItem.site, info: { id: historyItem.ids, name: historyItem.name, index: historyItem.index } }
|
||||||
} else if (this.video.iptv && !this.isLive) {
|
} else if (this.video.iptv && !this.isLive) {
|
||||||
this.playChannel(this.video.iptv)
|
this.playChannel(this.video.iptv)
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
filteredRecommendations () {
|
filteredRecommendations () {
|
||||||
const filteredData = this.recommendations.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
|
var filteredData = this.recommendations.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
|
||||||
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
|
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
|
||||||
return filteredData
|
return filteredData
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ export default {
|
|||||||
}
|
}
|
||||||
remote.dialog.showOpenDialog(options).then(result => {
|
remote.dialog.showOpenDialog(options).then(result => {
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
const playerPath = result.filePaths[0].replace(/\\/g, '/')
|
var playerPath = result.filePaths[0].replace(/\\/g, '/')
|
||||||
this.$message.success('设定第三方播放器路径为:' + result.filePaths[0])
|
this.$message.success('设定第三方播放器路径为:' + result.filePaths[0])
|
||||||
this.d.externalPlayer = playerPath
|
this.d.externalPlayer = playerPath
|
||||||
this.updateSettingEvent()
|
this.updateSettingEvent()
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ export default {
|
|||||||
},
|
},
|
||||||
updateEvent (e) {
|
updateEvent (e) {
|
||||||
zy.detail(e.key, e.ids).then(detailRes => {
|
zy.detail(e.key, e.ids).then(detailRes => {
|
||||||
const doc = {
|
var doc = {
|
||||||
id: e.id,
|
id: e.id,
|
||||||
key: e.key,
|
key: e.key,
|
||||||
ids: e.ids,
|
ids: e.ids,
|
||||||
@@ -320,7 +320,7 @@ export default {
|
|||||||
star.get(e.id).then(resStar => {
|
star.get(e.id).then(resStar => {
|
||||||
if (!e.hasUpdate && e.detail.last !== detailRes.last) {
|
if (!e.hasUpdate && e.detail.last !== detailRes.last) {
|
||||||
doc.hasUpdate = true
|
doc.hasUpdate = true
|
||||||
const msg = `同步"${e.name}"成功, 检查到更新。`
|
var msg = `同步"${e.name}"成功, 检查到更新。`
|
||||||
this.$message.success(msg)
|
this.$message.success(msg)
|
||||||
} else {
|
} else {
|
||||||
this.numNoUpdate += 1
|
this.numNoUpdate += 1
|
||||||
@@ -329,7 +329,7 @@ export default {
|
|||||||
this.getFavorites()
|
this.getFavorites()
|
||||||
})
|
})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
const msg = `同步"${e.name}"失败, 请重试。`
|
var msg = `同步"${e.name}"失败, 请重试。`
|
||||||
this.$message.warning(msg, err)
|
this.$message.warning(msg, err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -370,7 +370,7 @@ export default {
|
|||||||
if (row.site) {
|
if (row.site) {
|
||||||
return row.site.name
|
return row.site.name
|
||||||
} else {
|
} else {
|
||||||
const site = this.sites.find(e => e.key === row.key)
|
var site = this.sites.find(e => e.key === row.key)
|
||||||
if (site) {
|
if (site) {
|
||||||
return site.name
|
return site.name
|
||||||
}
|
}
|
||||||
@@ -422,10 +422,10 @@ export default {
|
|||||||
}
|
}
|
||||||
remote.dialog.showOpenDialog(options).then(result => {
|
remote.dialog.showOpenDialog(options).then(result => {
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
const starList = Array.from(this.list)
|
var starList = Array.from(this.list)
|
||||||
const id = this.list.length + 1
|
var id = this.list.length + 1
|
||||||
result.filePaths.forEach(file => {
|
result.filePaths.forEach(file => {
|
||||||
const str = fs.readFileSync(file)
|
var str = fs.readFileSync(file)
|
||||||
const json = JSON.parse(str)
|
const json = JSON.parse(str)
|
||||||
json.reverse().forEach(ele => {
|
json.reverse().forEach(ele => {
|
||||||
const starExists = starList.some(x => x.key === ele.key && x.ids === ele.ids)
|
const starExists = starList.some(x => x.key === ele.key && x.ids === ele.ids)
|
||||||
@@ -440,7 +440,7 @@ export default {
|
|||||||
last: ele.last,
|
last: ele.last,
|
||||||
note: ele.note
|
note: ele.note
|
||||||
}
|
}
|
||||||
const doc = {
|
var doc = {
|
||||||
id: id,
|
id: id,
|
||||||
key: ele.key,
|
key: ele.key,
|
||||||
ids: ele.ids,
|
ids: ele.ids,
|
||||||
@@ -473,7 +473,7 @@ export default {
|
|||||||
updateDatabase () {
|
updateDatabase () {
|
||||||
this.syncTableData()
|
this.syncTableData()
|
||||||
star.clear().then(res => {
|
star.clear().then(res => {
|
||||||
const id = this.list.length
|
var id = this.list.length
|
||||||
this.list.forEach(ele => {
|
this.list.forEach(ele => {
|
||||||
ele.id = id
|
ele.id = id
|
||||||
id -= 1
|
id -= 1
|
||||||
|
|||||||
@@ -35,29 +35,29 @@ const onlineVideo = {
|
|||||||
},
|
},
|
||||||
playVideoOnBde4 (videoName, videoIndex) {
|
playVideoOnBde4 (videoName, videoIndex) {
|
||||||
videoName = videoName.replace(/\s/g, '')
|
videoName = videoName.replace(/\s/g, '')
|
||||||
const url = `https://bde4.com/search/${videoName}`
|
var url = `https://bde4.com/search/${videoName}`
|
||||||
axios.get(url).then(res => {
|
axios.get(url).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('div.search-list')
|
var e = $('div.search-list')
|
||||||
const searchResult = $(e).find('div>div>div>div>a').toArray()
|
var searchResult = $(e).find('div>div>div>div>a').toArray()
|
||||||
// 获取第一个搜索结果的视频链接
|
// 获取第一个搜索结果的视频链接
|
||||||
const detailPageLink = $(searchResult[0]).attr('href')
|
var detailPageLink = $(searchResult[0]).attr('href')
|
||||||
// 获取第一个搜索结果的title
|
// 获取第一个搜索结果的title
|
||||||
const title = $(searchResult[0]).attr('title')
|
var title = $(searchResult[0]).attr('title')
|
||||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||||
// 如果第一个搜索结果不符合,打开搜索页面
|
// 如果第一个搜索结果不符合,打开搜索页面
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
const detailPageFullLink = 'https://bde4.com/' + detailPageLink
|
var detailPageFullLink = 'https://bde4.com/' + detailPageLink
|
||||||
// 解析详情页面
|
// 解析详情页面
|
||||||
axios.get(detailPageFullLink).then(res => {
|
axios.get(detailPageFullLink).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('div.info1')
|
var e = $('div.info1')
|
||||||
const videoList = $(e).find('a').toArray()
|
var videoList = $(e).find('a').toArray()
|
||||||
let videoFullLink = detailPageFullLink
|
var videoFullLink = detailPageFullLink
|
||||||
// 获取index视频链接
|
// 获取index视频链接
|
||||||
if (videoIndex < videoList.length) {
|
if (videoIndex < videoList.length) {
|
||||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||||
if (indexVideoLink.includes('.htm')) {
|
if (indexVideoLink.includes('.htm')) {
|
||||||
videoFullLink = 'https://bde4.com' + indexVideoLink
|
videoFullLink = 'https://bde4.com' + indexVideoLink
|
||||||
}
|
}
|
||||||
@@ -69,31 +69,31 @@ const onlineVideo = {
|
|||||||
},
|
},
|
||||||
playVideoOnK1080 (videoName, videoIndex) {
|
playVideoOnK1080 (videoName, videoIndex) {
|
||||||
videoName = videoName.replace(/\s/g, '')
|
videoName = videoName.replace(/\s/g, '')
|
||||||
const url = `https://k1080.net/vodsearch123/-------------.html?wd=${videoName}&submit=`
|
var url = `https://k1080.net/vodsearch123/-------------.html?wd=${videoName}&submit=`
|
||||||
axios.get(url).then(res => {
|
axios.get(url).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('#searchList')
|
var e = $('#searchList')
|
||||||
const searchResult = $(e).find('li>div>a').toArray()
|
var searchResult = $(e).find('li>div>a').toArray()
|
||||||
// 获取第一个搜索结果的视频链接
|
// 获取第一个搜索结果的视频链接
|
||||||
const detailPageLink = $(searchResult[0]).attr('href')
|
var detailPageLink = $(searchResult[0]).attr('href')
|
||||||
// 获取第一个搜索结果的title
|
// 获取第一个搜索结果的title
|
||||||
const title = $(searchResult[0]).attr('title')
|
var title = $(searchResult[0]).attr('title')
|
||||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||||
// 如果第一个搜索结果不符合,打开搜索页面
|
// 如果第一个搜索结果不符合,打开搜索页面
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
// 解析详情页面
|
// 解析详情页面
|
||||||
const detailPageFullLink = 'https://k1080.net' + detailPageLink
|
var detailPageFullLink = 'https://k1080.net' + detailPageLink
|
||||||
axios.get(detailPageFullLink).then(res2 => {
|
axios.get(detailPageFullLink).then(res2 => {
|
||||||
const $ = cheerio.load(res2.data)
|
const $ = cheerio.load(res2.data)
|
||||||
// 获取playlist1
|
// 获取playlist1
|
||||||
const e = $('#playlist1')
|
var e = $('#playlist1')
|
||||||
// 获取所有视频链接
|
// 获取所有视频链接
|
||||||
const videoList = $(e).find('div>ul>li>a').toArray()
|
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||||
let videoFullLink = detailPageFullLink
|
var videoFullLink = detailPageFullLink
|
||||||
// 获取index视频链接
|
// 获取index视频链接
|
||||||
if (videoIndex < videoList.length) {
|
if (videoIndex < videoList.length) {
|
||||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||||
if (indexVideoLink.includes('.htm')) {
|
if (indexVideoLink.includes('.htm')) {
|
||||||
videoFullLink = 'https://k1080.net' + indexVideoLink
|
videoFullLink = 'https://k1080.net' + indexVideoLink
|
||||||
}
|
}
|
||||||
@@ -105,31 +105,31 @@ const onlineVideo = {
|
|||||||
},
|
},
|
||||||
playVideoOnSubaibai (videoName, videoIndex) {
|
playVideoOnSubaibai (videoName, videoIndex) {
|
||||||
videoName = videoName.replace(/\s/g, '')
|
videoName = videoName.replace(/\s/g, '')
|
||||||
const url = `https://www.subaibai.com/xssearch?q=${videoName}`
|
var url = `https://www.subaibai.com/xssearch?q=${videoName}`
|
||||||
axios.get(url).then(res => {
|
axios.get(url).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('div.search_list')
|
var e = $('div.search_list')
|
||||||
const searchResult = $(e).find('div>ul>li>h3>a').toArray()
|
var searchResult = $(e).find('div>ul>li>h3>a').toArray()
|
||||||
// 获取第一个搜索结果的视频链接
|
// 获取第一个搜索结果的视频链接
|
||||||
const detailPageLink = $(searchResult[0]).attr('href')
|
var detailPageLink = $(searchResult[0]).attr('href')
|
||||||
// 获取第一个搜索结果的title
|
// 获取第一个搜索结果的title
|
||||||
const title = $(searchResult[0]).text()
|
var title = $(searchResult[0]).text()
|
||||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||||
// 如果第一个搜索结果不符合,打开搜索页面
|
// 如果第一个搜索结果不符合,打开搜索页面
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
// 解析详情页面
|
// 解析详情页面
|
||||||
const detailPageFullLink = detailPageLink
|
var detailPageFullLink = detailPageLink
|
||||||
axios.get(detailPageFullLink).then(res2 => {
|
axios.get(detailPageFullLink).then(res2 => {
|
||||||
const $ = cheerio.load(res2.data)
|
const $ = cheerio.load(res2.data)
|
||||||
// 获取playlist1
|
// 获取playlist1
|
||||||
const e = $('div.paly_list_btn')
|
var e = $('div.paly_list_btn')
|
||||||
// 获取所有视频链接
|
// 获取所有视频链接
|
||||||
const videoList = $(e).find('a').toArray()
|
var videoList = $(e).find('a').toArray()
|
||||||
// 获取index视频链接
|
// 获取index视频链接
|
||||||
let videoFullLink = detailPageFullLink
|
var videoFullLink = detailPageFullLink
|
||||||
if (videoIndex < videoList.length) {
|
if (videoIndex < videoList.length) {
|
||||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||||
if (indexVideoLink.includes('.htm')) {
|
if (indexVideoLink.includes('.htm')) {
|
||||||
videoFullLink = indexVideoLink
|
videoFullLink = indexVideoLink
|
||||||
}
|
}
|
||||||
@@ -141,31 +141,31 @@ const onlineVideo = {
|
|||||||
},
|
},
|
||||||
playVideoOnYhdm (videoName, videoIndex) {
|
playVideoOnYhdm (videoName, videoIndex) {
|
||||||
videoName = videoName.replace(/\s/g, '')
|
videoName = videoName.replace(/\s/g, '')
|
||||||
const url = `http://www.yhdm.tv/search/${videoName}`
|
var url = `http://www.yhdm.tv/search/${videoName}`
|
||||||
axios.get(url).then(res => {
|
axios.get(url).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('div.lpic')
|
var e = $('div.lpic')
|
||||||
const searchResult = $(e).find('div>ul>li>h2>a').toArray()
|
var searchResult = $(e).find('div>ul>li>h2>a').toArray()
|
||||||
// 获取第一个搜索结果的视频链接
|
// 获取第一个搜索结果的视频链接
|
||||||
const detailPageLink = $(searchResult[0]).attr('href')
|
var detailPageLink = $(searchResult[0]).attr('href')
|
||||||
// 获取第一个搜索结果的title
|
// 获取第一个搜索结果的title
|
||||||
const title = $(searchResult[0]).attr('title')
|
var title = $(searchResult[0]).attr('title')
|
||||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||||
// 如果第一个搜索结果不符合,打开搜索页面
|
// 如果第一个搜索结果不符合,打开搜索页面
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
// 解析详情页面
|
// 解析详情页面
|
||||||
const detailPageFullLink = 'http://www.yhdm.tv/' + detailPageLink
|
var detailPageFullLink = 'http://www.yhdm.tv/' + detailPageLink
|
||||||
axios.get(detailPageFullLink).then(res2 => {
|
axios.get(detailPageFullLink).then(res2 => {
|
||||||
const $ = cheerio.load(res2.data)
|
const $ = cheerio.load(res2.data)
|
||||||
// 获取playlist1
|
// 获取playlist1
|
||||||
const e = $('div.movurl')
|
var e = $('div.movurl')
|
||||||
// 获取所有视频链接
|
// 获取所有视频链接
|
||||||
const videoList = $(e).find('div>ul>li>a').toArray()
|
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||||
// 获取index视频链接
|
// 获取index视频链接
|
||||||
let videoFullLink = detailPageFullLink
|
var videoFullLink = detailPageFullLink
|
||||||
if (videoIndex < videoList.length) {
|
if (videoIndex < videoList.length) {
|
||||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||||
if (indexVideoLink.includes('.htm')) {
|
if (indexVideoLink.includes('.htm')) {
|
||||||
videoFullLink = 'http://www.yhdm.tv/' + indexVideoLink
|
videoFullLink = 'http://www.yhdm.tv/' + indexVideoLink
|
||||||
}
|
}
|
||||||
@@ -177,31 +177,31 @@ const onlineVideo = {
|
|||||||
},
|
},
|
||||||
playVideoOndmdm2020 (videoName, videoIndex) {
|
playVideoOndmdm2020 (videoName, videoIndex) {
|
||||||
videoName = videoName.replace(/\s/g, '')
|
videoName = videoName.replace(/\s/g, '')
|
||||||
const url = `http://www.dmdm2020.com/dongmansearch.html?wd=${videoName}&submit=`
|
var url = `http://www.dmdm2020.com/dongmansearch.html?wd=${videoName}&submit=`
|
||||||
axios.get(url).then(res => {
|
axios.get(url).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('#searchList')
|
var e = $('#searchList')
|
||||||
const searchResult = $(e).find('ul>li>div>h4>a').toArray()
|
var searchResult = $(e).find('ul>li>div>h4>a').toArray()
|
||||||
// 获取第一个搜索结果的视频链接
|
// 获取第一个搜索结果的视频链接
|
||||||
const detailPageLink = $(searchResult[0]).attr('href')
|
var detailPageLink = $(searchResult[0]).attr('href')
|
||||||
// 获取第一个搜索结果的title
|
// 获取第一个搜索结果的title
|
||||||
const title = $(searchResult[0]).text()
|
var title = $(searchResult[0]).text()
|
||||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||||
// 如果第一个搜索结果不符合,打开搜索页面
|
// 如果第一个搜索结果不符合,打开搜索页面
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
// 解析详情页面
|
// 解析详情页面
|
||||||
const detailPageFullLink = 'http://www.dmdm2020.com' + detailPageLink
|
var detailPageFullLink = 'http://www.dmdm2020.com' + detailPageLink
|
||||||
axios.get(detailPageFullLink).then(res2 => {
|
axios.get(detailPageFullLink).then(res2 => {
|
||||||
const $ = cheerio.load(res2.data)
|
const $ = cheerio.load(res2.data)
|
||||||
// 获取playlist1
|
// 获取playlist1
|
||||||
const e = $('#playlist1')
|
var e = $('#playlist1')
|
||||||
// 获取所有视频链接
|
// 获取所有视频链接
|
||||||
const videoList = $(e).find('div>ul>li>a').toArray()
|
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||||
// 获取index视频链接
|
// 获取index视频链接
|
||||||
let videoFullLink = detailPageFullLink
|
var videoFullLink = detailPageFullLink
|
||||||
if (videoIndex < videoList.length) {
|
if (videoIndex < videoList.length) {
|
||||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||||
if (indexVideoLink.includes('.htm')) {
|
if (indexVideoLink.includes('.htm')) {
|
||||||
videoFullLink = 'http://www.dmdm2020.com' + indexVideoLink
|
videoFullLink = 'http://www.dmdm2020.com' + indexVideoLink
|
||||||
}
|
}
|
||||||
@@ -213,31 +213,31 @@ const onlineVideo = {
|
|||||||
},
|
},
|
||||||
playVideoOnSyrme (videoName, videoIndex) {
|
playVideoOnSyrme (videoName, videoIndex) {
|
||||||
videoName = videoName.replace(/\s/g, '')
|
videoName = videoName.replace(/\s/g, '')
|
||||||
const url = `https://syrme.top/searchs?q=${videoName}`
|
var url = `https://syrme.top/searchs?q=${videoName}`
|
||||||
axios.get(url).then(res => {
|
axios.get(url).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('ul.MovieList')
|
var e = $('ul.MovieList')
|
||||||
const searchResult = $(e).find('ul>li>article>a').toArray()
|
var searchResult = $(e).find('ul>li>article>a').toArray()
|
||||||
// 获取第一个搜索结果的视频链接
|
// 获取第一个搜索结果的视频链接
|
||||||
const detailPageLink = $(searchResult[0]).attr('href')
|
var detailPageLink = $(searchResult[0]).attr('href')
|
||||||
// 获取第一个搜索结果的title
|
// 获取第一个搜索结果的title
|
||||||
const title = $(searchResult[0]).find('a>h2').text()
|
var title = $(searchResult[0]).find('a>h2').text()
|
||||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||||
// 如果第一个搜索结果不符合,打开搜索页面
|
// 如果第一个搜索结果不符合,打开搜索页面
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
// 解析详情页面
|
// 解析详情页面
|
||||||
const detailPageFullLink = 'https://syrme.top' + detailPageLink
|
var detailPageFullLink = 'https://syrme.top' + detailPageLink
|
||||||
axios.get(detailPageFullLink).then(res2 => {
|
axios.get(detailPageFullLink).then(res2 => {
|
||||||
const $ = cheerio.load(res2.data)
|
const $ = cheerio.load(res2.data)
|
||||||
// 获取playlist1
|
// 获取playlist1
|
||||||
const e = $('#categories-2')
|
var e = $('#categories-2')
|
||||||
// 获取所有视频链接
|
// 获取所有视频链接
|
||||||
const videoList = $(e).find('div>ul>li>a').toArray()
|
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||||
// 获取index视频链接
|
// 获取index视频链接
|
||||||
let videoFullLink = detailPageFullLink
|
var videoFullLink = detailPageFullLink
|
||||||
if (videoIndex < videoList.length) {
|
if (videoIndex < videoList.length) {
|
||||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||||
videoFullLink = 'https://syrme.top' + indexVideoLink
|
videoFullLink = 'https://syrme.top' + indexVideoLink
|
||||||
}
|
}
|
||||||
open(videoFullLink)
|
open(videoFullLink)
|
||||||
@@ -247,31 +247,31 @@ const onlineVideo = {
|
|||||||
},
|
},
|
||||||
playVideoOnJpysvip (videoName, videoIndex) {
|
playVideoOnJpysvip (videoName, videoIndex) {
|
||||||
videoName = videoName.replace(/\s/g, '')
|
videoName = videoName.replace(/\s/g, '')
|
||||||
const url = `https://www.jpysvip.net/vodsearch/-------------.html?wd=${videoName}&submit=`
|
var url = `https://www.jpysvip.net/vodsearch/-------------.html?wd=${videoName}&submit=`
|
||||||
axios.get(url).then(res => {
|
axios.get(url).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('#searchList')
|
var e = $('#searchList')
|
||||||
const searchResult = $(e).find('ul>li>div>a').toArray()
|
var searchResult = $(e).find('ul>li>div>a').toArray()
|
||||||
// 获取第一个搜索结果的视频链接
|
// 获取第一个搜索结果的视频链接
|
||||||
const detailPageLink = $(searchResult[0]).attr('href')
|
var detailPageLink = $(searchResult[0]).attr('href')
|
||||||
// 获取第一个搜索结果的title
|
// 获取第一个搜索结果的title
|
||||||
const title = $(searchResult[0]).attr('title')
|
var title = $(searchResult[0]).attr('title')
|
||||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||||
// 如果第一个搜索结果不符合,打开搜索页面
|
// 如果第一个搜索结果不符合,打开搜索页面
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
// 解析详情页面
|
// 解析详情页面
|
||||||
const detailPageFullLink = 'https://www.jpysvip.net' + detailPageLink
|
var detailPageFullLink = 'https://www.jpysvip.net' + detailPageLink
|
||||||
axios.get(detailPageFullLink).then(res2 => {
|
axios.get(detailPageFullLink).then(res2 => {
|
||||||
const $ = cheerio.load(res2.data)
|
const $ = cheerio.load(res2.data)
|
||||||
// 获取playlist1
|
// 获取playlist1
|
||||||
const e = $('#playlist1')
|
var e = $('#playlist1')
|
||||||
// 获取所有视频链接
|
// 获取所有视频链接
|
||||||
const videoList = $(e).find('div>ul>li>a').toArray()
|
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||||
// 获取index视频链接
|
// 获取index视频链接
|
||||||
let videoFullLink = detailPageFullLink
|
var videoFullLink = detailPageFullLink
|
||||||
if (videoIndex < videoList.length) {
|
if (videoIndex < videoList.length) {
|
||||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||||
videoFullLink = 'https://www.jpysvip.net/' + indexVideoLink
|
videoFullLink = 'https://www.jpysvip.net/' + indexVideoLink
|
||||||
}
|
}
|
||||||
open(videoFullLink)
|
open(videoFullLink)
|
||||||
@@ -281,31 +281,31 @@ const onlineVideo = {
|
|||||||
},
|
},
|
||||||
playVideoOnXhkan (videoName, videoIndex) {
|
playVideoOnXhkan (videoName, videoIndex) {
|
||||||
videoName = videoName.replace(/\s/g, '')
|
videoName = videoName.replace(/\s/g, '')
|
||||||
const url = `https://www.xhkan.com/vodsearch.html?wd=${videoName}&submit=`
|
var url = `https://www.xhkan.com/vodsearch.html?wd=${videoName}&submit=`
|
||||||
axios.get(url).then(res => {
|
axios.get(url).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
const e = $('#searchList')
|
var e = $('#searchList')
|
||||||
const searchResult = $(e).find('ul>li>div>a').toArray()
|
var searchResult = $(e).find('ul>li>div>a').toArray()
|
||||||
// 获取第一个搜索结果的视频链接
|
// 获取第一个搜索结果的视频链接
|
||||||
const detailPageLink = $(searchResult[0]).attr('href')
|
var detailPageLink = $(searchResult[0]).attr('href')
|
||||||
// 获取第一个搜索结果的title
|
// 获取第一个搜索结果的title
|
||||||
const title = $(searchResult[0]).attr('title')
|
var title = $(searchResult[0]).attr('title')
|
||||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||||
// 如果第一个搜索结果不符合,打开搜索页面
|
// 如果第一个搜索结果不符合,打开搜索页面
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
// 解析详情页面
|
// 解析详情页面
|
||||||
const detailPageFullLink = detailPageLink
|
var detailPageFullLink = detailPageLink
|
||||||
axios.get(detailPageFullLink).then(res2 => {
|
axios.get(detailPageFullLink).then(res2 => {
|
||||||
const $ = cheerio.load(res2.data)
|
const $ = cheerio.load(res2.data)
|
||||||
// 获取playlist1
|
// 获取playlist1
|
||||||
const e = $('#playlist1')
|
var e = $('#playlist1')
|
||||||
// 获取所有视频链接
|
// 获取所有视频链接
|
||||||
const videoList = $(e).find('div>ul>li>a').toArray()
|
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||||
// 获取index视频链接
|
// 获取index视频链接
|
||||||
let videoFullLink = detailPageFullLink
|
var videoFullLink = detailPageFullLink
|
||||||
if (videoIndex < videoList.length) {
|
if (videoIndex < videoList.length) {
|
||||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||||
videoFullLink = indexVideoLink
|
videoFullLink = indexVideoLink
|
||||||
}
|
}
|
||||||
open(videoFullLink)
|
open(videoFullLink)
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import { Parser as M3u8Parser } from 'm3u8-parser'
|
|||||||
// axios使用系统代理 https://evandontje.com/2020/04/02/automatic-system-proxy-configuration-for-electron-applications/
|
// axios使用系统代理 https://evandontje.com/2020/04/02/automatic-system-proxy-configuration-for-electron-applications/
|
||||||
// xgplayer使用chromium代理设置,浏览器又默认使用系统代理 https://www.chromium.org/developers/design-documents/network-settings
|
// xgplayer使用chromium代理设置,浏览器又默认使用系统代理 https://www.chromium.org/developers/design-documents/network-settings
|
||||||
// 要在设置中添加代理设置,可参考https://stackoverflow.com/questions/37393248/how-connect-to-proxy-in-electron-webview
|
// 要在设置中添加代理设置,可参考https://stackoverflow.com/questions/37393248/how-connect-to-proxy-in-electron-webview
|
||||||
const http = require('http')
|
var http = require('http')
|
||||||
const https = require('http')
|
var https = require('http')
|
||||||
const { remote } = require('electron')
|
const { remote } = require('electron')
|
||||||
const win = remote.getCurrentWindow()
|
var win = remote.getCurrentWindow()
|
||||||
const session = win.webContents.session
|
var session = win.webContents.session
|
||||||
const ElectronProxyAgent = require('electron-proxy-agent')
|
var ElectronProxyAgent = require('electron-proxy-agent')
|
||||||
|
|
||||||
// 请求超时时限
|
// 请求超时时限
|
||||||
// axios.defaults.timeout = 10000 // 可能使用代理,增长超时
|
// axios.defaults.timeout = 10000 // 可能使用代理,增长超时
|
||||||
@@ -42,7 +42,7 @@ axios.interceptors.response.use(function (response) {
|
|||||||
}, function (err) { // 请求错误时做些事
|
}, function (err) { // 请求错误时做些事
|
||||||
// 请求超时的之后,抛出 err.code = ECONNABORTED的错误..错误信息是 timeout of xxx ms exceeded
|
// 请求超时的之后,抛出 err.code = ECONNABORTED的错误..错误信息是 timeout of xxx ms exceeded
|
||||||
if (err.code === 'ECONNABORTED' && err.message.indexOf('timeout') !== -1) {
|
if (err.code === 'ECONNABORTED' && err.message.indexOf('timeout') !== -1) {
|
||||||
const config = err.config
|
var config = err.config
|
||||||
config.__retryCount = config.__retryCount || 0
|
config.__retryCount = config.__retryCount || 0
|
||||||
|
|
||||||
if (config.__retryCount >= config.retry) {
|
if (config.__retryCount >= config.retry) {
|
||||||
@@ -52,7 +52,7 @@ axios.interceptors.response.use(function (response) {
|
|||||||
|
|
||||||
config.__retryCount += 1
|
config.__retryCount += 1
|
||||||
|
|
||||||
const backoff = new Promise(function (resolve) {
|
var backoff = new Promise(function (resolve) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
resolve()
|
resolve()
|
||||||
}, config.retryDelay || 1)
|
}, config.retryDelay || 1)
|
||||||
@@ -204,7 +204,7 @@ const zy = {
|
|||||||
this.getSite(key).then(res => {
|
this.getSite(key).then(res => {
|
||||||
const site = res
|
const site = res
|
||||||
wd = encodeURI(wd)
|
wd = encodeURI(wd)
|
||||||
const url = `${site.api}?wd=${wd}`
|
var url = `${site.api}?wd=${wd}`
|
||||||
axios.post(url, { timeout: 3000 }).then(res => {
|
axios.post(url, { timeout: 3000 }).then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
const json = parser.parse(data, this.xmlConfig)
|
const json = parser.parse(data, this.xmlConfig)
|
||||||
@@ -237,7 +237,7 @@ const zy = {
|
|||||||
const jsondata = json.rss === undefined ? json : json.rss
|
const jsondata = json.rss === undefined ? json : json.rss
|
||||||
const videoList = jsondata.list.video
|
const videoList = jsondata.list.video
|
||||||
// Parse m3u8List
|
// Parse m3u8List
|
||||||
let m3u8List = []
|
var m3u8List = []
|
||||||
let mp4List = []
|
let mp4List = []
|
||||||
const dd = videoList.dl.dd
|
const dd = videoList.dl.dd
|
||||||
const type = Object.prototype.toString.call(dd)
|
const type = Object.prototype.toString.call(dd)
|
||||||
@@ -285,7 +285,7 @@ const zy = {
|
|||||||
const jsondata = json.rss === undefined ? json : json.rss
|
const jsondata = json.rss === undefined ? json : json.rss
|
||||||
const videoList = jsondata.list.video
|
const videoList = jsondata.list.video
|
||||||
// Parse m3u8List
|
// Parse m3u8List
|
||||||
let m3u8List = []
|
var m3u8List = []
|
||||||
const dd = videoList.dl.dd
|
const dd = videoList.dl.dd
|
||||||
const type = Object.prototype.toString.call(dd)
|
const type = Object.prototype.toString.call(dd)
|
||||||
if (type === '[object Array]') {
|
if (type === '[object Array]') {
|
||||||
@@ -332,10 +332,10 @@ const zy = {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.get(channel).then(res => {
|
axios.get(channel).then(res => {
|
||||||
const manifest = res.data
|
const manifest = res.data
|
||||||
const parser = new M3u8Parser()
|
var parser = new M3u8Parser()
|
||||||
parser.push(manifest)
|
parser.push(manifest)
|
||||||
parser.end()
|
parser.end()
|
||||||
const parsedManifest = parser.manifest
|
var parsedManifest = parser.manifest
|
||||||
if (parsedManifest.segments.length) {
|
if (parsedManifest.segments.length) {
|
||||||
resolve(true)
|
resolve(true)
|
||||||
} else {
|
} else {
|
||||||
@@ -355,16 +355,16 @@ const zy = {
|
|||||||
doubanLink (name, year) {
|
doubanLink (name, year) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// 豆瓣搜索链接
|
// 豆瓣搜索链接
|
||||||
const nameToSearch = name.replace(/\s/g, '')
|
var nameToSearch = name.replace(/\s/g, '')
|
||||||
const doubanSearchLink = 'https://www.douban.com/search?q=' + nameToSearch
|
var doubanSearchLink = 'https://www.douban.com/search?q=' + nameToSearch
|
||||||
axios.get(doubanSearchLink).then(res => {
|
axios.get(doubanSearchLink).then(res => {
|
||||||
const $ = cheerio.load(res.data)
|
const $ = cheerio.load(res.data)
|
||||||
// 查询所有搜索结果, 看名字和年代是否相符
|
// 查询所有搜索结果, 看名字和年代是否相符
|
||||||
let link = ''
|
var link = ''
|
||||||
$('div.result').each(function () {
|
$('div.result').each(function () {
|
||||||
const linkInDouban = $(this).find('div>div>h3>a').first()
|
var linkInDouban = $(this).find('div>div>h3>a').first()
|
||||||
const nameInDouban = linkInDouban.text().replace(/\s/g, '')
|
var nameInDouban = linkInDouban.text().replace(/\s/g, '')
|
||||||
const subjectCast = $(this).find('span.subject-cast').text()
|
var subjectCast = $(this).find('span.subject-cast').text()
|
||||||
if (nameToSearch === nameInDouban && subjectCast && subjectCast.includes(year)) {
|
if (nameToSearch === nameInDouban && subjectCast && subjectCast.includes(year)) {
|
||||||
link = linkInDouban.attr('href')
|
link = linkInDouban.attr('href')
|
||||||
}
|
}
|
||||||
@@ -388,14 +388,14 @@ const zy = {
|
|||||||
*/
|
*/
|
||||||
doubanRate (name, year) {
|
doubanRate (name, year) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const nameToSearch = name.replace(/\s/g, '')
|
var nameToSearch = name.replace(/\s/g, '')
|
||||||
this.doubanLink(nameToSearch, year).then(link => {
|
this.doubanLink(nameToSearch, year).then(link => {
|
||||||
if (link.includes('https://www.douban.com/search')) {
|
if (link.includes('https://www.douban.com/search')) {
|
||||||
resolve('暂无评分')
|
resolve('暂无评分')
|
||||||
} else {
|
} else {
|
||||||
axios.get(link).then(response => {
|
axios.get(link).then(response => {
|
||||||
const parsedHtml = cheerio.load(response.data)
|
const parsedHtml = cheerio.load(response.data)
|
||||||
const rating = parsedHtml('body').find('#interest_sectl').first().find('strong').first()
|
var rating = parsedHtml('body').find('#interest_sectl').first().find('strong').first()
|
||||||
if (rating.text()) {
|
if (rating.text()) {
|
||||||
resolve(rating.text().replace(/\s/g, ''))
|
resolve(rating.text().replace(/\s/g, ''))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user