【易语言】随手瞎JB写的一些东西

<center>QQ截图20161203230540.jpg</center>
如图所示,和朋友想做一个BILIBILI-TOOLS,结果哪个魂断前端万年托坑2333我就只好把源码丢出来了。
只有几个小功能,视频下载和首页热门还有直播录制
可以考虑自己加直播间挂机和自动投币等等等等功能,我懒得加了。
因为某些原因视频下载我用的不是官方API,是第三方的,如果要官方API可以考虑去Bilibili Community Programming Union - BCPU查看API
下载地址:BilibiliTools.e
其中去文本中间内容那个模块是我随手自己写的一个取两个字符串中间内容的模块,你们自己随便写个子程序就行了_(:з)∠)_

Tags: 易语言, bilibili

[PY]BiliBili-Live直播间录制工具

详情请到Friends下的rabbit的博客查看解析。
由他的影响我也做了一个QWQ,直接上代码辣

import md5,requests,threading,time
_clock_ = 0
times = 0
def _clock():
    global _clock_
    while 1:
        _clock_ = _clock_ + 1
        time.sleep(1)
        print _clock_
        if(_clock_ == times):
            break
def _txt(start_str, end, html):
    start = html.find(start_str)
    if start >= 0:
        start += len(start_str)
        end = html.find(end, start)
        if end >= 0:
            return html[start:end].strip()
def liveURL(url):
    web = requests.get(url)
    ROOMID = 'cid=' + _txt('var ROOMID =',';',web.content)
    appkey = 'appkey=85eb6835b0a1034e'
    ts = 'ts='+str(time.time())
    players = 'player=1'
    quality = 'quality=0'
    m = md5.new()
    m.update(appkey+'&'+ROOMID+'&'+players+'&'+quality+'&'+ts)
    sign = m.hexdigest()
    web = requests.get('http://live.bilibili.com/api/playurl?'+appkey+'&'+ROOMID+'&'+players+'&'+quality+'&'+ts+'&'+sign)
    live_url = _txt('<url><![CDATA[',']]></url>',web.content)
    print live_url
    downLoad(live_url)
def downLoad(url):
    global _clock_,time
    down = requests.get(url)
    with open('D:\\'+str(time.time())+'.flv','wb') as code:
        for data in down.iter_content(chunk_size=4096):
            code.write(data)
            if _clock_ == time:
                break

if __name__ == '__main__':
    url = raw_input("Please Input Bilibili-Live's url:")
    times = int(raw_input("Please Input luzhishijian(i don't know this word for english.QVQ):"))
    t = threading.Thread(target=_clock())
    liveURL(url)
    t.start()
Tags: python, bilibili