Skip to content

基于cookie方法的爬虫,爬取牛客网需要登录访问的试题

License

Notifications You must be signed in to change notification settings

XRLuo/nowcoder-crawler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nowcoder-crawler

0 Intro

基于cookie爬取牛客网需要登录访问的试题

试题链接

1 Goal

想法就是用程序一次将30题全部爬下。随后生成新的试卷再进行爬虫。

2 usage

进入网页可以看到,如果选择《数据结构》的某个知识点组卷,一次最多只能出30题。

Image

用程序一次将30题全部爬下。随后手动生成新的试卷再进行爬虫。

获取试题链接和cookie

  1. 进入试题解析界面,进入第一题,复制链接。
  2. 在Chrome中打开开发者工具,获得与登录相关的cookie。
  3. 将它们放入到下图的变量中

Image

命令行执行

python3 nq-crawler.py 

3 Result

效果

Image

About

基于cookie方法的爬虫,爬取牛客网需要登录访问的试题

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages