Skip to content

Commit

Permalink
fix for use mgtv and letv's old url
Browse files Browse the repository at this point in the history
Signed-off-by: wwqgtxx <[email protected]>
  • Loading branch information
wwqgtxx committed May 13, 2016
1 parent 1dccd3b commit 68e21b6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion wwqLyParse/parsers/anypageparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def Parse(self,input_text,types=None):
urls.append(url)


if re.search('www.iqiyi.com/a_',url):
if re.search('(www.iqiyi.com/a_)|(www.le.com/comic)',url):
unsure = True

info = {
Expand Down
16 changes: 8 additions & 8 deletions wwqLyParse/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
version = {
'port_version' : "0.5.0",
'type' : 'parse',
'version' : '0.1.8',
'version' : '0.1.9',
'uuid' : '{C35B9DFC-559F-49E2-B80B-79B66EC77471}',
'filter' : [],
'name' : 'WWQ猎影解析插件',
Expand All @@ -38,7 +38,7 @@


parsers = [listparser.ListParser(),indexparser.IndexParser(),mvtvparser.MgTVParser(),lyppvparser.LypPvParser(),yougetparser.YouGetParser(),anypageparser.AnyPageParser()]
urlhandles = [jumpurlhandle.JumpUrlHandle(),postfixurlhandle.PostfixUrlHandle()]
urlhandles = [jumpurlhandle.BaiduLinkUrlHandle(),jumpurlhandle.MgtvUrlHandle(),jumpurlhandle.LetvUrlHandle(),postfixurlhandle.PostfixUrlHandle()]

def urlHandle(input_text):
for urlhandle in urlhandles:
Expand All @@ -65,7 +65,7 @@ def GetVersion():
version['name'] = version['name']+version['version']+"[Include "+yougetparser.YouGetParser().getYouGetVersion()+"&"+lyppvparser.LypPvParser().getLypPvVersion()+"]"
return version

def Parse(input_text,types=None):
def Parse(input_text,types=None,parsers = parsers,urlhandles = urlhandles):
def run(queue,parser,input_text,types):
try:
print(parser)
Expand Down Expand Up @@ -104,7 +104,7 @@ def run(queue,parser,input_text,types):

return results

def ParseURL(input_text,label,min=None,max=None):
def ParseURL(input_text,label,min=None,max=None,parsers = parsers,urlhandles = urlhandles):
def run(queue,parser,input_text,label,min,max):
try:
print(parser)
Expand Down Expand Up @@ -153,7 +153,7 @@ def main():
#debug(Parse('http://www.iqiyi.com/a_19rrhaare5.html'))
#debug(Parse('http://www.iqiyi.com/a_19rrhbhf6d.html#vfrm=2-3-0-1'))
#debug(Parse('http://www.le.com'))
#debug(Parse('http://www.le.com/comic/10010294.html'))
debug(Parse('http://www.letv.com/comic/10010294.html'))
#debug(Parse('http://www.mgtv.com/v/1/1/'))
#debug(Parse('http://tv.le.com/'))
#debug(Parse('http://search.pptv.com/s_video?kw=%E5%B1%B1%E6%B5%B7%E7%BB%8F%E4%B9%8B%E8%B5%A4%E5%BD%B1%E4%BC%A0%E8%AF%B4'))
Expand All @@ -163,7 +163,7 @@ def main():
#debug(Parse('http://v.qq.com/tv/'))
#debug(Parse('http://www.pptv.com/'))
#debug(Parse('http://yyfm.xyz/video/album/1300046802.html'))
debug(Parse('http://list.iqiyi.com/www/2/----------------iqiyi--.html'))
#debug(Parse('http://list.iqiyi.com/www/2/----------------iqiyi--.html'))
#debug(Parse('http://www.iqiyi.com/v_19rrl8pmn8.html#vfrm=2-3-0-1'))
#debug(Parse('http://www.iqiyi.com/v_19rrl8pmn8.html',"formats"))
#debug(ParseURL("http://www.iqiyi.com/v_19rrl8pmn8.html","4_fullhd_全高清_895.21 MB@youget"))
Expand All @@ -172,8 +172,8 @@ def main():
#debug(Parse('http://v.pptv.com/show/NWR29Yzj2hh7ibWE.html?rcc_src=S1'))
#debug(Parse('http://www.bilibili.com/video/av2557971/')) #don't support
#debug(Parse('http://v.baidu.com/link?url=dm_10tBNoD-LLAMb79CB_p0kxozuoJcW0SiN3eycdo6CdO3GZgQm26uOzZh9fqcNSWZmz9aU9YYCCfT0NmZoGfEMoznyHhz3st-QvlOeyArYdIbhzBbdIrmntA4h1HsSampAs4Z3c17r_exztVgUuHZqChPeZZQ4tlmM5&page=tvplaydetail&vfm=bdvtx&frp=v.baidu.com%2Ftv_intro%2F&bl=jp_video',"formats"))
#debug(Parse('http://www.mgtv.com/v/1/291976/c/3137384.html',"formats"))
#debug(ParseURL('http://www.mgtv.com/v/1/291976/c/3137384.html',"1"))
#debug(Parse('http://www.hunantv.com/v/1/291976/c/3137384.html',"formats",parsers = [mvtvparser.MgTVParser()]))
#debug(ParseURL('http://www.mgtv.com/v/1/291976/c/3137384.html',"1",parsers = [mvtvparser.MgTVParser()]))


if __name__ == '__main__':
Expand Down
32 changes: 22 additions & 10 deletions wwqLyParse/urlhandles/jumpurlhandle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,32 @@
import common


class JumpUrlHandle(common.UrlHandle):
class BaiduLinkUrlHandle(common.UrlHandle):

filters = ['^(http|https)://v.baidu.com/link']

def urlHandle(self,url):
if re.match('^(http|https)://v.baidu.com/link',url):
result = self.urlHandle_v_baidu_com_link(url)
print('urlHandle:"'+url+'"-->"'+result+'"')
return result

def urlHandle_v_baidu_com_link(self,input_text):

def urlHandle(self,input_text):
html = PyQuery(common.getUrl(input_text))
a = html.children('a')
a = PyQuery(a)
url = a.attr("href")
print('urlHandle:"'+input_text+'"-->"'+url+'"')
return url

class MgtvUrlHandle(common.UrlHandle):
#http://www.hunantv.com/v/3/45732/f/1872791.html
filters = ['^(http|https)://www.hunantv.com']

def urlHandle(self,input_text):
url = input_text.replace("hunantv.com","mgtv.com")
print('urlHandle:"'+input_text+'"-->"'+url+'"')
return url


class LetvUrlHandle(common.UrlHandle):
#http://www.hunantv.com/v/3/45732/f/1872791.html
filters = ['^(http|https)://www.letv.com']

def urlHandle(self,input_text):
url = input_text.replace("letv.com","le.com")
print('urlHandle:"'+input_text+'"-->"'+url+'"')
return url

0 comments on commit 68e21b6

Please sign in to comment.