Skip to content

Commit

Permalink
Merge pull request taxigps#142 from cameron93lin/plugin.video.dnvodPl…
Browse files Browse the repository at this point in the history
…ayer

Plugin.video.dnvodPlayer update to 1.0.2
  • Loading branch information
taxigps authored Feb 2, 2017
2 parents 39f3412 + 9d32f51 commit 73924e6
Show file tree
Hide file tree
Showing 75 changed files with 69,471 additions and 96 deletions.
163 changes: 84 additions & 79 deletions plugin.video.dnvodPlayer/README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,84 @@
# Introduction 简介

This plugin is for people who want to watch dnvod videos on Kodi(Xbmc). Only work for the area outside Mainland China. Specially for Chinese Language speaking people.

这个插件可以让你在Kodi系统(Xbmc)中观看多瑙影院(dnvod)的电影及电视剧。只能在海外地区访问(多瑙网站被墙)。主要为中文语言使用者服务。

# Version 版本

v1.0.1

# How To Use 如何使用

## Require 要求

XBMC version 16.1 Jarvis or higher

XBMC 版本16.1或以上



16.1版本以上已自带 ~~Xbmc的Requests模块~~


Build in module in version 16.1 ~~Xbmc requests module: https://github.com/beenje/script.module.requests~~





如需中文输入,请看下文 ~~Chinese keyboard模块
Chinese keyboard module: https://github.com/taxigps/xbmc-addons-chinese/tree/master/script.module.keyboard.chinese~~

## Install plugin 安装插件

To install the plugin, you need to download the latest plugin zip file [plugin.video.dnvodPlayer-v1.0.1.zip](https://github.com/cameron93lin/plugin.video.dnvodPlayer/raw/master/plugin.video.dnvodPlayer-v1.0.1.zip). And then:
* Launch XBMC
* Navigate to System | Settings | Add-ons
* Select Install from zip file
* Browse to the directory where the new downloaded zip file is being stored.
* Select OK

For proper Chinese text display on xbmc, do the following steps:
* Launch XBMC
* Navigate to System | Settings | Appearance | skin
* Change skin-font to "Arial based"

安装插件你需要先下载最新的zip文件 [plugin.video.dnvodPlayer-v1.0.1.zip](https://github.com/cameron93lin/plugin.video.dnvodPlayer/raw/master/plugin.video.dnvodPlayer-v1.0.1.zip),然后:
* 打开 Kodi(XBMC)
* 前往系统 → 设置 → 插件
* 选择从 zip 文件安装
* 找到你刚刚下载的zip文件
* 选择 OK

按照以下步骤开启中文显示:
* 打开 Kodi(XBMC)Launch XBMC
* 前往Navigate to System → Settings → Appearance → skin
* 将 skin-font 变为 "Arial based"

按照以下步骤开启中文键盘:
* 打开 Kodi(XBMC)Launch XBMC
* 前往系统 → 设置 → 用户界面 → 界面语言 → 键盘布局
* 添加Chinese BaiduPY即可

# Features 功能

## Search Movies or TV Shows 搜索电影或电视剧

Search what you like in the plugin. Only support regular movie or TV shows as guest entry.

直接在插件内搜索你想看的电影或电视剧。目前仅支持游客通道及部分VIP通道的普通电影或电视剧。不支持午夜版的视频

## VIP HD Video VIP高清视频

Some VIP HD Video can be played by this add on, but not all. If it can not be played, then it means website do not have VIP HD Video in this vedio or the url can not be found. Try the normal one in this case.

部分视频可以直接查看VIP高清视频,如无法播放,则没有VIP高清视频或视频地址解析不成功,请选择普通画质。

# Recommand Repository 推荐的插件库
中文插件库 xbmc-addons-chinese: https://github.com/taxigps/xbmc-addons-chinese
# Introduction 简介

This plugin is for people who want to watch dnvod videos on Kodi(Xbmc). Only work for the area outside Mainland China. Specially for Chinese Language speaking people.

这个插件可以让你在Kodi系统(Xbmc)中观看多瑙影院(dnvod)的电影及电视剧。只能在海外地区访问(多瑙网站被墙)。主要为中文语言使用者服务。

# Version 版本

v1.0.2

# Update 更新

Update search function for the addon. It can sucessful running for the new search page now.
更新了视频搜索的方法,使得插件可以在新的搜索界面中上运行。

# How To Use 如何使用

## Require 要求

XBMC version 16.1 Jarvis or higher

XBMC 版本16.1或以上



16.1版本以上已自带 ~~Xbmc的Requests模块~~


Build in module in version 16.1 ~~Xbmc requests module: https://github.com/beenje/script.module.requests~~





如需中文输入,请看下文 ~~Chinese keyboard模块
Chinese keyboard module: https://github.com/taxigps/xbmc-addons-chinese/tree/master/script.module.keyboard.chinese~~

## Install plugin 安装插件

To install the plugin, you need to download the latest plugin zip file [plugin.video.dnvodPlayer-v1.0.2.zip](https://github.com/cameron93lin/plugin.video.dnvodPlayer/raw/master/plugin.video.dnvodPlayer-v1.0.2.zip). And then:
* Launch XBMC
* Navigate to System | Settings | Add-ons
* Select Install from zip file
* Browse to the directory where the new downloaded zip file is being stored.
* Select OK

For proper Chinese text display on xbmc, do the following steps:
* Launch XBMC
* Navigate to System | Settings | Appearance | skin
* Change skin-font to "Arial based"

安装插件你需要先下载最新的zip文件 [plugin.video.dnvodPlayer-v1.0.2.zip](https://github.com/cameron93lin/plugin.video.dnvodPlayer/raw/master/plugin.video.dnvodPlayer-v1.0.2.zip),然后:
* 打开 Kodi(XBMC)
* 前往系统 → 设置 → 插件
* 选择从 zip 文件安装
* 找到你刚刚下载的zip文件
* 选择 OK

按照以下步骤开启中文显示:
* 打开 Kodi(XBMC)Launch XBMC
* 前往Navigate to System → Settings → Appearance → skin
* 将 skin-font 变为 "Arial based"

按照以下步骤开启中文键盘:
* 打开 Kodi(XBMC)Launch XBMC
* 前往系统 → 设置 → 用户界面 → 界面语言 → 键盘布局
* 添加Chinese BaiduPY即可

# Features 功能

## Search Movies or TV Shows 搜索电影或电视剧

Search what you like in the plugin. Only support regular movie or TV shows as guest entry.

直接在插件内搜索你想看的电影或电视剧。目前仅支持游客通道及部分VIP通道的普通电影或电视剧。不支持午夜版的视频

## VIP HD Video VIP高清视频

Some VIP HD Video can be played by this add on, but not all. If it can not be played, then it means website do not have VIP HD Video in this vedio or the url can not be found. Try the normal one in this case.

部分视频可以直接查看VIP高清视频,如无法播放,则没有VIP高清视频或视频地址解析不成功,请选择普通画质。

# Recommand Repository 推荐的插件库
中文插件库 xbmc-addons-chinese: https://github.com/taxigps/xbmc-addons-chinese
112 changes: 96 additions & 16 deletions plugin.video.dnvodPlayer/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import urllib
import urllib2
import re
import cookielib
import requests
import time
import sys
from xbmc import Keyboard

import js2py
from bs4 import BeautifulSoup
#from js2py import pyjs



Expand Down Expand Up @@ -43,6 +47,18 @@ def getUserAgent():
cookies = getCookies()
user_agent = getUserAgent()

cookie = cookielib.MozillaCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie))
hascookie=False

Searchheaders = {"User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36',
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
#"Content-Length": "36",
"Host": "www.dnvod.eu",
"Referer": "http://www.dnvod.eu/",
"Accept-Encoding": "",
"Accept-Language": "de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4,zh-CN;q=0.2,zh;q=0.2,zh-TW;q=0.2,fr-FR;q=0.2,fr;q=0.2",}

#create user headers
headers = {"User-Agent": user_agent,
Expand Down Expand Up @@ -82,6 +98,7 @@ def getUserAgent():
detailResult=None
playUrl=''


#main menu
def index():
listitem=xbmcgui.ListItem("Search 搜索..")
Expand All @@ -90,18 +107,64 @@ def index():
xbmcplugin.addDirectoryItem(handle,url,listitem,isFolder)
xbmcplugin.endOfDirectory(handle)
xbmcplugin.endOfDirectory(handle)



#Search menu
def Search():
global cookie
global opener
kb = Keyboard('',u'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
kb.doModal()
if not kb.isConfirmed(): return
sstr = kb.getText()
if not sstr: return
inputMovieName=urllib.quote_plus(sstr)
if hascookie==False:
try:
urlSearch = 'http://www.dnvod.eu/Movie/Search.aspx?tags=a'
req = urllib2.Request(urlSearch, headers=Searchheaders)
searchResponse = opener.open(req)
except urllib2.HTTPError as e:
error_message=e.read()
# print error_message
detailReg = r'f\, (.*)={\"(.*)\":(.*)\};'
detailPattern = re.compile(detailReg)
detailResult = detailPattern.findall(error_message)
first=detailResult[0][0]+"={\""+detailResult[0][1]+"\":"+detailResult[0][2]+"};"
varname1=detailResult[0][0]
varname2=detailResult[0][1]
detailReg = r'challenge\-form\'\)\;\s*(.*)a.value = (.*)'
detailPattern = re.compile(detailReg)
detailResult = detailPattern.findall(error_message)
second=detailResult[0][0]+"s = parseInt("+varname1+"."+varname2+", 10) + 12; "
jscode="var s,"+first+second
result=js2py.eval_js(jscode)
soup = BeautifulSoup(error_message,"html.parser")
fparam=soup.find_all('input')[0]['value']
sparam=soup.find_all('input')[1]['value']
searchData= urllib.urlencode({
'jschl_vc': fparam,
'pass': sparam,
'jschl_answer': result
})
searchUrl = 'http://www.dnvod.eu/cdn-cgi/l/chk_jschl?'+'jschl_vc='+str(fparam)+'&pass='+str(sparam)+'&jschl_answer='+str(result)
try:
print searchUrl
headers['Referer']='http://www.dnvod.eu/Movie/Search.aspx?tags=a'
req = urllib2.Request(searchUrl, headers=Searchheaders)
time.sleep(5)
sresult = opener.open(req)
# print sresult.read()
print sresult.info()
except urllib2.HTTPError as e:
print e.code
print e.read()

headers['Referer']='http://www.dnvod.eu/'
urlSearch = 'http://www.dnvod.eu/Movie/Search.aspx?tags='+inputMovieName
searchRequest = urllib2.Request(urlSearch,None,headers)
searchResponse = urllib2.urlopen(searchRequest)
searchRequest = urllib2.Request(urlSearch,None,Searchheaders)
searchResponse = opener.open(searchRequest)
searchdataResponse = searchResponse.read()
searchReg = r'<a href="(.*%3d)">'
searchPattern = re.compile(searchReg)
Expand All @@ -124,7 +187,7 @@ def Search():
fo.close

listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00]('+sstr+') [/COLOR][COLOR FF00FFFF] Total 共计:'+str(len(searchResult))+'[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
url=sys.argv[0]+'?act=Search&name'+inputMovieName
url=sys.argv[0]+'?act=Search'
xbmcplugin.addDirectoryItem(handle, url, listitem, True)
for i in range(len(searchResultName)):
listitem = xbmcgui.ListItem(searchResultName[i])
Expand Down Expand Up @@ -154,19 +217,19 @@ def Detail():
detailRequest = urllib2.Request(searchUrl,None,headers)
detailResponse = urllib2.urlopen(detailRequest)
detaildataResponse = detailResponse.read()
detailReg = r'<div class="bfan-n"><a href="(.*)" target="_blank">.*</a></div>'
detailReg = r'<div class="bfan-n"><a href="(.*)" target="_blank".*>.*</a></div>'
detailPattern = re.compile(detailReg)
detailResult = detailPattern.findall(detaildataResponse)
fo = open(rootDir+"/detailResult.txt", "w")
for node in detailResult:
fo.write(str(node)+'\n')
fo.close

listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Current Select 当前选择: [/COLOR][COLOR FFFFFF00]('+searchResultName[whichResultInt]+') [/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Current Select 当前选择: [/COLOR][COLOR FFFFFF00]('+searchResultName[whichResultInt]+') [/COLOR]')
url=sys.argv[0]+sys.argv[2]
xbmcplugin.addDirectoryItem(handle, url, listitem, True)
listitem = xbmcgui.ListItem('[COLOR FF00FFFF]Total '+str(len(detailResult))+'Episodes, 共计:'+str(len(detailResult))+' 集[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
xbmcplugin.addDirectoryItem(handle, url, listitem, True)
xbmcplugin.addDirectoryItem(handle, url, listitem, False)
listitem = xbmcgui.ListItem('[COLOR FF00FFFF]Total '+str(len(detailResult))+'Episodes, 共计:'+str(len(detailResult))+' 集[/COLOR]')
xbmcplugin.addDirectoryItem(handle, url, listitem, False)
for i in range(len(detailResult)):
listitem = xbmcgui.ListItem('第'+str(i+1)+'集 Episode '+str(i+1))
url=sys.argv[0]+'?act=play&id='+params['id']+'&ep='+str(i+1)
Expand All @@ -176,7 +239,7 @@ def Detail():

#Episode player
def Episode():

print 'Episode'
fo = open(rootDir+"/detailResult.txt", "r+")
detailResult = fo.readlines()
fo.close
Expand All @@ -198,7 +261,7 @@ def Episode():
para2 = result[0]

urlSec = 'http://www.dnvod.eu/Movie/GetResource.ashx?id='+para2+'&type=htm'

regkeyString = r'key:.*\'(.*)\','
patternkeyString = re.compile(regkeyString)
resultkeyString = patternkeyString.findall(data_responseFir)
Expand All @@ -211,27 +274,44 @@ def Episode():
real_url = responseSec.read()
pattern = re.compile(r'(\d||\d\d||\d\d\d||\d\d\d\d||\d\d\d\d\d||\d\d\d\d\d\d||\d\d\d\d\d\d\d||\d\d\d\d\d\d\d\d)\.mp4')
num = re.split(pattern,real_url)
hdurl = num[0]+'hd-'+num[1]+'.mp4'+num[2]

hdurl = num[0]+'hd-'+num[1]+'.mp4'
real_url=num[0]+num[1]+'.mp4'
title=searchResultName[int(params['id'])-1]
epnum=params['ep']
# playlist = xbmc.PlayList(1)
# playlist.clear()
# listitem = xbmcgui.ListItem(u'Play 播放')
# listitem.setInfo(type='video', infoLabels={"Title": title + ' 第' + epnum + '集'})
# playlist.add(real_url, listitem=listitem)
# xbmc.Player().play(playlist)

dialog = xbmcgui.Dialog()
funcs = (
regularplayer,
hdplayer,
)
call = dialog.select('请选择清晰度', ['普通', '高清(不保证可以播放)'])
# print real_url
# print hdurl
call = dialog.select('请选择清晰度', ['普通', '高清(不保证可以播放)'],-1)
# dialog.selectreturns
# 0 -> escape pressed
# 1 -> first item
# 2 -> second item
if call:
if call>-1:
# esc is not pressed
func = funcs[call - 1]
# assign item from funcs to func
return func(real_url,hdurl, title, epnum)
# print 'func start'
return func(real_url,hdurl,title,epnum)
# playlist = xbmc.PlayList(1)
# playlist.clear()
# listitem=xbmcgui.ListItem(u'Play 播放')
# listitem.setInfo(type='video', infoLabels={"Title": title+' 第'+epnum+'集'})
# playlist.add(url, listitem=listitem)
# xbmc.Player().play(url)

def regularplayer(url,hdurl,title,epnum):
print 'Player'
playlist = xbmc.PlayList(1)
playlist.clear()
listitem=xbmcgui.ListItem(u'Play 播放')
Expand Down
3 changes: 2 additions & 1 deletion plugin.video.dnvodPlayer/addon.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.dnvodPlayer"
name="多瑙影院播放器(dnvodPlayer)"
version="1.0.0"
version="1.0.2"
provider-name="Cameron">
<requires>
<import addon="script.module.requests" version="1.1.0"/>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.beautifulsoup4" version="4.3.2"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>video</provides>
Expand Down
Loading

0 comments on commit 73924e6

Please sign in to comment.