danmu

每个大主播都是满屏弹幕,怎么做到的?Python实战无限刷弹幕!

匿名 (未验证) 提交于 2019-12-02 22:54:36
danmu 是一个开源的直播平台弹幕接口,使用他没什么基础的你也可以轻松的操作各平台弹幕。使用不到三十行代码,你就可以使用Python基于弹幕进一步开发。支持斗鱼、熊猫、战旗、全民、Bilibili多平台弹幕。支持各版本Python,无平台依赖,方便各类开发者、爱好者使用。一次开启,主播上线自动连接,下线后上线自动重连。 给喜欢的主播来个爱的轰炸。 经过深度优化,几乎不漏过任何一条弹幕;使用抽象构架,方便修改与开发。 Documents 你可以在官网获取使用帮助。 Installation 可以通过本命令安装 danmu: pip install danmu Simple uses 通过如下代码,可以初步通过Python对弹幕进行处理。 import time, sysfrom danmu import DanMuClientdef pp(msg): print(msg.encode(sys.stdin.encoding, 'ignore'). decode(sys.stdin.encoding))dmc = DanMuClient('http://www.douyu.com/lslalala')if not dmc.isValid(): print('Url not valid')@dmc.danmudef danmu_fn(msg): pp('[%s] %s' % (msg[

CSIC_716_20191028

丶灬走出姿态 提交于 2019-12-02 16:40:07
1、爬取小破站的弹幕 2、展示爬取内容 打开网页,用教的方法找到cid 和header import requests from bs4 import BeautufulSoup import pandas as pd import re header={ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36' }#小破站的header可以通过谷歌浏览器的network中的request header获取 url=' http://comment.破站.com/125507930.xml' #以爬取小破站cid=125507930为例 response=request.get(headers=header,url=url) #获取响应 response.encoding=response.apparent_encoding data=response

爬取哔哩哔哩网站弹幕

こ雲淡風輕ζ 提交于 2019-12-02 16:34:55
爬取哔哩哔哩网站弹幕 打开哔哩哔哩官网 https://www.bilibili.com/ 首先获取它的cid 打开想爬取弹幕视频,然后查看源代码 然后获取用户代理信息 然后去爬取 """ pip install pandas pip install bs4 pip install requests pip install lxml """ import requests from bs4 import BeautifulSoup import pandas as pd import datetime import re header = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36' } url = ' http://comment.bilibili.com/106015992.xml ' response = requests.get(url=url, headers=header) # 向对方服务器发送请求 response.encoding = response.apparent_encoding # 设置字符编码 data = response.text # 获取文本

‘大案牍术’告诉你为什么《长安十二时辰》这么火!

岁酱吖の 提交于 2019-11-30 12:36:58
注:本人参考猪哥公众号“裸睡的猪”公众号爬虫文章。 一、功能描述 想用我们现代的 大案牍术 来分析一下《长安十二时称》这部电视剧到底为什么会火,大家都对这部电视剧的评价是什么样的?(所有弹幕最高频的900个词) 二、技术方案 1、分析优酷弹幕的加载方式然后使用requests库爬取 2、抓取整部剧所有集的所有弹幕 3、重点做数据清洗,比如:剧情、人名、高能君弹幕等等 4、将弹幕做成词云 三、技术实现 1、分析并获取弹幕接口的url ①打开优酷网站,点击电视剧播放,在页面鼠标右键选择检查(或F12),调出浏览器的调试窗口。 ②复制任意一条弹幕,然后点击调试窗口按Control+F进行搜索! ③点击该请求的 Headers 按钮,查看请求url,并且注意请求头中的 Referer 和 User-Agent 参数。 通过上面的步骤,我们就可以轻松加愉快的获取到弹幕加载的url https://service.danmu.youku.com/list?jsoncallback=jQuery111208275429479734884_1569416025133&mat=0&mcount=1&ct=1001&iid=1061156738&aid=322943&cid=97&lid=0&ouid=0&_=1569416025149 2、爬取弹幕数据 URL找到之后我们便可以开始coding了

使用swoole和websocket结合来制造弹幕

主宰稳场 提交于 2019-11-29 16:09:40
在知乎上无意中看到了一篇有关这个的话题 https://zhuanlan.zhihu.com/p/23992890 ,刚好没事也好久没弄swoole了就自己按照知乎上的那篇文站实操了一下 那个试验中有几个点需要注意一下: 1.首先得安装php的swoole扩展 pecl install swoole 用php -m检查扩展是否安好 2.jquery包和弹幕所需要的包最好用他那个dist中的文件,不然的话有可能页面js会报错 3. liunx发行版安装php5.3+并且编译swoole扩展,在php.ini中加入extension=swoole.so之后打开命令行,cd到server.php所在目录,修改文件中的监听IP和端口,使用php server.php即开启服务端。 然后客户端html中修改websocket连接的服务端IP和端口,打开页面即可开始体验该实时弹幕系统。 4.index.html中的代码如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="jquery.min.js"></script> <script src="jquery.danmu.min.js"></script> <style type="text/css

js实现弹幕效果

。_饼干妹妹 提交于 2019-11-29 16:06:16
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <title>js实现弹幕效果</title> <style> #play { width: 600px; height: 500px; background-color: #000; } /*方便js获取高度*/ #danmu{ width:600px; height:500px; background-color:#fff; z-index:9999; background-color: rgba(0, 1, 0, 0.1); } #textStyle { position: absolute; font-size: 24px; color: #ffffff; } </style> </head> <body> <div id="play"> <div id="danmu"></div> </div> <input type="text" id="text" value="这是弹幕..."/> <input type="button" value="发送" onclick="danmu()"/> <script src="jquery-3.1.0.min.js"></script> <script> var si; // 初始化定义定时器变量

CSIC_716_20191028【爬小破站】

泄露秘密 提交于 2019-11-26 20:31:07
1、爬取小破站的弹幕 2、展示爬取内容 打开网页,用教的方法找到cid 和header import requests from bs4 import BeautufulSoup import pandas as pd import re header={ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36' }#小破站的header可以通过谷歌浏览器的network中的request header获取 url=' http://comment.破站.com/125507930.xml' #以爬取小破站cid=125507930为例 response=request.get(headers=header,url=url) #获取响应 response.encoding=response.apparent_encoding data=response

弹幕效果

假如想象 提交于 2019-11-26 18:10:28
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>仿弹幕效果</title> <style> *{margin: 0;padding: 0;list-style: none;} html,body{width: 100%;height: 100%;} body{background-color: #000;font-family: '微软雅黑';} #danmu{position: relative;height: 100%;width: 100%;overflow: hidden;font-size: 50px;} #danmu .newli{background-color: #fff;height: 50px;line-height: 50px;position: absolute;overflow: hidden;} </style> </head> <body> <div id="danmu"></div> <script> var danmu=document.getElementById('danmu'); var winH=danmu.clientHeight; var speak=['哇塞好牛逼啊','好帅啊','前方高能','hahahahaha','哈哈哈哈','风流倜傥