Skip to content

Commit

Permalink
add filter to iqiyi
Browse files Browse the repository at this point in the history
  • Loading branch information
yfang1644 committed Apr 5, 2020
1 parent c8956c4 commit e12aaed
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 201 deletions.
4 changes: 2 additions & 2 deletions addons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@

<addon id="plugin.video.mgtv"
name="芒果TV"
version="1.1.7"
version="1.1.8"
provider-name="yfang1644">
<requires>
<import addon="script.module.xbmcswift2" version="2.4.0"/>
Expand Down Expand Up @@ -406,7 +406,7 @@

<addon id="plugin.video.iqiyi"
name="爱奇艺视频(IQIYI)"
version="2.4.8"
version="2.4.9"
provider-name="yfang1644">
<requires>
<import addon="script.module.beautifulsoup4" version="4.3.2"/>
Expand Down
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f89cb90ade67477b5819e3688194a3d9 addons.xml
c03d1e30c520567b94db4bfbfdaa7213 addons.xml
20 changes: 11 additions & 9 deletions channel.m3u
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ http://223.110.241.139:6610/gitv/live1/G_NJSB/G_NJSB
#EXTINF:-1 tvg-country="CN" tvg-id="cctv1" tvg-name="CCTV1" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV1.png" group-title="中央台", CCTV1综合
http://223.110.242.130:6610/gitv/live1/G_CCTV-1-HQ/index.m3u8
#EXTINF:-1 tvg-country="CN" tvg-id="cctv2" tvg-name="CCTV2" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV2.png" group-title="中央台" ,CCTV2财经
http://ott.js.chinamobile.com/PLTV/3/224/3221227207/index.m3u8
http://223.110.241.139:6610/gitv/live1/G_CCTV-2-HD/G_CCTV-2-HD/
#EXTINF:-1 tvg-language="Chinese" tvg-country="CN" tvg-id="cctv3" tvg-name="CCTV3" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV3.png" group-title="中央台" ,CCTV3综艺
http://223.110.242.130:6610/gitv/live1/G_CCTV-3-HQ/index.m3u8
#EXTINF:-1 tvg-country="CN" tvg-id="cctv4" tvg-name="CCTV4" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV4.png" group-title="中央台" ,CCTV4国际
Expand All @@ -43,12 +43,12 @@ http://223.110.242.130:6610/gitv/live1/G_CCTV-11-HQ/index.m3u8
http://ott.js.chinamobile.com/PLTV/3/224/3221225556/index.m3u8
#EXTINF:-1 tvg-name="CCTV13" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV13.png" group-title="中央台" ,CCTV13新闻
http://223.110.242.130:6610/gitv/live1/G_CCTV-13-HQ/index.m3u8
#EXTINF:-1tvg-name="CCTV14" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV14.png" group-title="中央台" ,CCTV14少儿
#EXTINF:-1 tvg-name="CCTV14" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV14.png" group-title="中央台" ,CCTV14少儿
http://ott.js.chinamobile.com/PLTV/3/224/3221227201/index.m3u8
#EXTINF:-1 tvg-name="CCTV15" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV15.png" group-title="中央台" ,CCTV15音乐
http://otttv.bj.chinamobile.com/PLTV/88888888/224/3221226317/1.m3u8
#EXTINF:-1 tvg-name="CCTV17" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV17.png" group-title="中央台" ,CCTV17农业农村
http://otttv.bj.chinamobile.com/PLTV/88888888/224/3221226318/1.m3u8
http://223.110.241.139:6610/gitv/live1/G_CCTV-17-HD/
#EXTINF:-1 tvg-name="风云音乐" group-title="中央台" ,CCTV风云音乐
http://223.99.186.132:6410/shandong_cabletv.live.zte.com/223.99.253.7:8081/00/SNM/CHANNEL00000613/index.m3u8
#EXTINF:-1 tvg-name="CGTN1" group-title="中央台" ,CGTN1(英文)
Expand All @@ -65,6 +65,14 @@ http://ott.js.chinamobile.com/PLTV/3/224/3221227030/index.m3u8
http://ott.js.chinamobile.com/PLTV/3/224/3221227043/index.m3u8
#EXTINF:-1 group-title="中央台" ,CCTV怀旧剧场
http://223.99.186.132:6410/shandong_cabletv.live.zte.com/223.99.253.7:8081/00/SNM/CHANNEL00000622/index.m3u8
#EXTINF:-1 tvg-name="中国教育1台" tvg-logo="http://epg.51zmt.top:8000/tb1/qt/中国教育1台.png" group-title="中央台" ,中国教育1台
http://223.110.241.139:6610/gitv/live1/G_CETV-1/
#EXTINF:-1 tvg-name="中国教育2台" tvg-logo="http://epg.51zmt.top:8000/tb1/qt/中国教育2台.png" group-title="中央台" ,中国教育2台
http://223.110.241.139:6610/gitv/live1/G_CETV-2/
#EXTINF:-1 tvg-name="中国教育3台" tvg-logo="http://epg.51zmt.top:8000/tb1/qt/中国教育3台.png" group-title="中央台" ,中国教育3台
http://223.110.241.139:6610/gitv/live1/G_CETV-3/
#EXTINF:-1 tvg-name="中国教育4台" group-title="中央台" ,中国教育4台
http://223.110.241.139:6610/gitv/live1/G_CETV-4/
#EXTINF:-1 tvg-name="安徽卫视" tvg-logo="http://epg.51zmt.top:8000/tb1/ws/anhui.png" group-title="地方电视台" ,安徽卫视
http://ott.js.chinamobile.com/PLTV/3/224/3221225634/index.m3u8
#EXTINF:-1 tvg-name="安徽卫视" tvg-logo="http://epg.51zmt.top:8000/tb1/ws/anhui.png" group-title="地方电视台" ,安徽卫视(HD)
Expand Down Expand Up @@ -145,8 +153,6 @@ http://ott.js.chinamobile.com/PLTV/3/224/3221225591/index.m3u8
http://ott.js.chinamobile.com/PLTV/3/224/3221227393/index.m3u8
#EXTINF:-1 tvg-name="浙江卫视" tvg-logo="http://epg.51zmt.top:8000/tb1/ws/zhejiang.png" group-title="地方电视台" ,浙江卫视HD
http://ott.js.chinamobile.com/PLTV/3/224/3221225544/index.m3u8
#EXTINF:-1 ,CETV-1
http://ott.js.chinamobile.com/PLTV/3/224/3221225622/index.m3u8
#EXTINF:-1 ,凤凰香港
http://ott.js.chinamobile.com/PLTV/3/224/3221226975/index.m3u8
#EXTINF:-1 ,凤凰资讯HD
Expand Down Expand Up @@ -187,10 +193,6 @@ http://dlhls.live.cnlive.com:1935/cdn/izongyi/playlist.m3u8
http://drsh196ivjwe8.cloudfront.net/hls/cnai/03.m3u8
#EXTINF:-1 tvg-name="安徽卫视" tvg-logo="http://epg.51zmt.top:8000/tb1/ws/anhui.png" group-title="地方电视台" ,安徽卫视
http://121.31.30.90:8085/ysten-business/live/anhuistv/1.m3u8
#EXTINF:-1 tvg-name="安徽卫视" tvg-logo="http://epg.51zmt.top:8000/tb1/ws/anhui.png" group-title="地方电视台" ,安徽卫视FHD
http://112.50.243.7/PLTV/88888888/224/3221225945/1.m3u8
#EXTINF:-1 ,CETV-1
http://112.50.243.7/PLTV/88888888/224/3221225869/1.m3u8
#EXTINF:-1 tvg-name="北京卫视" tvg-logo="http://epg.51zmt.top:8000/tb1/ws/beijing.png" group-title="地方电视台" ,北京卫视
http://cctvalih5ca.v.myalicdn.com/wstv/btv1_2/index.m3u8
#EXTINF:-1 tvg-name="安徽卫视" tvg-logo="http://epg.51zmt.top:8000/tb1/ws/anhui.png" group-title="地方电视台" ,BTV文艺
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.iqiyi/addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.iqiyi"
name="爱奇艺视频(IQIYI)"
version="2.4.8"
version="2.4.9"
provider-name="yfang1644">
<requires>
<import addon="script.module.beautifulsoup4" version="4.3.2"/>
Expand Down
207 changes: 65 additions & 142 deletions plugin.video.iqiyi/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
########################################################################

LIST_URL = 'http://list.iqiyi.com'
PCW_API = 'https://pcw-api.iqiyi.com/search/video/videolists?channel_id={}&mode={}&pageNum={}&pageSize=30&without_qipu=1&is_purchase=0'

PCW_API = 'https://pcw-api.iqiyi.com/search/video/videolists?channel_id={}&data_type=1&from=pcw_list&is_album_finished=&is_purchase=&key=&market_release_date_level=&mode={}&pageNum={}&pageSize=30&site=iqiyi&source_type=&three_category_id=&without_qipu=1'

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

__profile__ = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))
__m3u8__ = xbmc.translatePath(os.path.join(__profile__, 'temp.m3u8'))

BANNER_FMT = '[COLOR FFDEB887][%s][/COLOR]'
BANNER_FMT = '[COLOR FFDEB887] (%s) [/COLOR]'
INDENT_FMT0 = '[COLOR red] %s[/COLOR]'
INDENT_FMT1 = '[COLOR green] %s[/COLOR]'
RESOLUTION = {'sd': '标清', 'hd': '高清', 'shd': '超清', 'fhd': '全高清'}
Expand All @@ -40,20 +37,20 @@ def httphead(url):

return url

def previous_page(endpoint, page, total_page, **kwargs):
def previous_page(endpoint, page, total_page, params):
if int(page) > 1:
li = ListItem('上一页 - {0}/{1}'.format(page, str(total_page)))
kwargs['mode'] = endpoint
kwargs['page'] = int(page) - 1
u = sys.argv[0] + '?' + urlencode(kwargs)
params['mode'] = endpoint
params['page'] = int(page) - 1
u = sys.argv[0] + '?' + urlencode(params)
addDirectoryItem(int(sys.argv[1]), u, li, True)

def next_page(endpoint, page, total_page, **kwargs):
def next_page(endpoint, page, total_page, params):
if int(page) < int(total_page):
li = ListItem('下一页 - {0}/{1}'.format(page, str(total_page)))
kwargs['mode'] = endpoint
kwargs['page'] = int(page) + 1
u = sys.argv[0] + '?' + urlencode(kwargs)
params['mode'] = endpoint
params['page'] = int(page) + 1
u = sys.argv[0] + '?' + urlencode(params)
addDirectoryItem(int(sys.argv[1]), u, li, True)

def convertTImer(info):
Expand Down Expand Up @@ -253,7 +250,6 @@ def playfound(params):
url = params['url']
thumbnail = params['thumbnail']
name = params['name']
items = []
if url[0:4] != 'http':
return

Expand All @@ -277,45 +273,6 @@ def playfound(params):
episodelist({'albumId': albumId, 'page':1})


def filter(params):
url = params['url']
html = get_html(url)
tree = BeautifulSoup(html, 'html.parser')
filter = tree.findAll('div', {'class': 'mod_sear_list'})

surl = url.split('/')
lurl = surl[-1].split('-')

dialog = Dialog()

for item in filter[1:]:
title = item.h3.text
si = item.findAll('li')
list = []
for x in si:
if x.get('class') and 'selected' in x.get('class'):
list.append('[COLOR FFF0F000]' + x.text + '[/COLOR]')
else:
list.append(x.text)

sel = dialog.select(title, list)

if sel < 0:
continue

selurl = si[sel].a['href'].split('/')
selurl = selurl[-1].split('-')
if len(selurl) < 10:
continue
for i in xrange(len(selurl)):
if (selurl[i] != '') and (selurl[i] != lurl[i]):
lurl[i] = selurl[i]

surl[-1] = '-'.join(lurl)
url = '/'.join(surl)
videolist({'url': httphead(url)})


###########################################################################
# search in http://so.iqiyi.com/so/q_%s?source=hot
############################################################################
Expand Down Expand Up @@ -387,90 +344,28 @@ def search(params):
endOfDirectory(int(sys.argv[1]))


def videolist(params):
html = get_html(url)
html = re.sub('\t|\r|\n', ' ', html)
soup = BeautifulSoup(html, 'html.parser')

ul = url.split('/')[-1]
page = ul.split('-')[14]
if page == '':
page = '1'


li = ListItem('[第%s页](分类过滤)' % page.encode('utf-8'))
u = sys.argv[0] + '?mode=filter&url=' + url
addDirectoryItem(int(sys.argv[1]), u, li, True)

li = ListItem(BANNER_FMT % '排序方式')
addDirectoryItem(int(sys.argv[1]), sys.argv[0], li, True)

tree = soup.findAll('div', {'class': 'sort-result-l'})
arrange = tree[0].findAll('a')
for sort in arrange:
title = sort.text.strip()
select = sort.get('class', '')
if 'selected' in select:
title = INDENT_FMT1 % title
else:
title = INDENT_FMT0 % title
li = ListItem(title)
u = sys.argv[0] + '?mode=videolist&url=' + httphead(sort['href'])
addDirectoryItem(int(sys.argv[1]), u, li, True)

tree = soup.findAll('div', {'class': 'site-piclist_pic'})
for item in tree:
href = item.a.get('href')
img = item.img.get('src', '')
title = item.a.get('title', '')
try:
info = item.find('span', {'class': 'icon-vInfo'}).text
except:
info = ''
info = convertTImer(info)
try:
vip = item.find('span', {'class': 'icon-vip-zx'}).text
vip = '|[COLOR FF809000]' + vip + '[/COLOR]'
except:
vip = ''
try:
pay = item.find('span', {'class': 'icon-vip-quan'}).text
pay = '|[COLOR FF809000]' + pay + '[/COLOR]'
except:
pay = ''
albumId = item.a.get('data-qidanadd-albumid')
if albumId is None:
albumId = item.a.get('data-qidanadd-tvid', 'X')
extrainfo = vip + pay
if isinstance(info, str):
extrainfo = info + extrainfo
if isinstance(info, str):
infoLabels={'title': title, 'plot': info}
else:
infoLabels={'title': title, 'duration': info}

li = ListItem(title + extrainfo.strip(), thumbnailImage=httphead(img))
li.setInfo(type='Video', infoLabels=infoLabels)
req = {
'mode': 'episodelist',
'albumId': albumId,
'page': 1
}
u = sys.argv[0] + '?' + urlencode(req)
addDirectoryItem(int(sys.argv[1]), u, li, True)
def filter(params):
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)

li = ListItem(INDENT_FMT0 % '分页')
addDirectoryItem(int(sys.argv[1]), sys.argv[0], li, True)
dialog = Dialog()

pages = soup.findAll('div', {'class': 'mod-page'})
pages = pages[0].findAll('a')
for page in pages:
li = ListItem(page.txt)
u = sys.argv[0] + '?mode=videolist&url=' + httphead(page['href'])
addDirectoryItem(int(sys.argv[1]), u, li, True)
f = []
tn = ''
for item in data['data']:
lst = [x['name'] for x in item['child']]
lst.insert(0, '全部')
sel = dialog.select(item['name'], lst)

setContent(int(sys.argv[1]), 'tvshows')
endOfDirectory(int(sys.argv[1]))
if sel > 0:
f += [str(item['child'][sel-1]['id']) + ';must']
tn += '|' + item['child'][sel-1]['name']
params['type'] = ','.join(f)
params['page'] = '1'
params['typename'] = tn.encode('utf-8')
category(params)


orderlist=[{"id":24,"name":"综合排序"},
Expand All @@ -481,7 +376,13 @@ def category(params):
order = params['order']
cid = params['cid']
page = params['page']
items = []
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'])
Expand All @@ -492,24 +393,46 @@ def category(params):
'mode': 'category',
'order': x['id'],
'cid': cid,
'page': page
'page': page,
'type': type,
'typename': typename
}
u = sys.argv[0] + '?' + urlencode(req)
addDirectoryItem(int(sys.argv[1]), u, li, True)

api = PCW_API.format(cid, order, page)
if cid == '16':
api = api.replace('data_type=1', 'data_type=2')
PCW_API = 'https://pcw-api.iqiyi.com/search/video/videolists?'
req = {
'access_play_control_platform': 14,
'channel_id': cid,
'data_type': 2 if cid=='16' else 1,
'from': 'pcw_list',
'is_album_finished': '',
'is_purchase': '',
'key': '',
'market_release_date_level': '',
'mode': order,
'pageNum': page,
'pageSize': 30,
'site': 'iqiyi',
'source_type': '',
'three_category_id': type,
'without_qipu': 1
}

api = PCW_API + urlencode(req)
jdata = loads(get_html(api))
total_page = jdata['data']['pageTotal']

previous_page('category', page, total_page, order=order, cid=cid)
previous_page('category', page, total_page, params=params)
for item in jdata['data']['list']:
albumId = item.get('albumId')
tvId = item.get('tvId')
extra = item.get('videoCount', '')
if extra:
extra = BANNER_FMT % extra
duration = item.get('duration', 0)
duration = convertTImer(duration)
li = ListItem(item['name'], thumbnailImage=item['imageUrl'])
li = ListItem(item['name'] + extra, thumbnailImage=item['imageUrl'])
li.setInfo(type='Video', infoLabels={'title': item['name'],'plot':item.get('description'), 'duration': duration})
if albumId:
req = {
Expand Down Expand Up @@ -538,7 +461,7 @@ def category(params):
u = sys.argv[0] + '?' + urlencode(req)
addDirectoryItem(int(sys.argv[1]), u, li, isFolder)

next_page('category', page, total_page, order=order, cid=cid)
next_page('category', page, total_page, params=params)

setContent(int(sys.argv[1]), 'tvshows')
endOfDirectory(int(sys.argv[1]))
Expand Down Expand Up @@ -583,7 +506,7 @@ def root():
'mode': 'category',
'order': 24,
'cid': channel['cid'],
'page': 1
'page': 1,
}
u = sys.argv[0] + '?' + urlencode(req)
addDirectoryItem(int(sys.argv[1]), u, li, True)
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin.video.mgtv/addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.mgtv"
name="芒果TV"
version="1.1.7"
version="1.1.8"
provider-name="yfang1644">
<requires>
<import addon="script.module.xbmcswift2" version="2.4.0"/>
Expand Down
Loading

0 comments on commit e12aaed

Please sign in to comment.