Giter Site home page Giter Site logo

Comments (10)

Ma63d avatar Ma63d commented on August 25, 2024 1

好的,非常感谢你的建议。
第一点,请问一下多个 session 是什么意思? 不好意思,我已经许久没有用 leetcode 了,所以已经有点迷糊了。。
第二点的话是这样的, leetcode 给 cookie 的时长设置得比较短。即使你是不用爬虫,几天不登录你也会发现 leetcode 要你重新登录。这意味着用户会需要隔三差五的自己手动更换 cookie。即使增加了 cookie 选项,可能还不如直接使用用户名密码来的方便。

用密码的方式也就是爬完之后重新点一下登录,因为浏览器可以记住密码,所以这一步也不会很麻烦,用 cookie 的话还要登录后自行取出 cookie 出来写入配置文件,这个步骤其实反而是更加麻烦了一点。

周末会重新优化一下 README.md 文件的内容,比如I've solved xxx/xxx problems (xx problems for a fee).这样的语句可能会使用等 badges 进行替换。
另外,会允许用户自定义 README.md 的模板文件,让用户自定义自己想呈现的内容,使用{total},{hard},{medium},{easy} 等插值形式插入爬虫结果。同时也会增加一些自定义存放目录的配置。

所以如果你还有什么需求,可以尽管跟我沟通。

from leetcode-spider.

csujedihy avatar csujedihy commented on August 25, 2024

from leetcode-spider.

Ma63d avatar Ma63d commented on August 25, 2024

竟然还有 session 这种操作? 我周末研究一下。到时候 cookie 选项的功能也会加上。

from leetcode-spider.

csujedihy avatar csujedihy commented on August 25, 2024

棒极了!

from leetcode-spider.

Ma63d avatar Ma63d commented on August 25, 2024

@csujedihy

第一个是多个session的时候,generateMD.js生成的README.md里面的I've solved xxx/xxx problems (xx problems for a fee).能够把所有session算在一起,其实有个简单办法就是看本目录里面有多少个就说明solved多少个,然后再爬一个总题数。

看本目录里面有多少个就说明solved多少个

本目录是什么意思? 你说的目录是什么目录?

我看了一下,把所有的 session 的 AC 信息统计在一起无法实现,目前具备的信息是:

  • 通过 post session/ 接口能获取到每个 session 的 AC 的总题数
  • 获取到当前 active 的 session 的具体 AC 的题目列表

因此,不能统计出所有 session 总共 AC 了多少题,因为 session 之间 AC 的题目肯定是有重复的,不能简单累加, 而目前不能获取到每个 session AC 的题目列表,无法去除重复。

所以目前能做到的就是获取到所有 session 中的最多的那个 AC 了多少题。然后在 I've solved xxx/xxx problems 里呈现出来。但是这样也有问题,我呈现的信息是我最多的那个 session 的,但是我爬取的东西却不是这个 session 的 solutions。那就会出现,我 README.md 里说我总共 AC 了400题,但是我爬下来存在文件夹里的却只有10几题,因为我这是新开的 session。。。。。。

所以 session 的功能不会去实现。

from leetcode-spider.

csujedihy avatar csujedihy commented on August 25, 2024

我想得也不周到,我的意思是solutions目录下已经爬到多少个题目就表明solved多少个了。其实多个session总共solved多少有办法实现,但是会算上非算法题。就是去个人profile里面爬。也就是这个地址https://leetcode.com/username。

from leetcode-spider.

Ma63d avatar Ma63d commented on August 25, 2024

@csujedihy

但是这样也有问题,我呈现的信息是我最多的那个 session 的,但是我爬取的东西却不是这个 session 的 solutions。那就会出现,我 README.md 里说我总共 AC 了400题,但是我爬下来存在文件夹里的却只有10几题,因为我这是新开的 session。。。。。。

我其实已经说了, 即使能拿到我最多 solved 多少题或者我总共 solved 了多少题也是没用的,因为爬虫只能知道数量,而无法把具体的 solutions 爬取下来,只能爬取当前 active 的那个 session 的 solutions。这会导致刚刚上面那种情况,你自己说你 solved 了400题,但是你这个 github 仓库里明明只有10道题啊,围观你这个 github 仓库的人立马就会蹦出一个想法:“明明只 solved 了10道题,你唬谁呢?”

from leetcode-spider.

csujedihy avatar csujedihy commented on August 25, 2024

确实

from leetcode-spider.

Ma63d avatar Ma63d commented on August 25, 2024

@csujedihy
新版本搞定了,demo 在这里
默认源码文件输出到 solutions 目录了,原先把一堆源码文件摆在当前目录下,使得 github 页面打开之后需要下拉很长才能看到 README.md 的内容。
现在也新增了 一些新功能,README.md 是由一个模板生成的,而用户可以编辑生成的模板,自己定义自己希望输出的 README.md 内容。

你希望的 cookies 功能,我今晚加上。

from leetcode-spider.

csujedihy avatar csujedihy commented on August 25, 2024

大赞!

from leetcode-spider.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.