本文整理汇总了Python中moonplayer.get_url函数的典型用法代码示例。如果您正苦于以下问题:Python get_url函数的具体用法?Python get_url怎么用?Python get_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_cb
def parse_cb(page, options):
#page = content.decode('GBK').encode('UTF-8')
page = convert_to_utf8(page)
name_match = name_re.search(page)
if not name_match:
moonplayer.warn('Cannot get video name.')
return
name = name_match.group(1)
if options & moonplayer.OPT_QL_SUPER:
i = 5
elif options & moonplayer.OPT_QL_HIGH:
i = 3
else:
i = 2
vlist = [None] * 6
iid_match = iid_re.search(page)
while iid_match:
(pt, k) = iid_match.group(1, 2)
pt = int(pt)
if pt < 6:
vlist[pt] = k
iid_match = iid_re.search(page, iid_match.end(0))
while i >= 0:
if vlist[i]:
url = 'http://v2.tudou.com/f?id=' + vlist[i]
moonplayer.get_url(url, parse_cb2, (name, options))
return
i -= 1
moonplayer.warn('Fail!')
示例2: load_item_cb
def load_item_cb(page, url):
result = {}
match = name_re.search(page)
if match:
result["name"] = match.group(1)
match = img_re.search(page)
if match:
result["image"] = match.group(1)
match = date_re.search(page)
if match:
result["dates"] = [match.group(1)]
match = alt_re.search(page)
if match:
result["alt_names"] = [match.group(1)]
detail_div = page.split('<div class="detail">', 1)[-1].split("</div>")[0]
match = summ_re.search(detail_div)
if match:
result["summary"] = match.group(1)
else:
match = summ2_re.search(detail_div)
if match:
result["summary"] = match.group(1)
match = rating_re.search(page)
if match:
result["rating"] = float(match.group(1))
result["source"] = list_links(page, "http://v.youku.com/v_show/id_")
new_url = url.replace("/show_page/", "/show_episode/")
moonplayer.get_url(new_url, load_item_cb2, result)
示例3: parse_vurl
def parse_vurl(self, content, options):
# Read urls of all qualities
root = json.loads(content)
vs = root[u'tkl'][0][u'vs']
bids = [None] * 5
for v in vs:
bid = int(v[u'bid']) - 1
if bid < 5:
bids[bid] = ['http://data.video.qiyi.com/videos' + item[u'l'] for item in v[u'fs']]
# Select quality
if options & moonplayer.OPT_QL_SUPER:
q = 3
elif options & moonplayer.OPT_QL_HIGH:
q = 1
else:
q = 0
for i in xrange(q, -1, -1):
if bids[i]:
self.urls = bids[i]
break
if options & moonplayer.OPT_DOWNLOAD and bids[4]:
if moonplayer.question('是否下载1080P版本?'):
self.urls = bids[4]
# Get video's key
first_uid = self.urls[0].split('/')[-1].split('.')[0]
self.suffix = str(self.urls[0].split('.')[-1])
url = 'http://data.video.qiyi.com/' + first_uid + '.ts'
moonplayer.get_url(url, self.parse_key, options)
示例4: parse_cb
def parse_cb(self, page, options):
#page = content.decode('GBK').encode('UTF-8')
page = convert_to_utf8(page)
name_match = name_re.search(page)
if not name_match:
moonplayer.warn('Cannot get video name.')
return
self.name = name_match.group(1)
if options & moonplayer.OPT_QL_SUPER:
i = 5
elif options & moonplayer.OPT_QL_HIGH:
i = 3
else:
i = 2
vlist = [None] * 6
iid_match = iid_re.search(page)
while iid_match:
(pt, k) = iid_match.group(1, 2)
pt = int(pt)
if pt < 6:
if vlist[pt] == None:
vlist[pt] = []
vlist[pt].append(k)
iid_match = iid_re.search(page, iid_match.end(0))
while i >= 0:
if vlist[i]:
self.keys = vlist[i]
self.result = []
url = 'http://v2.tudou.com/f?id=' + self.keys[0]
moonplayer.get_url(url, self.parse_keys, options)
return
i -= 1
moonplayer.warn('Fail!')
示例5: __init__
def __init__(self, wid, aid):
self.wid = wid
self.aid = aid
self.page = 1
self.result = []
url = album_url_fmt % (wid, aid, 1)
moonplayer.get_url(url, self.parse_album_cb, None)
示例6: parse_cb2
def parse_cb2(page, msg):
page = json_pre_process(page)
page = json.loads(page)
data = page[u'data']
#try other quality
try:
if not data:
moonplayer.warn('解析失败!换个清晰度试试?')
return
elif msg[2] & moonplayer.OPT_QL_SUPER and u'superVid' in data:
newvid = str(data[u'superVid'])
elif msg[2] & (moonplayer.OPT_QL_HIGH | moonplayer.OPT_QL_SUPER):
newvid = str(data[u'highVid'])
else:
newvid = str(data[u'norVid'])
if len(newvid) > 0 and newvid != msg[0] and newvid != '0':
msg[0] = newvid
url = 'http://hot.vrs.sohu.com/vrs_flash.action?out=0&g=8&r=1&vid=%s&plid=%s' % (msg[0],msg[1])
moonplayer.get_url(url, parse_cb2, msg)
return
except KeyError:
pass
#parse
vid = msg[0]
su = data[u'su']
ip = page[u'allot']
name = data[u'tvName'].encode('UTF-8')
result = []
i = 0
#make cdnlist
cdnlist = ['http://%s/cdnList?new=%s&vid=%s' % (ip, new, vid) for new in su]
data = {'result': [], 'cdnlist': cdnlist, 'name': name, 'options': msg[2]}
moonplayer.get_url(cdnlist[0], parse_cdnlist, data)
示例7: search
def search(keyword, page):
keyword = keyword.replace(" ", "%20")
url = "http://s.video.qq.com/search?comment=0&plat=2&otype=xml&query=%s&cur=%d&num=20&start=0&end=0" % (
keyword,
page - 1,
)
moonplayer.get_url(url, search_cb, None)
示例8: parse
def parse(url, options):
origin_url = url
url = 'http://www.flvcd.com/parse.php?go=1&kw=' + origin_url
if options & moonplayer.OPT_QL_SUPER:
url += '&format=super'
elif options & moonplayer.OPT_QL_HIGH:
url += '&format=high'
moonplayer.get_url(url, parse_cb, (options, origin_url))
示例9: search
def search(args):
start = (args['page'] - 1) * 20
if 'key' in args:
key = args['key']
url = 'http://api.douban.com/v2/movie/search?q=%s&start=%i&count=20' % (key, start)
else:
tag = args['tag']
url = 'http://api.douban.com/v2/movie/search?tag=%s&start=%i&count=20' % (tag, start)
moonplayer.get_url(url, search_cb, None)
示例10: parse_cb
def parse_cb(page, data):
(options, url) = data
result = parse_flvcd_page(page, None)
if len(result) == 0:
moonplayer.warn("Cannot parse bilibili's video!")
elif options & moonplayer.OPT_DOWNLOAD and len(result) > 2:
moonplayer.download(result, result[0])
else:
moonplayer.get_url(url, parse_danmaku_cb, (options, result))
示例11: parse
def parse(url, options):
if url.startswith('http://www.tudou.com/playlist/id/'): #album
url = 'http://www.tudou.com/plcover/coverPage/getIndexItems.html?page=1&pageSize=512&lid=' + url.split('/')[-2]
moonplayer.get_url(url, parse_album_cb, None)
elif url.startswith('http://www.tudou.com/listplay/') or url.startswith('http://www.tudou.com/programs/view/'): #single video
parser.feed(url, options)
else: #wrong url
moonplayer.warn('Please input a valid tudou url.')
示例12: parse_cb
def parse_cb(page, options):
vid_match = vid_re.search(page)
plid_match = plid_re.search(page)
if vid_match and plid_match:
vid = vid_match.group(1)
plid = plid_match.group(1)
msg = [vid, plid, options]
url = 'http://hot.vrs.sohu.com/vrs_flash.action?out=0&g=8&r=1&vid=%s&plid=%s' % (msg[0], msg[1])
moonplayer.get_url(url, parse_cb2, msg)
else:
moonplayer.warn('Fail')
示例13: parse_album_cb
def parse_album_cb(content, data):
prefix = data[0]
now_page = data[1]
items = data[2]
new_items = list_links(content, 'http://v.youku.com/v_show/id_')
items += new_items
if len(new_items) > 0:
url = prefix + '_ascending_1_mode_pic_page_' + str(now_page+1) + '.html'
moonplayer.get_url(url, parse_album_cb, (prefix, now_page+1, items))
else:
moonplayer.show_album(items)
示例14: parse
def parse(url, options):
if url.startswith('http://www.iqiyi.com/a_'):
moonplayer.get_url(url, parse_a_cb, None)
elif url.startswith('http://www.iqiyi.com/lib/m_'):
moonplayer.get_url(url, parse_tv_cb, None)
elif url.startswith('http://www.iqiyi.com/v_') or \
url.startswith('http://www.iqiyi.com/w_') or \
url.startswith('http://www.iqiyi.com/dianshiju/') or \
url.startswith('http://www.iqiyi.com/dianying/'):
parser.feed(url, options)
else:
moonplayer.warn('Wrong URL!')
示例15: search
def search(args):
if "key" in args:
moonplayer.warn("Not supported.")
return
tag = args["tag"]
country = args["country"]
if tag == "全部":
tag = ""
if country == "全部":
country = ""
url = "http://www.youku.com/v_olist/c_97_g_%s_a_%s_s_1_d_2_pt_1_p_%i.html" % (tag, country, args["page"])
moonplayer.get_url(url, search_cb, None)