# -*- coding: utf-8 -*- """ Created on Mon May 26 23:42:03 2014 @author: Vespa """ import os from Feedback import * fb = Feedback() Desktop_Path = '%s/Desktop/'%(os.path.expanduser('~')) list_dirs = os.listdir(Desktop_Path) for line in list_dirs: filepath = os.path.join(Desktop_Path,line) if not os.path.isdir(filepath): if line.endswith('xml'): xmlid = line.split('.')[0] fb.add_item(xmlid+'.xml',subtitle='转化'+xmlid+'.xml',arg=xmlid) print fb
qtype = 2 opt = re.findall(r'w(\d)',query) if opt != []: qweek = int(opt[0]) if not 0 <= qweek <= 6: qweek = None opt = re.findall(r'r',query) if opt != []: qmode = 'r' opt = re.findall(r't',query) if opt != []: qmode = 't' bangumilist = GetGangumi(appkey,btype = qtype,weekday=0,mode = qmode,week = qweek); try: for bgm in bangumilist: fb.add_item(bgm.title,subtitle="【周%s】最后更新时间:%s,现有%s集"%(Getweek(bgm.weekday),bgm.lastupdate_at,bgm.bgmcount),arg=str(bgm.spid)+"---"+str(bgm.season_id)) except SyntaxError as e: if ('EOF', 'EOL' in e.msg): fb.add_item('...') else: fb.add_item('SyntaxError', e.msg) except Exception as e: fb.add_item(e.__class__.__name__,subtitle=e.message) print fb
fb = Feedback() av = '{query}' appkey = "03fc8eb101b091fb" regex = re.compile( 'http:/*[^/]+/video/av(\\d+)(/|/index.html|/index_(\\d+).html)?(\\?|#|$)') regex_match = regex.match(av) if regex_match: aid = regex_match.group(1) pid = regex_match.group(3) or '1' vedio = GetVedioInfo(aid, appkey, AppSecret=None, page=pid) try: if pid == '1': fb.add_item('转化' + vedio.title, subtitle="弹幕cid:%d" % (vedio.cid), arg=str(vedio.cid) + '------' + vedio.title + '------' + pid) else: fb.add_item('转化' + vedio.title, subtitle="弹幕cid:%d (%s P)" % (vedio.cid, pid), arg=str(vedio.cid) + '------' + vedio.title + '------' + pid) if pid == '1': fb.add_item('不转化' + vedio.title, subtitle="弹幕cid:%d" % (vedio.cid), arg='') else: fb.add_item('不转化' + vedio.title, subtitle="弹幕cid:%d (%s P)" % (vedio.cid, pid), arg='')
fb = Feedback() av = "{query}" appkey = "03fc8eb101b091fb" regex = re.compile("http:/*[^/]+/video/av(\\d+)(/|/index.html|/index_(\\d+).html)?(\\?|#|$)") regex_match = regex.match(av) if regex_match: aid = regex_match.group(1) pid = regex_match.group(3) or "1" vedio = GetVedioInfo(aid, appkey, AppSecret=None, page=pid) try: if pid == "1": fb.add_item( "转化" + vedio.title, subtitle="弹幕cid:%d" % (vedio.cid), arg=str(vedio.cid) + "------" + vedio.title + "------" + pid, ) else: fb.add_item( "转化" + vedio.title, subtitle="弹幕cid:%d (%s P)" % (vedio.cid, pid), arg=str(vedio.cid) + "------" + vedio.title + "------" + pid, ) if pid == "1": fb.add_item("不转化" + vedio.title, subtitle="弹幕cid:%d" % (vedio.cid), arg="") else: fb.add_item("不转化" + vedio.title, subtitle="弹幕cid:%d (%s P)" % (vedio.cid, pid), arg="") except SyntaxError as e: if ("EOF", "EOL" in e.msg):
for para in paras: if data != "": data += "&"; data += para + "=" + str(params[para]); if AppSecret == None: return data m = hashlib.md5() m.update((data+AppSecret).encode('utf-8')) return data+'&sign='+m.hexdigest() def ChangeFuck(params): data = ""; paras = params; for para in paras: if data != "": data += "&"; data += para + "=" + str(params[para]); return data fb = Feedback() url = '{query}' # url = 'http://www.bilibili.com/video/av3033822/' av = GetRE(url,r"\d+")[0] video = GetVideoInfo(av,appkey=APPKEY,AppSecret=APPSEC) downloadUrl = GetBilibiliUrl(url) # print video.title # print downloadUrl fb.add_item('获取'+url+'下载地址',subtitle=video.title,arg=downloadUrl) print fb
video.commentNumber = video_idx['review'] video.date = video_idx['pubdate'] video.tag = video_idx['tag'].split(',') videolist.append(video) return videolist query = '{query}' appkey = '70472776da900153' secretkey = 'f7d9146f9363f3407d31098918493336' videoList = biliVideoSearch(appkey, secretkey, query, pagesize=30) fb = Feedback() try: for video in videoList: fb.add_item(video.title, subtitle="%s : http://www.bilibili.com/video/%s(%s)" % (video.typename, video.aid, datetime.datetime.utcfromtimestamp( video.date).strftime(r"%Y/%m/%d")), arg=video.aid) except SyntaxError as e: if ('EOF', 'EOL' in e.msg): fb.add_item('...') else: fb.add_item('SyntaxError', e.msg) except Exception as e: fb.add_item(e.__class__.__name__, subtitle=e.message) print fb
if not 0 <= qweek <= 6: qweek = None opt = re.findall(r'r', query) if opt != []: qmode = 'r' opt = re.findall(r't', query) if opt != []: qmode = 't' bangumilist = GetGangumi(appkey, btype=qtype, weekday=0, mode=qmode, week=qweek) try: for bgm in bangumilist: fb.add_item(bgm.title, subtitle="【周%s】最后更新时间:%s,现有%s集" % (Getweek(bgm.weekday), bgm.lastupdate_at, bgm.bgmcount), arg=str(bgm.spid) + "---" + str(bgm.season_id)) except SyntaxError as e: if ('EOF', 'EOL' in e.msg): fb.add_item('...') else: fb.add_item('SyntaxError', e.msg) except Exception as e: fb.add_item(e.__class__.__name__, subtitle=e.message) print fb
m = hashlib.md5() m.update((data + AppSecret).encode('utf-8')) return data + '&sign=' + m.hexdigest() def ChangeFuck(params): data = "" paras = params for para in paras: if data != "": data += "&" data += para + "=" + str(params[para]) return data fb = Feedback() url = '{query}' # url = 'http://www.bilibili.com/video/av2968792/' av = GetRE(url, r"\d+")[0] video = GetVideoInfo(av, appkey=APPKEY, AppSecret=APPSEC) downloadUrls = GetBilibiliUrl(url) # print video.title # for downloadUrl in downloadUrls: # print downloadUrl for id, downloadUrl in enumerate(downloadUrls): fb.add_item('获取' + url + '下载地址', subtitle="%s(%d P)" % (video.title, id + 1), arg=downloadUrl) print fb
video.description = video_idx['description'] video.arcrank = video_idx['arcrank'] video.cover = video_idx['pic'] video.guankan = video_idx['play'] video.danmu = video_idx['video_review'] video.shoucang = video_idx['favorites'] video.commentNumber = video_idx['review'] video.date = video_idx['pubdate'] video.tag = video_idx['tag'].split(',') videolist.append(video) return videolist query = '{query}' appkey = '70472776da900153' secretkey = 'f7d9146f9363f3407d31098918493336' videoList = biliVideoSearch(appkey,secretkey,query, pagesize = 30) fb = Feedback() try: for video in videoList: fb.add_item(video.title,subtitle="%s : http://www.bilibili.com/video/%s(%s)"%(video.typename,video.aid,datetime.datetime.utcfromtimestamp(video.date).strftime(r"%Y/%m/%d")),arg=video.aid) except SyntaxError as e: if ('EOF', 'EOL' in e.msg): fb.add_item('...') else: fb.add_item('SyntaxError', e.msg) except Exception as e: fb.add_item(e.__class__.__name__,subtitle=e.message) print fb