Git Product home page Git Product logo

spider-for-exam-system-of-haust's Introduction

Spider-for-Exam-System-of-HAUST

一款初代题库爬虫

新人第一次开源项目

模块       作用      
fuck_sosw   爬虫主程序
SelectFile   查重模块

一、用法

  1. 先输入考试题库基地址如:http://210.43.5.241/wlkcroot/html5root
  2. 指定程序循环访问地址(刷题多少次),次数越多输出的考题越多
  3. 指定保存文件的文件名(含扩展名)
  4. 完成

注意

postdata = {
'ctl1':'  0 &#160',
'kctl1':'  0 &#160',
'ctl2':'  0 &#160',
'kctl2':'  0 &#160',
'ctl3':'  0 &#160',
'kctl3':'  0 &#160',
'ctl4': '  0 &#160',
'kctl4': '  5 &#160',
'ctl5': '  0 &#160',
'kctl5': '  0 &#160',
'ctl6': '  0 &#160',
'kctl6': '  0 &#160',
'ctl7': '  0 &#160',
'kctl7': '  0 &#160',
'ctl8': '  0 &#160',
'kctl8': '  0 &#160',
'ctl9': '  0 &#160',
'kctl9': '  0 &#160',
'ctl10': '  0 &#160',
'kctl10': '  0 &#160',
'ctl11': '  0 &#160',
'kctl11': '  0 &#160',
'ctl12': '  0 &#160',
'kctl12': '  0 &#160',
'ctl13': '  0 &#160',
'kctl13': '  0 &#160',
'ctl14': '  0 &#160',
'kctl14': '  0 &#160',
'ctl15': '  0 &#160',
'kctl15': '  0 &#160',
'SYSJ': '5',
'zjzc': '11',
'ztl': '5',
'zjzs': '15'
}

此处请求报文为请求指定章节的题目

参数
  • ctl1-ctln(n为有多少章节):选择题请求参数,其中第三列的数字表示该章节抽多少道题,0表示不会抽到该章节的题目。例如:'ctl1':'  7 &#160',表示第一章选择题抽7题。(单次请求选择题的数量不能超过9)
  • kctl1-kctln(n为有多少章节):填空题请求参数,其中第三列的数字表示该章节抽多少道题,0表示不会抽到该章节的题目。例如:'kctl4': '  5 &#160',表示第四章填空题抽5题。(单次请求填空题的数量不能超过5)
  • SYSJ:测试时间,没什么用...固定5就好
  • zjzc:同上,没什么用,固定值
  • ztl:本次刷题的题量,需要与上面指定的刷题数量相同
  • zjzs:该科目的总章节数,根据情况修改  

二、模块解析

1.isLogin(baseurl):

  • 作用:检查用户是否登陆
  • 参数:baseurl题库基地址
  • 返回值:True or False

2.login(secret, account,baseurl):

  • 作用:用户登陆,并设置session
  • 参数:secret密码,account账号,baseurl基地址
  • 返回值:无

3.doTest(filename,baseurl):

  • 作用:请求题库,刷题,并设置试题session
  • 参数:filename要保存的文件名,baseurl基地址
  • 返回值:无

4.getAnswer(filename,baseurl):

  • 作用:根据session请求试题答案
  • 参数:filename要保存的文件名,baseurl基地址
  • 返回值:无

5.parseTest(text,filename):

  • 作用:格式化试题及答案
  • 参数:text未格式化的试题字符串,filename要保存的文件名
  • 返回值:无

6.appendquest(cont,name):

  • 作用:调用SelectFile模块,在已有的试题中搜索当前试题是否存在,若存在则加入试题
  • 参数:cont要搜索的试题内容,name已有试题的文件名
  • 返回值:str返回未重复的试题

三、存在问题

  • 某些情况下出现抓取不到试题选项的问题,初步判断问题在parseTest(text,filename)模块
  • 查重算法效率太低,存在当试题相似度较大时会判定为重复试题的BUG
  • 不能抓取试题中图片,考虑文件输出为word文档

最后欢迎各位大佬帮忙完善程序,多提issue,造福大家~~

spider-for-exam-system-of-haust's People

Contributors

feyily avatar

Watchers

 avatar

Forkers

fenildf

spider-for-exam-system-of-haust's Issues

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.