Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
github.com/tophubs/TopList
今日热榜是一个获取各大热门网站热门头条的聚合网站,使用Go语言编写,多协程异步快速抓取信息,预览:http://mo.fish
编译
cd {root_path} # 项目根目录
go build -o ./App/GetHot App/GetHot.go
go build -o ./App/Server App/Server.go
创建数据库,如 news
,执行database.sql创建表,更改配置文件Config/mysql.toml
编辑文件 Html/js/blog/globalConfig.js
const ServerIp = 'http://{your_domain}:9090' // 替换成服务器域名
部署定时任务/App/GetHot.go爬虫程序,且以守护进程的方式执行Server.go
crontab -e # 添加一行 0 */1 * * * {root_path}/App/GetHot
nohup {root_path}/App/Server &
测试
http://{yourdomain}:9090/
即可访问今日热榜TopList/
├── App
│ ├── GetHot.go 爬虫程序需要Cron定时任务执行
│ └── Server.go Server程序需要守护进程的方式执行
├── Common
│ ├── Db.go DB组件
│ └── Message.go
├── Config
│ ├── MySql.go mysql配置读取组件
│ └── mysql.toml mysql配置文件需要手动配置
├── Cron
│ ├── GetHot.sh 爬虫Cron程序可以是每小时执行一次
│ └── README.md
├── database.sql 数据库建表文件
├── Html
│ ├── css
│ ├── hot.html 前端热榜展示网页
│ └── js
│
└── README.md
https://www.tophub.fun:8888/GetAllType
{
"Code":0,
"Message":"获取数据成功",
"Data":[
{"id":"1","sort":"63908","title":"知乎"},
{"id":"2","sort":"21912","title":"虎扑"},
{"id":"6","sort":"11707","title":"天涯"},
{"id":"7","sort":"12546","title":"知乎日报"},
]}
https://www.tophub.fun:8888/v2/GetAllInfoGzip?id=59&page=0
{
"Code":0,
"Message":"获取数据成功",
"Data":{
"data":[
{
"id":1327371,
"CreateTime":1579487422,
"commentNum":0,
"approvalNum":0,
"Title":"180W 买了个小破房,月供 7500 多,压力山大",
"hotDesc":"200条评论",
"Url":"https://www.v2ex.com/t/639366#reply200",
"imgUrl":"",
"isRss":"",
"is_agree":0,
"TypeName":"社区"
},
{
"id":1326304,
"CreateTime":1579483806,
"commentNum":0,
"approvalNum":0,
"Title":"口罩(N95) 目前应该买哪个? 有研究过得推荐一下?",
"hotDesc":"106条评论",
"Url":"https://www.v2ex.com/t/639343#reply106",
"imgUrl":"",
"isRss":"",
"is_agree":0,
"TypeName":"社区"
},
],
"page":10
}
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.