Skip to content

add:增加gitee镜像源 #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions scripts/constants.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@

const CRAWL_SITE = "gitee"

module.exports = {

/**
* 爬取的数据源站点 github | gitee
*/

CRAWL_SITE: "github",
CRAWL_SITE,

/**
* 需解析的语言类型
Expand Down Expand Up @@ -35,26 +38,27 @@ module.exports = {
/**
* 获取问题列表地址
*/
PROBLEMS_URL: "https://github.com/azl397985856/leetcode/tree/master/problems",
PROBLEMS_URL: CRAWL_SITE === "gitee" ? "https://gitee.com/golong/leetcode/tree/master/problems" : "https://github.com/azl397985856/leetcode/tree/master/problems",

/**
* 抓取页面问题内容的dom元素选择器
*/
QUESTION_DOM_SELECTOR: ".position-relative.js-navigation-item .js-navigation-open",
QUESTION_DOM_SELECTOR: CRAWL_SITE === "gitee" ? ".tree-item-file-name.tree-list-item a" : ".position-relative.js-navigation-item .js-navigation-open",


/**
* markdwon下载地址
*/
BASE_MARKDWON_DOWNLOAD_URL:
"https://raw.githubusercontent.com/azl397985856/leetcode/master/problems/",
BASE_MARKDWON_DOWNLOAD_URL: CRAWL_SITE === "gitee" ? "https://gitee.com/golong/leetcode/raw/master/problems/" : "https://raw.githubusercontent.com/azl397985856/leetcode/master/problems/",


/**
* 过滤英文文档末尾标识
*/
ENGLISH_MARKDOWN_SIGN: ".en.md",

/**
* 爬虫抓取同一文件时的最大失败次数(多为网络原因导致)
* 爬虫抓取同一文件时的最大失败次数(多为网络原因导致, 切换到gitee源)
*/
MAX_CRAWL_RETRY_NUMBER : 100
};
Loading