File tree 5 files changed +12848
-7055
lines changed
5 files changed +12848
-7055
lines changed Original file line number Diff line number Diff line change
1
+ # This is a basic workflow to help you get started with Actions
2
+
3
+ name : CI
4
+
5
+ # Controls when the action will run. Triggers the workflow on push or pull request
6
+ # events but only for the master branch
7
+ on :
8
+ push :
9
+ branches : [ master ]
10
+ pull_request :
11
+ branches : [ master ]
12
+
13
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
14
+ jobs :
15
+ # This workflow contains a single job called "build"
16
+ lint :
17
+ # The type of runner that the job will run on
18
+ runs-on : ubuntu-latest
19
+
20
+ # Steps represent a sequence of tasks that will be executed as part of the job
21
+ steps :
22
+ - name : Super-Linter
23
+ uses : github/super-linter@v2.0.0
Original file line number Diff line number Diff line change 1
- const request = require ( "request" ) ;
2
1
const Iconv = require ( "iconv-lite" ) ;
3
2
const cheerio = require ( "cheerio" ) ;
4
3
@@ -21,8 +20,10 @@ module.exports = LeetCodeProvider = {
21
20
. load ( sHtml ) ( QUESTION_DOM_SELECTOR )
22
21
. each ( ( idx , ele ) => titles . push ( ele . attribs [ "title" ] ) ) ;
23
22
Logger . success ( "获取问题列表成功" ) ;
24
-
25
- return titles . filter ( ( name ) => ! name . endsWith ( ENGLISH_MARKDOWN_SIGN ) ) ;
23
+ /**
24
+ * 由于QUESTION_DOM_SELECTOR 所选择的结构包含非问题标签,获取title会是undefined,在此需将其过滤掉
25
+ */
26
+ return titles . filter ( Boolean ) . filter ( ( name ) => ! name . endsWith ( ENGLISH_MARKDOWN_SIGN ) ) ;
26
27
} )
27
28
. catch ( ( error ) => {
28
29
Logger . error ( "获取问题列表失败" , error ) ;
@@ -41,3 +42,5 @@ module.exports = LeetCodeProvider = {
41
42
} ) ;
42
43
} ,
43
44
} ;
45
+
46
+ LeetCodeProvider . getProblemsTitle ( )
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ module.exports = {
33
33
/**
34
34
* 抓取页面问题内容的dom元素选择器
35
35
*/
36
- QUESTION_DOM_SELECTOR : ".js-navigation-item .content .js-navigation-open" ,
36
+ QUESTION_DOM_SELECTOR : ".position-relative. js-navigation-item .js-navigation-open" ,
37
37
38
38
/**
39
39
* markdwon下载地址
Original file line number Diff line number Diff line change 4
4
SUPPORT_LANGUAGE ,
5
5
DB_JSON_OUTPUT_DIR ,
6
6
RAW_MARKDOWN_OUTPUT_DIR ,
7
- ENGLISH_MARKDOWN_SIGN ,
8
- } = require ( "./constants" ) ;
7
+ } = require ( './constants' )
8
+
9
+
10
+
9
11
10
12
const genertateLeetcodeToJson = ( ) => {
11
13
console . time ( "genertateLeetcodeToJson" ) ;
@@ -46,8 +48,9 @@ const genertateLeetcodeToJson = () => {
46
48
} ) ;
47
49
} ) ;
48
50
markdown . replace ( Utils . getSatelliteDataReg ( ) . pre , ( noUseMatch , $1 ) => {
51
+
49
52
preKnowledge . push ( {
50
- text : $1 ,
53
+ text : $1 . replace ( '-' , '' ) ,
51
54
link : null ,
52
55
color : "red" ,
53
56
} ) ;
You can’t perform that action at this time.
0 commit comments