Compare commits

...

12 Commits

Author SHA1 Message Date
hunlongyu
a214c524f7 window size 2020-01-08 16:23:58 +08:00
hunlongyu
9812991d7a Merge branch 'develop' 2020-01-08 16:21:16 +08:00
hunlongyu
d55c7f386b ico 2020-01-08 16:19:52 +08:00
hunlongyu
6dbd04fdbc v0.6.1 2020-01-08 16:11:24 +08:00
hunlongyu
2a03e04ab5 Create package-lock.json 2020-01-08 14:16:56 +08:00
hunlongyu
a0d66120a2 v0.6.0 2020-01-08 13:29:43 +08:00
hunlongyu
7669bbfd88 version 0.6.0 2020-01-08 11:34:14 +08:00
hunlongyu
7bad682e48 修改版本号 2020-01-08 11:19:11 +08:00
hunlongyu
f4becc4645 优化收藏页面和详情页面 2020-01-08 11:15:53 +08:00
hunlongyu
188035c4a1 新增更多资源网站, 优化显示结果. 2020-01-07 17:18:04 +08:00
hunlongyu
3764eaacbb 0.5.9 2019-12-24 11:47:56 +08:00
hunlongyu
71d8434f21 升级内核 2019-12-24 11:47:34 +08:00
14 changed files with 15388 additions and 144 deletions

15183
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,7 @@
{
"name": "zy-player",
"version": "0.5.8",
"author": "Hunlongyu",
"description": "A Video Player",
"license": "MIT",
"version": "0.6.2",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
@@ -36,7 +34,7 @@
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.1",
"babel-plugin-import": "^1.13.0",
"electron": "7.1.2",
"electron": "7.1.7",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"sass": "^1.19.0",

View File

@@ -43,13 +43,7 @@
}
}
.search-bottom{
border-top: 1px solid #dcdee2;
.ivu-progress-bg{
background-color: #dcdee2;
}
span{
color: #808695;
}
border-top: 1px solid #f0f0f0;
}
}
.collection{

View File

@@ -17,8 +17,8 @@ protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: tru
function createWindow () {
// Create the browser window.
win = new BrowserWindow({
width: 1400,
height: 800,
width: 1080,
height: 720,
frame: false,
webPreferences: {
webSecurity: false,

29
src/lib/sites.js Normal file
View File

@@ -0,0 +1,29 @@
const sites = [
{
id: 'okzy',
name: 'OK资源网',
url: 'https://www.okzy.co'
},
{
id: 'zuidazy',
name: '最大资源网',
url: 'http://www.zuidazy1.com'
},
{
id: 'subo',
name: '速播资源站',
url: 'https://www.subo988.com'
},
{
id: 'zuixinzy',
name: '最新资源网',
url: 'http://www.zuixinzy.cc'
},
{
id: '123ku',
name: '123资源网',
url: 'https://www.123ku.com'
}
]
export default sites

94
src/lib/util.zy.js Normal file
View File

@@ -0,0 +1,94 @@
import axios from 'axios'
import sites from './sites'
const zy = {
num: 0,
page: 1,
key: '',
site: {},
list: [],
getInfoRequire () {
return new Promise((resolve, reject) => {
const key = encodeURI(this.key)
const params = `${this.site.url}/index.php?m=vod-search-pg-${this.page}-wd-${key}.html`
axios.get(params).then(res => {
this.getInfoHtml(res.data).then(res => {
resolve(res)
})
}).catch(err => {
reject(err)
})
})
},
getInfoHtml (txt) {
return new Promise((resolve, reject) => {
const parser = new DOMParser()
const html = parser.parseFromString(txt, 'text/html')
const list = html.querySelectorAll('.xing_vb li')
let d = {
list: [],
num: 0
}
for (let i = 1; i < list.length - 1; i++) {
let info = {
name: list[i].childNodes[1].innerText,
detail: this.site.url + list[i].childNodes[1].childNodes[0].getAttribute('href'),
category: list[i].childNodes[3].innerText,
time: list[i].childNodes[5].innerText,
index: 0,
urls: [],
check: false
}
d.list.push(info)
}
let num = html.querySelectorAll('.nvc dd span')[1].innerText
num = parseInt(num)
d.num = num
resolve(d)
})
},
info (n = 0, p = 1, k = null) {
return new Promise((resolve, reject) => {
this.page = p
this.key = k
this.num = n
this.site = sites[this.num]
this.getInfoRequire().then(res => {
resolve(res)
})
})
},
detail (url) {
return new Promise((resolve, reject) => {
axios.get(url).then(res => {
resolve(this.getDetailUrls(res.data))
}).catch(err => {
reject(err)
})
})
},
getDetailUrls (txt) {
return new Promise((resolve, reject) => {
const parser = new DOMParser()
let html = parser.parseFromString(txt, 'text/html')
let data = {
box: null,
info: null,
urls: []
}
data.box = html.querySelector('.vodBox').innerHTML
data.info = html.querySelector('.vodplayinfo').innerHTML
let urls = html.querySelectorAll('.vodplayinfo li')
let arr = []
for (let i in urls) {
let j = urls[i].innerText
if (j !== undefined && j.indexOf('.m3u8') !== -1) {
arr.push(urls[i].innerText)
}
}
data.urls = arr
resolve(data)
})
}
}
export default zy

View File

@@ -2,8 +2,8 @@ import Vue from 'vue'
import 'view-design/dist/styles/iview.css'
import {
Layout, Sider, Header, Content, Row, Col,
Icon, Button, Input, Progress, Table,
Message, Notice
Icon, Button, Input, Select, Option, Table,
Message, Notice, Page
} from 'view-design'
Vue.component('Layout', Layout)
@@ -15,8 +15,10 @@ Vue.component('Col', Col)
Vue.component('Icon', Icon)
Vue.component('Button', Button)
Vue.component('Input', Input)
Vue.component('Progress', Progress)
Vue.component('Select', Select)
Vue.component('Option', Option)
Vue.component('Table', Table)
Vue.component('Page', Page)
Vue.prototype.$Message = Message
Vue.prototype.$Notice = Notice

View File

@@ -6,6 +6,7 @@ Vue.use(Vuex)
export default new Vuex.Store({
state: {
site: 0,
theme: {
id: '',
color: 'light'
@@ -14,6 +15,9 @@ export default new Vuex.Store({
video: {}
},
getters: {
getSite: state => {
return state.site
},
getTheme: state => {
return state.theme
},
@@ -25,6 +29,9 @@ export default new Vuex.Store({
}
},
mutations: {
SET_SITE: (state, payload) => {
state.site = payload
},
SET_THEME: (state, payload) => {
state.theme = payload
},
@@ -40,6 +47,11 @@ export default new Vuex.Store({
setting.update(payload.id, { theme: payload.color }).then(res => {
commit('SET_THEME', payload)
})
},
changeSite: ({ commit }, payload) => {
setting.update(payload.id, { site: payload.site }).then(res => {
commit('SET_SITE', payload)
})
}
}
})

View File

@@ -1,94 +0,0 @@
import axios from 'axios'
const haku = {
url: 'https://www.666zy.com',
getHtml (txt) {
return new Promise((resolve, reject) => {
const t = encodeURI(txt)
const d = `wd=${t}&submit=search`
axios({
url: this.url + '/index.php',
method: 'post',
params: { m: 'vod-search' },
data: d
}).then(res => {
resolve(this.getVideoInfo(res.data))
}).catch(err => {
reject(err)
})
})
},
getVideoInfo (txt) {
return new Promise((resolve, reject) => {
const parser = new DOMParser()
let html = parser.parseFromString(txt, 'text/html')
let nameList = html.querySelectorAll('.xing_vb4 a')
let name = []
let detail = []
for (let i = 0; i < nameList.length; i++) {
name.push(nameList[i].innerText)
detail.push(this.url + nameList[i].getAttribute('href'))
}
let categoryList = html.querySelectorAll('.xing_vb5 a')
let category = []
for (let i = 0; i < categoryList.length; i++) {
category.push(categoryList[i].innerText)
}
let timeList = html.querySelectorAll('.xing_vb6')
let time = []
for (let i = 0; i < timeList.length; i++) {
time.push(timeList[i].innerText)
}
let data = []
for (let i = 0; i < name.length; i++) {
let d = {}
d.name = name[i]
d.detail = detail[i]
d.category = category[i]
d.time = time[i]
d.index = 0
d.urls = []
d.check = false
data.push(d)
}
resolve(data)
})
},
getDetail (url) {
return new Promise((resolve, reject) => {
axios({
url: url,
method: 'get'
}).then(res => {
resolve(this.getUrls(res.data))
}).catch(err => {
reject(err)
})
})
},
getUrls (txt) {
return new Promise((resolve, reject) => {
const parser = new DOMParser()
let html = parser.parseFromString(txt, 'text/html')
let data = {
box: null,
info: null,
urls: []
}
data.box = html.querySelector('.vodBox').innerHTML
data.info = html.querySelector('.vodplayinfo').innerHTML
let url = html.querySelectorAll('.vodplayinfo a')
let arr = []
for (let i in url) {
let j = url[i].innerHTML
if (j !== undefined && j.indexOf('.m3u8') !== -1) {
arr.push(url[i].innerHTML)
}
}
data.urls = arr
resolve(data)
})
}
}
export default haku

View File

@@ -8,7 +8,7 @@
</div>
</template>
<script>
import haku from '@/util/util.666zy'
import zy from '@/lib/util.zy'
import { mapMutations } from 'vuex'
export default {
name: 'detail',
@@ -40,7 +40,7 @@ export default {
async getDetail () {
this.box = false
let url = this.video.detail
this.data = await haku.getDetail(url)
this.data = await zy.detail(url)
this.video.urls = this.data.urls
this.video.check = true
this.box = true

View File

@@ -12,7 +12,8 @@
<script>
import 'xgplayer'
import Hls from 'xgplayer-hls.js'
import haku from '@/util/util.666zy'
import zy from '@/lib/util.zy'
// import haku from '@/lib/util.666zy'
export default {
name: 'player',
data () {
@@ -58,7 +59,7 @@ export default {
async getDetail () {
let d = this.video.detail
let index = this.video.index
this.data = await haku.getDetail(d)
this.data = await zy.detail(d)
let urls = this.data.urls
this.video.urls = urls
this.video.check = true
@@ -75,6 +76,7 @@ export default {
playBtn (i, j, e) {
this.video.index = j
let url = this.video.urls[this.video.index].split('$')[1]
this.info = this.video.urls[this.video.index].split('$')[0]
this.xg.src = url
}
},

View File

@@ -1,7 +1,12 @@
<template>
<div class="search">
<div :class="active ? 'search-top haveList': 'search-top'" >
<Input class="search-input" v-model.trim="txt" size="large" search placeholder="输入需要搜索的资源名称..." @on-search="searchEvent" @on-focus="searchFocus" />
<Input class="search-input" v-model.trim="txt" size="large" search placeholder="输入需要搜索的资源名称..." @on-search="searchEvent" clearable @on-clear="searchClear">
<Select slot="prepend" v-model="site" style="width: 120px;">
<Option v-for="(i, j) in sites" :key="j" :value="j">{{i.name}}</Option>
</Select>
<!-- eslint-disable-next-line -->
</Input>
</div>
<div class="search-middle" v-if="active">
<Table stripe :columns="columns" :data="data" :loading="loading">
@@ -13,38 +18,38 @@
</Table>
</div>
<div class="search-bottom" v-if="active">
<Progress class="progress" :percent="percent" status="active" :stroke-width="10">
<span class="progress-txt">搜索中</span>
</Progress>
<Page :total="num" :current.sync="page" :page-size="50" show-total @on-change="onChange" />
</div>
</div>
</template>
<script>
import db from '@/plugin/nedb/video'
import haku from '@/util/util.666zy'
import { mapGetters } from 'vuex'
import zy from '@/lib/util.zy'
import sites from '@/lib/sites'
import { mapGetters, mapMutations } from 'vuex'
export default {
name: 'search',
data () {
return {
sites: sites,
txt: '',
active: false,
percent: 0,
columns: [
{
title: 'Name',
key: 'name'
key: 'name',
minWidth: 240
},
{
title: 'Category',
key: 'category',
width: 120,
width: 100,
align: 'center'
},
{
title: 'Time',
key: 'time',
width: 180,
width: 110,
align: 'center'
},
{
@@ -55,24 +60,47 @@ export default {
}
],
data: [],
page: 1,
num: 0,
loading: true
}
},
computed: {
...mapGetters(['getVideo'])
...mapGetters(['getVideo']),
...mapGetters({
getSite: 'getSite'
}),
site: {
get () {
return this.getSite
},
set (val) {
this.SET_SITE(val)
}
}
},
methods: {
...mapMutations(['SET_SITE']),
async searchEvent () {
if (this.txt !== '') {
this.data = await haku.getHtml(this.txt)
this.active = true
this.loading = true
this.page = 1
let z = await zy.info(this.site, this.page, this.txt)
this.data = z.list
this.num = z.num
this.loading = false
this.percent = 20
}
},
searchFocus () {
searchClear () {
this.txt = ''
this.active = false
this.loading = true
},
async onChange () {
let z = await zy.info(this.site, this.page, this.txt)
this.data = z.list
this.num = z.num
},
play (e) {
if (this.getVideo.detail !== e.detail) {
@@ -82,7 +110,7 @@ export default {
this.$router.push({ name: 'play' })
},
async collection (e) {
let d = await haku.getDetail(e.detail)
let d = await zy.detail(e.detail)
let data = {
category: e.category,
detail: e.detail,
@@ -117,6 +145,9 @@ export default {
this.$store.commit('SET_ICON_ACTIVE', 'detail')
this.$router.push({ name: 'detail' })
}
},
created () {
// this.sites = sites
}
}
</script>
@@ -161,7 +192,7 @@ export default {
position: absolute;
top: 60px;
width: 100%;
height: calc(100% - 80px);
height: calc(100% - 120px);
padding: 10px;
overflow: scroll;
&::-webkit-scrollbar { display: none }
@@ -180,18 +211,11 @@ export default {
bottom: 0;
left: 0;
width: 100%;
height: 20px;
height: 60px;
display: flex;
align-items: center;
justify-content: space-around;
padding: 0 10px;
.progress-txt{
font-size: 10px;
margin-left: 4px;
}
.progress{
width: 100%;
}
}
}
</style>

View File

@@ -10,7 +10,7 @@
</div>
<div class="item upgrade">
<div class="title">更新:</div>
<div class="btns">版本: v</div>
<div class="btns">版本: v0.6.2</div>
<div class="btns"><Button @click="checkUpgrade">检查更新</Button></div>
</div>
<div class="item theme">

View File

@@ -3524,10 +3524,10 @@ electron-to-chromium@^1.3.306:
resolved "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.314.tgz#c186a499ed2c9057bce9eb8dca294d6d5450facc"
integrity sha1-wYakme0skFe86euNyilNbVRQ+sw=
electron@7.1.2:
version "7.1.2"
resolved "https://registry.npm.taobao.org/electron/download/electron-7.1.2.tgz?cache=0&sync_timestamp=1574308387471&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron%2Fdownload%2Felectron-7.1.2.tgz#d1726b9e50b29e97f5f12b52feb225ba87e0640f"
integrity sha1-0XJrnlCynpf18StS/rIluofgZA8=
electron@7.1.7:
version "7.1.7"
resolved "https://registry.yarnpkg.com/electron/-/electron-7.1.7.tgz#520e2bc422e3dfd4bae166dd3be62101f2cbdc52"
integrity sha512-aCLJ4BJwnvOckJgovNul22AYlMFDzm4S4KqKCG2iBlFJyMHBxXAKFKMsgYd40LBZWS3hcY6RHpaYjHSAPLS1pw==
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^12.0.12"