File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 7
7
PROBLEMS_URL ,
8
8
QUESTION_DOM_SELECTOR ,
9
9
BASE_MARKDWON_DOWNLOAD_URL ,
10
- ENGLISH_MARKDOWN_SIGN ,
10
+ CRAWL_IGNORE_SUFFIX ,
11
11
} = require ( "./constants" ) ;
12
12
13
13
module . exports = LeetCodeProvider = {
@@ -24,7 +24,7 @@ module.exports = LeetCodeProvider = {
24
24
/**
25
25
* 由于QUESTION_DOM_SELECTOR 所选择的结构包含非问题���签,获取title会是undefined,在此需将其过滤掉
26
26
*/
27
- return titles . filter ( Boolean ) . filter ( ( name ) => ! name . endsWith ( ENGLISH_MARKDOWN_SIGN ) ) ;
27
+ return titles . filter ( Boolean ) . filter ( ( name ) => ! CRAWL_IGNORE_SUFFIX . some ( suffix => name . endsWith ( suffix ) ) ) ;
28
28
} )
29
29
. catch ( ( error ) => {
30
30
Logger . error ( "获取问题列表失败" , error ) ;
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ module.exports = {
55
55
/**
56
56
* 过滤英文文档末尾标识
57
57
*/
58
- ENGLISH_MARKDOWN_SIGN : ".en.md" ,
58
+ CRAWL_IGNORE_SUFFIX : [ ".en.md" , "-en.md" ] ,
59
59
60
60
/**
61
61
* 爬虫抓取同一文件时的最大失败次数(多为网络原因导致, 切换到gitee源)
Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ const {
4
4
SUPPORT_LANGUAGE ,
5
5
DB_JSON_OUTPUT_DIR ,
6
6
RAW_MARKDOWN_OUTPUT_DIR ,
7
- ENGLISH_MARKDOWN_SIGN
7
+ CRAWL_IGNORE_SUFFIX
8
8
} = require ( "./constants" ) ;
9
9
10
10
const genertateLeetcodeToJson = ( ) => {
11
11
console . time ( "genertateLeetcodeToJson" ) ;
12
12
13
13
const rawMarkdowns = Utils . getDirsFileNameSync (
14
14
RAW_MARKDOWN_OUTPUT_DIR
15
- ) . filter ( name => ! name . endsWith ( ENGLISH_MARKDOWN_SIGN ) ) ;
15
+ ) . filter ( name => ! CRAWL_IGNORE_SUFFIX . some ( suffix => name . endsWith ( suffix ) ) ) ;
16
16
17
17
rawMarkdowns . forEach ( filename => {
18
18
let languageResloved = [ ] ;
You can’t perform that action at this time.
0 commit comments