@@ -42,12 +42,12 @@ interface APIResponse {
42
42
// Use cheerio to get articles' claps count
43
43
slicedData = await Promise . all (
44
44
apiResponse . data . items
45
- . filter ( ( item ) => item . categories . length !== 0 ) // filter comment
45
+ . filter ( item => item . categories . length !== 0 ) // filter comment
46
46
. slice ( 0 , 3 ) // latest 3 articles
47
- . map ( async ( item ) => {
47
+ . map ( async item => {
48
48
const res = await axios . get ( item . guid ) ;
49
49
const $ = cheerio . load ( res . data ) ;
50
- const text = $ ( 'button' ) . text ( ) ;
50
+ const text = $ ( 'p.bo > button.au.av' ) . first ( ) . text ( ) ;
51
51
let matches = text . match ( CLAPS_COUNT_REGEX ) ;
52
52
return { title : item . title , claps : matches ? matches [ 0 ] : '0' } ;
53
53
} )
@@ -59,12 +59,14 @@ interface APIResponse {
59
59
// Get user's follower count
60
60
const res = await axios . get ( MEDIUM_PROFILE_BASE_URL + MEDIUM_USER_NAME ) ;
61
61
const $ = cheerio . load ( res . data ) ;
62
- const followerCountMatchList = $ ( 'a' ) . text ( ) . match ( FOLLOWERS_COUNT_REGEX ) ;
62
+ const followerCountMatchList = $ ( 'button' )
63
+ . text ( )
64
+ . match ( FOLLOWERS_COUNT_REGEX ) ;
63
65
followerCount = followerCountMatchList
64
66
? followerCountMatchList [ 0 ]
65
67
: '??? Followers' ;
66
68
67
- slicedData . forEach ( ( item ) => {
69
+ slicedData . forEach ( item => {
68
70
let trimTitle ;
69
71
if ( item . title . length > MAX_STR_LENGTH )
70
72
trimTitle = item . title . slice ( 0 , MAX_STR_LENGTH ) + '...' ;
0 commit comments