Skip to content

Commit

Permalink
remove missing videoId items in youku
Browse files Browse the repository at this point in the history
  • Loading branch information
yfang1644 committed Apr 5, 2020
1 parent e12aaed commit 2d44f1e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 66 deletions.
2 changes: 1 addition & 1 deletion addons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@

<addon id="plugin.video.youku"
name="优酷视频"
version="2.0.2"
version="2.0.3"
provider-name="yfang1644">
<requires>
<import addon="script.module.geturl" version="2.0.0"/>
Expand Down
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c03d1e30c520567b94db4bfbfdaa7213 addons.xml
684fb49b798b75b91afb7c96f6511e3f addons.xml
97 changes: 35 additions & 62 deletions plugin.video.iqiyi/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from xbmcgui import Dialog, ListItem
from xbmcplugin import addDirectoryItem, endOfDirectory, setContent
import xbmcaddon
import re
import os
from json import loads
from bs4 import BeautifulSoup
Expand All @@ -16,7 +15,7 @@
# 爱奇艺 list.iqiyi.com
########################################################################

LIST_URL = 'http://list.iqiyi.com'
LIST_URL = 'https://list.iqiyi.com'

ALBUM_API = 'https://pcw-api.iqiyi.com/albums/album/avlistinfo?aid={}&page=1&size=300'

Expand Down Expand Up @@ -345,61 +344,62 @@ def search(params):


def filter(params):
chninfo = 'https://pcw-api.iqiyi.com/search/category/categoryinfo?brand=IQIYI&channel_id={}&locale=zh'
url = 'https://list.iqiyi.com/www/{}/-------------24-1-1-iqiyi--.html'
#chninfo = 'https://pcw-api.iqiyi.com/search/category/categoryinfo?brand=IQIYI&channel_id={}&locale=zh'
cid = params['cid']
html = get_html(chninfo.format(cid))
data = loads(html)
html = get_html(url.format(cid))

dialog = Dialog()

m = r1("category-list='(\[.+?\])'", html)
data = loads(m)

f = []
tn = ''
for item in data['data']:
for item in data:
lst = [x['name'] for x in item['child']]
lst.insert(0, '全部')
sel = dialog.select(item['name'], lst)

if sel > 0:
f += [str(item['child'][sel-1]['id']) + ';must']
tn += '|' + item['child'][sel-1]['name']

m = r1("my-year='(\{.+?\})'", html)
data = loads(m)

lst = [x['name'] for x in data['list']]
sel = dialog.select('年份', lst)
if sel >= 0:
params['year'] = data['list'][sel]['id']
tn += '|' + data['list'][sel]['name']

m = r1("order-list='(\[.+?\])'", html)
data = loads(m)

lst = [x['name'] for x in data]
sel = dialog.select('排序', lst)
sel = max(sel, 0)
params['order'] = data[sel]['id']
tn += '|' + data[sel]['name']

params['type'] = ','.join(f)
params['page'] = '1'
params['typename'] = tn.encode('utf-8')
category(params)


orderlist=[{"id":24,"name":"综合排序"},
{"id":11,"name":"热播榜"},
{"id":4,"name":"新上线"}]

def category(params):
order = params['order']
order = params.get('order', 24) # 综合排序
cid = params['cid']
page = params['page']
year = params.get('year', '')
page = params.get('page', 1)
type = params.get('type', '')
typename = params.get('typename', '')

li = ListItem('[COLOR FFDEB887][分类过滤 %s][/COLOR]' % typename)
u = sys.argv[0] + '?mode=filter&' + urlencode(params)
addDirectoryItem(int(sys.argv[1]), u, li, True)

for x in orderlist:
if int(x['id']) == int(order):
style = '[COLOR red]{}[/COLOR]'.format(x['name'])
else:
style = '[COLOR yellow]{}[/COLOR]'.format(x['name'])
li = ListItem(style)
req = {
'mode': 'category',
'order': x['id'],
'cid': cid,
'page': page,
'type': type,
'typename': typename
}
u = sys.argv[0] + '?' + urlencode(req)
addDirectoryItem(int(sys.argv[1]), u, li, True)

PCW_API = 'https://pcw-api.iqiyi.com/search/video/videolists?'
req = {
'access_play_control_platform': 14,
Expand All @@ -409,7 +409,7 @@ def category(params):
'is_album_finished': '',
'is_purchase': '',
'key': '',
'market_release_date_level': '',
'market_release_date_level': year,
'mode': order,
'pageNum': page,
'pageSize': 30,
Expand Down Expand Up @@ -467,46 +467,19 @@ def category(params):
endOfDirectory(int(sys.argv[1]))


channellist=[{"cid":2,"name":"电视剧"},
{"cid":1,"name":"电影"},
{"cid":6,"name":"综艺"},
{"cid":4,"name":"动漫"},
{"cid":3,"name":"纪录片"},
{"cid":8,"name":"游戏"},
{"cid":25,"name":"资讯"},
{"cid":7,"name":"娱乐"},
{"cid":24,"name":"财经"},
{"cid":16,"name":"网络电影"},
{"cid":10,"name":"片花"},
{"cid":5,"name":"音乐"},
{"cid":28,"name":"军事"},
{"cid":12,"name":"教育"},
{"cid":17,"name":"体育"},
{"cid":15,"name":"儿童"},
{"cid":9,"name":"旅游"},
{"cid":13,"name":"时尚"},
{"cid":21,"name":"生活"},
{"cid":26,"name":"汽车"},
{"cid":22,"name":"搞笑"},
{"cid":20,"name":"广告"},
{"cid":27,"name":"原创"},
{"cid":29,"name":"母婴"},
{"cid":30,"name":"科技"},
{"cid":31,"name":"脱口秀"},
{"cid":32,"name":"健康"}]

def root():
li = ListItem('[COLOR yellow] 【爱奇艺 - 搜索】[/COLOR]')
u = sys.argv[0] + '?mode=search'
addDirectoryItem(int(sys.argv[1]), u, li, True)

for channel in channellist:
html = get_html(LIST_URL)
m = r1("channel-list='(\[.+?\])'", html)
channels = loads(m)
for channel in channels:
li = ListItem(channel['name'])
req = {
'mode': 'category',
'order': 24,
'cid': channel['cid'],
'page': 1,
}
u = sys.argv[0] + '?' + urlencode(req)
addDirectoryItem(int(sys.argv[1]), u, li, True)
Expand Down
Binary file modified plugin.video.iqiyi/plugin.video.iqiyi-2.4.9.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin.video.youku/addon.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.youku"
name="优酷视频" version="2.0.2"
name="优酷视频" version="2.0.3"
provider-name="yfang1644">
<requires>
<import addon="script.module.beautifulsoup4" version="4.3.2"/>
Expand Down
6 changes: 5 additions & 1 deletion plugin.video.youku/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,22 @@ def mainlist(params):
api = 'https://list.youku.com/category/page?'
req = params.copy()
req['p'] = page
req.pop('title')
html = get_html(api + urlencode(req))
data = loads(html)

series = (97, 85, 100, 177, 87, 84, 98, 178, 86, 99)
for item in data['data']:
vid = item.get('videoId')
if not vid:
continue
li = ListItem(item['title'] + '(' + item['summary'] +')',
thumbnailImage=httphead(item['img']))
li.setInfo(type='Video',
infoLabels={'title': item['title'], 'plot': item.get('subTitle', '')})
req = {
'mode': 'episodelist' if int(cid) in series else 'playvideo',
'vid': item['videoId'],
'vid': vid,
'thumbnail': httphead(item['img']),
'name': item['title'].encode('utf-8')
}
Expand Down
Binary file not shown.

0 comments on commit 2d44f1e

Please sign in to comment.