Skip to content

Commit 29e04bd

Browse files
add:增加gitee镜像源
1 parent 874431f commit 29e04bd

File tree

2 files changed

+288
-33
lines changed

2 files changed

+288
-33
lines changed

‎scripts/constants.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
2+
const CRAWL_SITE = "gitee"
3+
14
module.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
};

0 commit comments

Comments
 (0)