{"id":18412113,"url":"https://github.com/elliotxx/heatbox","last_synced_at":"2025-04-07T11:31:50.687Z","repository":{"id":86319215,"uuid":"109210612","full_name":"elliotxx/heatbox","owner":"elliotxx","description":"《绝地求生》的直播热度监控（暂停服务）","archived":false,"fork":false,"pushed_at":"2019-11-11T07:56:17.000Z","size":45,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T17:02:40.335Z","etag":null,"topics":["mongodb","pbug","pyecharts","pymongo","python"],"latest_commit_sha":null,"homepage":"http://heatbox.yangyingming.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elliotxx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-02T02:57:38.000Z","updated_at":"2020-01-12T15:47:40.000Z","dependencies_parsed_at":"2023-07-07T06:46:06.715Z","dependency_job_id":null,"html_url":"https://github.com/elliotxx/heatbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotxx%2Fheatbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotxx%2Fheatbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotxx%2Fheatbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotxx%2Fheatbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elliotxx","download_url":"https://codeload.github.com/elliotxx/heatbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247644249,"owners_count":20972250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mongodb","pbug","pyecharts","pymongo","python"],"created_at":"2024-11-06T03:39:51.086Z","updated_at":"2025-04-07T11:31:50.679Z","avatar_url":"https://github.com/elliotxx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## heatbox - 热度走势图\n\n### 演示地址\n[http://heatbox.yangyingming.com](http://heatbox.yangyingming.com)\n\n### 特性\n* 自定义 x 轴刻度个数\n* 自定义 x 轴时间间隔\n* 代理池\n\n### 安装依赖\n* requests\n* pymongo\n* pyecharts\n\n### MongoDB 配置\n1. 开启 MongoDB 权限认证：**在配置文件中加入 auth = true**\n\n2. 创建管理员用户（如果你是第一次使用 MongoDB）  \n```\nuse admin\ndb.createUser({user:\"admin\",pwd:\"admin123\",roles:[\"userAdminAnyDatabase\"]})\n```\n管理员用户用来创建其他数据库和用户\n\n3. 使用管理员账户远程登录\n```\nC:\\Users\\cs\u003emongo [your_ip]:27017\n\u003e use admin\nswitched to db admin\n\u003e db.auth('admin','admin123')\n1\n```\n\n4. 创建 heatbox 数据库，以及操作该数据库的用户\n```\nuse heatbox         // 创建数据库，并作为认证数据库\ndb.createUser({\n    user:'admin',   // 用户名\n    pwd:'admin123', // 用户密码\n    roles:[{role:'readWrite',db:'heatbox'}]     // 为该用户赋予数据库的读写权限\n})\n```\n\n5. 使用该用户远程登录 heatbox 数据库\n```\nC:\\Users\\cs\u003emongo [your_ip]:27017\n\u003e use heatbox\nswitched to db heatbox\n\u003e db.auth('admin','admin123')\n1\n\u003e db.getCollectionNames()\n[ ]\n```\n数据库刚刚创建，所以没有数据\n\n\n### 启动说明\n1. 安装环境：Python 环境和依赖 + MongoDB 配置\n\n2. 配置 common.py 中的数据库信息\n```\n# 数据库配置\nmongo_dbname = 'heatbox'\nmongo_host = 'your_ip'          # mongodb 主机地址\nmongo_port = 27017              # mongodb 主机端口\nmongo_user = 'your_user'        # mongodb 登陆用户\nmongo_pwd  = 'your_password'    # mongodb 用户密码\n```\n\n3. 运行\n    * Windows :  \n    ```\n    python heatbox.py\n    ```  \n    * Linux :  \n    ```\n    sh server.sh start\n    ```\n\n4. 测试\n    * Windows :  \n    在浏览器中打开生成的 render.html \n    * Linux :  \n    运行脚本 start-webserver.sh，然后用本地浏览器访问 http://[your_vps_ip]:8010/render.html\n    * 等待一会即可看到渲染结果\n\n### 注意\n* 脚本功能：\n    * start-webserver.sh：启动临时 http 服务器（linux）\n    * server.sh：启动/停止/重启/查看状态/查看日志 heatbox 服务，用法：  \n    ```\n    Usages: sh server.sh [start|stop|restart|status|log]\n    ```\n\n### 游戏关键字\n* 绝地求生\n* 吃鸡\n\n### 监控指标\n* Bilibili\n\t* 直播间数量\n\t* 直播总时长（从当天程序开始运行时计时，每隔一段时间检测一次）\n\t* 观看直播总人数\n\n### 热度得分计算公式\n```\n直播间数量：live_num\n观看直播总人数：watch_num\n曾出现过的最高直播间总数：top_live_num\t# 这个值一旦出现变化，那么之前计算的所有得分都要重新计算一遍\n曾出现过的最高观看直播人数：top_watch_num\n当天的直播总时长（分钟）：live_time\n\n当天的热度得分：heat_point = float(live_num) / top_live_num * 100 + float(watch_num) / top_watch_num * 100 + float(live_time) / (24*60*60*live_num) * 100\n```\n\n### 关于代理\n* bilibili 只能用 http 协议的代理IP，使用 https 代理会请求失败\n\n### 参考资料\n* python时间处理之datetime  \nhttp://blog.csdn.net/wirelessqa/article/details/7973121\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotxx%2Fheatbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felliotxx%2Fheatbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotxx%2Fheatbox/lists"}