@@ -5,24 +5,26 @@ const express = defineSource(async () => {
55 const baseURL = "https://www.fastbull.com"
66 const html : any = await myFetch ( `${ baseURL } /cn/express-news` )
77 const $ = cheerio . load ( html )
8- const $main = $ ( ".news-list" )
8+ const $main = $ ( ".content-list. news-list" )
99 const news : NewsItem [ ] = [ ]
1010 $main . each ( ( _ , el ) => {
11- const a = $ ( el ) . find ( ".title_name" )
12- const url = a . attr ( "href" )
11+ const $el = $ ( el )
12+ const a = $el . find ( ".title_name" )
13+ const url = $el . find ( "[data-href]" ) . attr ( "data-href" ) || $el . find ( "[data-id]" ) . attr ( "data-id" )
1314 const titleText = a . text ( )
1415 const title = titleText . match ( / 【 ( .+ ) 】 / ) ?. [ 1 ] ?? titleText
15- const date = $ ( el ) . attr ( "data-date" )
16+ const date = $el . attr ( "data-date" )
1617 if ( url && title && date ) {
18+ const pathname = url . startsWith ( "/" ) ? url : `/cn/fastshort/${ url } `
1719 news . push ( {
18- url : baseURL + url ,
20+ url : baseURL + pathname ,
1921 title : title . length < 4 ? titleText : title ,
2022 id : url ,
2123 pubDate : Number ( date ) ,
2224 } )
2325 }
2426 } )
25- return news
27+ return news . sort ( ( a , b ) => Number ( b . pubDate ) - Number ( a . pubDate ) )
2628} )
2729
2830const news = defineSource ( async ( ) => {
@@ -38,14 +40,14 @@ const news = defineSource(async () => {
3840 const date = a . find ( "[data-date]" ) . attr ( "data-date" )
3941 if ( url && title && date ) {
4042 news . push ( {
41- url : baseURL + url ,
43+ url : url . startsWith ( "http" ) ? url : baseURL + url ,
4244 title,
4345 id : url ,
4446 pubDate : Number ( date ) ,
4547 } )
4648 }
4749 } )
48- return news
50+ return news . sort ( ( a , b ) => Number ( b . pubDate ) - Number ( a . pubDate ) )
4951} )
5052
5153export default defineSource (
0 commit comments