File tree Expand file tree Collapse file tree 2 files changed +288
-33
lines changed Expand file tree Collapse file tree 2 files changed +288
-33
lines changed Original file line number Diff line number Diff line change 1+
2+ const CRAWL_SITE = "gitee"
3+
14module . exports = {
25
36 /**
47 * 爬取的数据源站点 github | gitee
58 */
69
7- CRAWL_SITE : "github" ,
10+ CRAWL_SITE ,
811
912 /**
1013 * 需解析的语言类型
@@ -35,26 +38,27 @@ module.exports = {
3538 /**
3639 * 获取问题列表地址
3740 */
38- PROBLEMS_URL : "https://github.com/azl397985856/leetcode/tree/master/problems" ,
41+ PROBLEMS_URL : CRAWL_SITE === "gitee" ? "https://gitee.com/golong/leetcode/tree/master/problems" : "https://github.com/azl397985856/leetcode/tree/master/problems" ,
3942
4043 /**
4144 * 抓取页面问题内容的dom元素选择器
4245 */
43- QUESTION_DOM_SELECTOR : ".position-relative.js-navigation-item .js-navigation-open" ,
46+ QUESTION_DOM_SELECTOR : CRAWL_SITE === "gitee" ? ".tree-item-file-name.tree-list-item a" : ".position-relative.js-navigation-item .js-navigation-open" ,
47+
4448
4549 /**
4650 * markdwon下载地址
4751 */
48- BASE_MARKDWON_DOWNLOAD_URL :
49- "https://raw.githubusercontent.com/azl397985856/leetcode/master/problems/" ,
52+ BASE_MARKDWON_DOWNLOAD_URL : CRAWL_SITE === "gitee" ? "https://gitee.com/golong/leetcode/raw/master/problems/" : "https://raw.githubusercontent.com/azl397985856/leetcode/master/problems/" ,
53+
5054
5155 /**
5256 * 过滤英文文档末尾标识
5357 */
5458 ENGLISH_MARKDOWN_SIGN : ".en.md" ,
5559
5660 /**
57- * 爬虫抓取同一文件时的最大失败次数(多为网络原因导致)
61+ * 爬虫抓取同一文件时的最大失败次数(多为网络原因导致, 切换到gitee源 )
5862 */
5963 MAX_CRAWL_RETRY_NUMBER : 100
6064} ;
You can’t perform that action at this time.
0 commit comments