File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -120,9 +120,9 @@ class Crawler {
120
120
}
121
121
122
122
async getImage ( body ) {
123
- const regex = / ! \[ [ ^ \] ] * \] \( ( .* ?.p n g | .* ?.j p e g | .* ?.j p g | .* ?.w e b p | .* ?.s v g | .* ?.g i f | .* ?.t i f f ) \s * ( " (?: .* [ ^ " ] ) " ) ? \s * \) | ! \[ [ ^ \] ] * \] \( ( .* ?) \s * ( " (?: .* [ ^ " ] ) " ) ? \s * \) / g;
123
+ const regex = / ! \[ ( [ ^ \] ] * ) \] \( ( .* ?.p n g | .* ?.j p e g | .* ?.j p g | .* ?.w e b p | .* ?.s v g | .* ?.g i f | .* ?.t i f f ) \s * ( " (?: .* [ ^ " ] ) " ) ? \s * \) | ! \[ [ ^ \] ] * \] \( ( .* ?) \s * ( " (?: .* [ ^ " ] ) " ) ? \s * \) / g;
124
124
125
- body = body . replace ( regex , ( _ , url ) => {
125
+ body = body . replace ( regex , ( _ , alt , url ) => {
126
126
if ( ! url ) return ;
127
127
128
128
const filename = url . replace ( / \/ \s * $ / , '' ) . split ( '/' ) . slice ( - 2 ) . join ( '-' ) . trim ( ) ;
@@ -136,7 +136,7 @@ class Crawler {
136
136
. then ( resp => resp . data . pipe ( fs . createWriteStream ( path ) ) )
137
137
. catch ( e => console . error ( `⚠️ 이미지를 다운 받는데 오류가 발생했습니다 / url = ${ url } , e = ${ e } ` ) ) ;
138
138
139
- return `` ;
139
+ return `` ;
140
140
} ) ;
141
141
142
142
return body ;
You can’t perform that action at this time.
0 commit comments