From c3629590f250945b0b6fdd9321c849a899593010 Mon Sep 17 00:00:00 2001
From: "justin.zm" <3907721@qq.com>
Date: Sat, 15 May 2021 20:46:30 +0800
Subject: [PATCH] 0.3.6
---
.idea/gopup.iml | 2 +-
.idea/misc.xml | 2 +-
.idea/workspace.xml | 511 ++++++++------------------------------------
README.md | 6 +-
gopup/__init__.py | 8 +
gopup/life/game.py | 177 +++++++++++++++
setup.py | 2 +-
7 files changed, 288 insertions(+), 420 deletions(-)
create mode 100644 gopup/life/game.py
diff --git a/.idea/gopup.iml b/.idea/gopup.iml
index ce269e3..f748bb8 100644
--- a/.idea/gopup.iml
+++ b/.idea/gopup.iml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index e8ac057..299aeee 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 98e3895..f2f536d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,9 +2,12 @@
+
+
-
+
+
@@ -32,7 +35,7 @@
-
+
@@ -48,130 +51,13 @@
-
-
- decrypt
- adult
- FeedSearchApi
- _get_js_path
- global_df
- spot_report
- migration_area_baidu
- toutiao_index
- index_toutiao_headers
- marco_cmlrd
- covid_163
- eastmoney.com
- exchange_rate
- 微博
- utils
- weibo_user
- get_weibo_user_info
- migration_scale_baidu
- cctv_news
- 车次
- listTable
- pq
- pyquery
-
-
- D:\pythonFile\gopup\gopup
- D:\pythonFile\gopup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -200,7 +86,7 @@
-
+
@@ -244,7 +130,7 @@
-
+
@@ -252,11 +138,11 @@
-
+
-
+
@@ -265,7 +151,7 @@
-
+
@@ -273,12 +159,11 @@
-
+
-
-
+
@@ -311,11 +196,11 @@
+
-
@@ -404,36 +289,55 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -454,12 +358,12 @@
file://$PROJECT_DIR$/gopup/stock/classifying.py
- 48
+ 53
file://$PROJECT_DIR$/gopup/stock/classifying.py
- 32
+ 35
@@ -564,17 +468,17 @@
file://$PROJECT_DIR$/gopup/index/index_toutiao.py
- 62
+ 67
file://$PROJECT_DIR$/gopup/index/index_toutiao.py
- 114
+ 121
file://$PROJECT_DIR$/gopup/index/index_google.py
- 56
+ 59
@@ -589,7 +493,7 @@
file://$PROJECT_DIR$/gopup/index/index_baidu.py
- 345
+ 355
@@ -659,7 +563,7 @@
file://$PROJECT_DIR$/gopup/index/index_toutiao.py
- 63
+ 68
@@ -684,32 +588,32 @@
file://$PROJECT_DIR$/gopup/index/index_baidu.py
- 261
+ 262
file://$PROJECT_DIR$/gopup/index/index_baidu.py
- 263
+ 264
file://$PROJECT_DIR$/gopup/index/index_baidu.py
- 264
+ 265
file://$PROJECT_DIR$/gopup/index/index_baidu.py
- 265
+ 266
file://$PROJECT_DIR$/gopup/index/index_baidu.py
- 266
+ 267
file://$PROJECT_DIR$/gopup/index/index_baidu.py
- 267
+ 268
@@ -744,32 +648,32 @@
file://$PROJECT_DIR$/gopup/event/area_baidu.py
- 102
+ 91
file://$PROJECT_DIR$/gopup/event/area_baidu.py
- 105
+ 111
file://$PROJECT_DIR$/gopup/event/area_baidu.py
- 104
+ 110
file://$PROJECT_DIR$/gopup/event/area_baidu.py
- 103
+ 109
file://$PROJECT_DIR$/gopup/event/area_baidu.py
- 101
+ 90
file://$PROJECT_DIR$/gopup/life/train.py
- 50
+ 75
@@ -802,16 +706,6 @@
43
-
- file://$PROJECT_DIR$/gopup/life/train.py
- 85
-
-
-
- file://$PROJECT_DIR$/gopup/life/train.py
- 84
-
-
file://$PROJECT_DIR$/gopup/movie/movie.py
38
@@ -819,12 +713,12 @@
file://$PROJECT_DIR$/gopup/movie/movie.py
- 310
+ 301
file://$PROJECT_DIR$/gopup/movie/movie.py
- 316
+ 307
@@ -867,6 +761,21 @@
51
+
+ file://$PROJECT_DIR$/gopup/life/game.py
+ 80
+
+
+
+ file://$PROJECT_DIR$/gopup/life/game.py
+ 47
+
+
+
+ file://$PROJECT_DIR$/gopup/life/game.py
+ 78
+
+
@@ -877,234 +786,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index aea821a..9da604b 100644
--- a/README.md
+++ b/README.md
@@ -96,6 +96,9 @@ print(df)
- 豆瓣排行榜
- 豆瓣新片榜
- 豆瓣一周口碑榜
+ - 中国电竞价值排行榜
+ - 俱乐部排行榜
+ - 选手排行榜
- 生活数据
- 老黄历
- 中国油价数据
@@ -131,8 +134,9 @@ print(df)
#### 版本更新
- 0.3.5
+ 0.3.6
生活数据: 老黄历
+ 信息数据: 中国电竞价值排行榜
0.3.5
生活数据: 车站信息、车次时刻表
diff --git a/gopup/__init__.py b/gopup/__init__.py
index 56b672e..b119c94 100644
--- a/gopup/__init__.py
+++ b/gopup/__init__.py
@@ -184,6 +184,14 @@
weibo_list
)
+"""
+中国电竞价值排行榜
+"""
+from gopup.life.game import (
+ player_rank,
+ club_rank
+)
+
"""
专业版接口
diff --git a/gopup/life/game.py b/gopup/life/game.py
new file mode 100644
index 0000000..9c85d13
--- /dev/null
+++ b/gopup/life/game.py
@@ -0,0 +1,177 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# @Time : 2021/5/15 17:26
+# @Author : justin.郑 3907721@qq.com
+# @File : game.py
+# @Desc : 游戏排行榜
+
+import requests
+import time
+import pandas as pd
+from pyquery import PyQuery as pq
+
+
+def club_rank(type):
+ """
+ 中国电竞价值排行榜 俱乐部排行榜
+ Parameters
+ ------
+ type: 类型 gameid
+ 英雄联盟 2
+ 绝地求生 3
+ 王者荣耀 4
+ DOTA2 1
+ 穿越火线 5
+ 和平精英 6
+ Return
+ ------
+ 日期、类型、排名、俱乐部logo、俱乐部名称、人气指数、舆论指数、综合指数、排名变动
+
+ http://rank.uuu9.com/club/ranking?gameId=6&type=0
+ """
+ if type == "DOTA2":
+ gameid = 1
+ elif type == "英雄联盟":
+ gameid = 2
+ elif type == "绝地求生":
+ gameid = 3
+ elif type == "王者荣耀":
+ gameid = 4
+ elif type == "穿越火线":
+ gameid = 5
+ elif type == "和平精英":
+ gameid = 6
+ else:
+ return "游戏名称输入错误"
+ try:
+ url = "http://rank.uuu9.com/club/ranking?gameId=%s&type=0" % gameid
+ herder = {
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
+ "Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive"
+ }
+ r = requests.get(url=url, headers=herder)
+ doc = pq(r.text)
+ trs = doc(".ec_table table tbody tr")
+ res_list= []
+ for tr in trs.items():
+ bd_res = tr(".ec_change i").attr("class")
+ bd_val = tr(".ec_change").text()
+ if bd_res == "rise":
+ bd = "上升 %s位" % bd_val
+ elif bd_res == "decline":
+ bd = "下降 %s位" % bd_val
+ else:
+ bd = "-"
+ res_dict = {
+ "日期": time.strftime("%Y-%m-%d"),
+ "类型": type,
+ "排名": tr.find(".ec_num").text(),
+ "俱乐部logo": "http://rank.uuu9.com/%s" % tr("img").attr("src"),
+ "俱乐部名称": tr("dd").text(),
+ "人气指数": tr("td:nth-child(3)").text(),
+ "舆论指数": tr("td:nth-child(4)").text(),
+ "综合指数": tr("td:nth-child(5)").text(),
+ "排名变动": bd
+ }
+ res_list.append(res_dict)
+ res_pd = pd.DataFrame(res_list)
+ return res_pd
+ except:
+ return None
+
+
+def player_rank(type):
+ """
+ 中国电竞价值排行榜 选手排行榜
+ Parameters
+ ------
+ type: 类型 gameid
+ 英雄联盟 2
+ 绝地求生 3
+ 王者荣耀 4
+ DOTA2 1
+ 穿越火线 5
+ 和平精英 6
+ Return
+ ------
+ 日期、类型、排名、选手头像、选手名、所属战队、人气指数、舆论指数、战绩指数、综合指数、身价、排名变动
+
+ http://rank.uuu9.com/player/ranking?gameId=6&type=0
+ """
+ if type == "DOTA2":
+ gameid = 1
+ elif type == "英雄联盟":
+ gameid = 2
+ elif type == "绝地求生":
+ gameid = 3
+ elif type == "王者荣耀":
+ gameid = 4
+ elif type == "穿越火线":
+ gameid = 5
+ elif type == "和平精英":
+ gameid = 6
+ else:
+ return "游戏名称输入错误"
+ try:
+ url = "http://rank.uuu9.com/player/ranking?gameId=%s&type=0" % gameid
+ herder = {
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
+ "Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
+ "Accept-Encoding": "gzip, deflate",
+ "Connection": "keep-alive"
+ }
+ r = requests.get(url=url, headers=herder)
+ doc = pq(r.text)
+ trs = doc(".ec_table table tbody tr")
+ res_list= []
+ for tr in trs.items():
+ bd_res = tr(".ec_change i").attr("class")
+ bd_val = tr(".ec_change").text()
+ if bd_res == "rise":
+ bd = "上升 %s位" % bd_val
+ elif bd_res == "decline":
+ bd = "下降 %s位" % bd_val
+ else:
+ bd = "-"
+ if type == "英雄联盟":
+ res_dict = {
+ "日期": time.strftime("%Y-%m-%d"),
+ "类型": type,
+ "排名": tr.find(".ec_num").text(),
+ "选手头像": "http://rank.uuu9.com/%s" % tr("img").attr("src"),
+ "选手名": tr("dd").text(),
+ "所属战队": tr("td:nth-child(3)").text(),
+ "人气指数": tr("td:nth-child(4)").text(),
+ "舆论指数": tr("td:nth-child(5)").text(),
+ "战绩指数": tr("td:nth-child(6)").text(),
+ "综合指数": tr("td:nth-child(7)").text(),
+ "身价": tr("td:nth-child(8)").text(),
+ "排名变动": bd
+ }
+ else:
+ res_dict = {
+ "日期": time.strftime("%Y-%m-%d"),
+ "类型": type,
+ "排名": tr.find(".ec_num").text(),
+ "选手头像": "http://rank.uuu9.com/%s" % tr("img").attr("src"),
+ "选手名": tr("dd").text(),
+ "所属战队": tr("td:nth-child(3)").text(),
+ "人气指数": tr("td:nth-child(4)").text(),
+ "舆论指数": tr("td:nth-child(5)").text(),
+ "综合指数": tr("td:nth-child(6)").text(),
+ "身价": tr("td:nth-child(7)").text(),
+ "排名变动": bd
+ }
+
+ res_list.append(res_dict)
+ res_pd = pd.DataFrame(res_list)
+ return res_pd
+ except:
+ return None
+
+
+if __name__ == "__main__":
+ tmp = player_rank(type="英雄联盟")
+ print(tmp)
diff --git a/setup.py b/setup.py
index 94137fb..ba61eba 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@
URL = 'https://github.com/justinzm/gopup'
NAME = 'gopup'
-VERSION = '0.3.5'
+VERSION = '0.3.6'
DESCRIPTION = 'GoPUP database'
if os.path.exists('README.md'):
with open('README.md', encoding='utf-8') as f: