Skip to content

Commit

Permalink
0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
justinzm committed Feb 20, 2021
1 parent ae1f103 commit 218b4fb
Show file tree
Hide file tree
Showing 6 changed files with 624 additions and 26 deletions.
354 changes: 329 additions & 25 deletions .idea/workspace.xml

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ print(df)
- 微博信息
- 信息数据
- 新闻联播文字稿
- 历史上的今日
- 百度风云榜
- 百度实时热点榜
- 百度今日热点榜
- 百度百科热词榜
- 微博热搜榜
- 微博热搜榜
- 微博新时代榜
- 微信热词榜
- 微信热词榜
- 微信热门榜
- 知乎热搜榜
- 知乎热搜榜
- 知乎热榜
- 豆瓣排行榜
- 豆瓣新片榜
- 豆瓣一周口碑榜
- 生活数据
- 中国油价数据
- 汽柴油历史调价信息
Expand Down
23 changes: 23 additions & 0 deletions gopup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,29 @@
migration_scale_baidu
)

"""
历史上的今日接口
"""
from gopup.event.history_daily import history_daily


"""
榜单接口
"""
from gopup.event.hot_list import (
douban_movie_list,
douban_week_praise_list,
zhihu_hot_search_list,
zhihu_hot_list,
wx_hot_word_list,
wx_hot_list,
weibo_hot_search_list,
weibo_new_era_list,
baidu_hot_list,
baidu_today_hot_list,
baidu_hot_word_list
)


"""
新型冠状病毒接口
Expand Down
31 changes: 31 additions & 0 deletions gopup/event/history_daily.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/2/20 0020
# @Author : justin.郑 [email protected]
# @File : history_daily.py
# @Desc : 历史上的今日

import json
import pandas as pd
import requests


def history_daily():
"""
历史上的今日
Returns
-------
DataFrame
"year,title, type, link, desc""
"""
url = "https://www.bjsoubang.com/api/getHistoryDaily"
r = requests.get(url=url)
res_list = json.loads(r.text)['info']
df = pd.DataFrame(res_list)
df = df.drop(['cover', 'festival', 'recommend', 'pv'], axis=1)
return df


if __name__ == "__main__":
history_daily()

223 changes: 223 additions & 0 deletions gopup/event/hot_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/2/20 0020
# @Author : justin.郑 [email protected]
# @File : hot_list.py
# @Desc : 各类榜单

import json
import pandas as pd
import requests


def douban_movie_list():
"""
豆瓣新片榜
Returns
-------
DataFrame
"titleCn, title,rate, link, img, description, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 16
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def douban_week_praise_list():
"""
豆瓣一周口碑榜
Returns
-------
DataFrame
"title,trend, link, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 19
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
return df


def zhihu_hot_search_list():
"""
知乎热搜榜
Returns
-------
DataFrame
"display_query,query, link, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 10
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def zhihu_hot_list():
"""
知乎热榜
Returns
-------
DataFrame
"title, img,description, link, ranking, hot"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 2
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def wx_hot_word_list():
"""
微信热词榜
Returns
-------
DataFrame
"title, link, hot_rank, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 6
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def wx_hot_list():
"""
微信热门榜
Returns
-------
DataFrame
"title, img,description, link, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 1
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def weibo_hot_search_list():
"""
微博热搜榜
Returns
-------
DataFrame
"title, tag, link, hot, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 4
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def weibo_new_era_list():
"""
微博新时代榜
Returns
-------
DataFrame
"title, link, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 5
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def baidu_hot_list():
"""
百度实时热点榜
Returns
-------
DataFrame
"title, id, status, link_video, link_search, link_news, link_img, hot, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 3
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def baidu_today_hot_list():
"""
百度今日热点榜
Returns
-------
DataFrame
"title, id, status, link_video, link_search, link_news, link_img, hot, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 12
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


def baidu_hot_word_list():
"""
百度百科热词榜
Returns
-------
DataFrame
"title, link, status, description, ranking"
"""
url = "https://www.bjsoubang.com/api/getChannelData"
params = {
"channel_id": 9
}
r = requests.get(url=url, params=params)
res_list = json.loads(r.text)['info']['data']
df = pd.DataFrame(res_list)
df['ranking'] = df.index + 1
return df


if __name__ == "__main__":
weibo_new_era_list()

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

URL = 'https://github.com/justinzm/gopup'
NAME = 'gopup'
VERSION = '0.3.3'
VERSION = '0.3.4'
DESCRIPTION = 'GoPUP database'
if os.path.exists('README.md'):
with open('README.md', encoding='utf-8') as f:
Expand Down

0 comments on commit 218b4fb

Please sign in to comment.