File tree Expand file tree Collapse file tree 4 files changed +97
-0
lines changed
Expand file tree Collapse file tree 4 files changed +97
-0
lines changed Original file line number Diff line number Diff line change @@ -3168,5 +3168,14 @@ router.get('/ichunqiu', require('./routes/ichunqiu/index'));
31683168
31693169// 冰山博客
31703170router . get ( '/bsblog123' , require ( './routes/bsblog123/index' ) ) ;
3171+ // start
3172+ // 纳威安全导航
3173+ router . get ( '/navisec' , require ( './routes/navisec/index' ) ) ;
3174+
3175+ // 安全师
3176+ router . get ( '/secshi' , require ( './routes/secshi/index' ) ) ;
3177+
3178+ //出海笔记
3179+ router . get ( '/chuhaibiji' , require ( './routes/chuhaibiji/index' ) ) ;
31713180
31723181module . exports = router ;
Original file line number Diff line number Diff line change 1+ const got = require ( '@/utils/got' ) ;
2+ const cheerio = require ( 'cheerio' ) ;
3+
4+ module . exports = async ( ctx ) => {
5+ const baseUrl = 'https://www.chuhaibiji.com/' ;
6+ const response = await got ( {
7+ method : 'get' ,
8+ url : baseUrl ,
9+ } ) ;
10+ const $ = cheerio . load ( response . data ) ; // 使用 cheerio 加载返回的 HTML
11+ const list = $ ( 'ul[class="post-loop post-loop-default tab-wrap clearfix active"] li[class="item"]' ) ;
12+ ctx . state . data = {
13+ title : `出海笔记 ~ 资讯` ,
14+ link : `https://www.secshi.com/` ,
15+ description : '出海笔记 ~ 资讯' ,
16+ item :
17+ list &&
18+ list
19+ . map ( ( index , item ) => {
20+ item = $ ( item ) ;
21+ return {
22+ title : $ ( 'h2 a' , item ) . text ( ) ,
23+ link : $ ( 'h2 a' , item ) . attr ( 'href' ) ,
24+ description : $ ( 'p' , item ) . text ( ) ,
25+ pubDate : new Date ( $ ( 'span[class="item-meta-li date"]' , item ) . text ( ) ) . toUTCString ( ) ,
26+ } ;
27+ } )
28+ . get ( ) ,
29+ } ;
30+ } ;
Original file line number Diff line number Diff line change 1+ const got = require ( '@/utils/got' ) ;
2+ const cheerio = require ( 'cheerio' ) ;
3+
4+ module . exports = async ( ctx ) => {
5+ const baseUrl = 'https://bowen.navisec.it/' ;
6+ const response = await got ( {
7+ method : 'get' ,
8+ url : baseUrl ,
9+ } ) ;
10+ const $ = cheerio . load ( response . data ) ; // 使用 cheerio 加载返回的 HTML
11+ const list = $ ( 'tbody tr' ) ;
12+ ctx . state . data = {
13+ title : `纳威安全导航 ~ 资讯` ,
14+ link : `https://bowen.navisec.it/` ,
15+ description : '纳威安全导航 ~ 资讯' ,
16+ item :
17+ list &&
18+ list
19+ . map ( ( index , item ) => {
20+ item = $ ( item ) ;
21+ return {
22+ title : $ ( 'a' , item ) . text ( ) ,
23+ link : $ ( 'a' , item ) . attr ( 'href' ) ,
24+ pubDate : new Date ( $ ( 'td' , item ) . last ( ) . text ( ) ) . toUTCString ( ) ,
25+ } ;
26+ } )
27+ . get ( ) ,
28+ } ;
29+ } ;
Original file line number Diff line number Diff line change 1+ const got = require ( '@/utils/got' ) ;
2+ const cheerio = require ( 'cheerio' ) ;
3+
4+ module . exports = async ( ctx ) => {
5+ const baseUrl = 'https://www.secshi.com/' ;
6+ const response = await got ( {
7+ method : 'get' ,
8+ url : baseUrl ,
9+ } ) ;
10+ const $ = cheerio . load ( response . data ) ; // 使用 cheerio 加载返回的 HTML
11+ const list = $ ( 'ul[class="b2_gap"] li[class="post-3-li post-list-item"]' ) ;
12+ ctx . state . data = {
13+ title : `安全师 ~ 资讯` ,
14+ link : `https://www.secshi.com/` ,
15+ description : '安全师 ~ 资讯' ,
16+ item :
17+ list &&
18+ list
19+ . map ( ( index , item ) => {
20+ item = $ ( item ) ;
21+ return {
22+ title : $ ( 'h2' , item ) . text ( ) ,
23+ link : $ ( 'h2 a' , item ) . attr ( 'href' ) ,
24+ description : $ ( 'div[class="post-excerpt"]' , item ) . text ( ) ,
25+ } ;
26+ } )
27+ . get ( ) ,
28+ } ;
29+ } ;
You can’t perform that action at this time.
0 commit comments