Skip to content

Latest commit

 

History

History
44 lines (38 loc) · 1.99 KB

README-zh.md

File metadata and controls

44 lines (38 loc) · 1.99 KB

LeetCodeCrawler

概述

一个爬取 LeetCodeLeetCode-Cn 网站题目内容以及提交的AC代码的工具,并支持生成相应的 README.md 及 Topics.md 文件,美化你的 LeetCode 仓库的README。

本项目启发自leetcode-spider,其使用 JavaScript 编写,因不再继续维护,且本人暂时对 JavaScript 未过多了解,因此用 Java 重实现了爬取。

使用

对于 LeetCode 网站,下载LeetCodeCrawler.jar到本地 对于 LeetCode-Cn网站,下载Cn-LeetCodeCrawler到本地

建立好如下config.json文件(可直接对 repo 的config.json进行更改),config.json文件需与LeetCodeCrawler.jar放置于同一目录下:

{
    "username": "leetcode@leetcode",
    "password": "leetcode",
    "language": ["cpp", "java"],
    "outputDir": "."
}
  • usernamepassword对应你网站上的账号和密码
  • language对应于你在 LeetCode 刷题使用的编程语言,可多选,选填字段如下(请严格按照如下字段填写):
    • cpp
    • java
    • c
    • csharp
    • javascript
    • python
    • python3
    • ruby
    • swift
    • golang
    • scala
    • kotlin
  • outputDir字段表示你希望存放源码文件的目录,默认为.,即当前目录

运行java -jar LeetCodeCrawler.jarjava -jar Cn-LeetCodeCrawler.jar

效果

具体效果以及爬取的具体数据可参看我的repo:LeetCode, 自己使用的这个工具爬取的 LeetCode 题目和提交的源码。