Giter Club home page Giter Club logo

bzpro's Introduction

BZPRO

What's this

BZOJ离线题库

包含了所有题面,以及权限题甚至还包含了爬虫

还有所有的题目图片,以及几乎所有的pdf/rar/doc/txt都包含在内并且转换成了相对连接。(也就是说你能到处复制它而不会出现题目显示不出来的问题)

(为什么说是几乎所有的呢?因为有的pdf是放在https://begin.lydsy.com/JudgeOnline/上的,而我暂时还不知道怎么爬,所以并未爬取。如果有大佬知道欢迎在issue里告诉我这个辣鸡或者直接提交pr也行)

因为RuanXZ大佬把他的爬虫搞丢了所以我就重新写了一个

因为没有CSS/HTML基础所以很垃圾的还请大家见谅。

(而且我真的不会用github)

How to use it

离线题库

下载本仓库后浏览器打开index.html

或者直接通过GitPage访问:https://trinitrotofu.github.io/BZPRO/

爬虫

打开Clawer文件夹。

首先chmod一波:

chmod +x ./Get_Cookies.sh

chmod +x ./Get_Bzoj.sh

chmod +x ./Render.sh

然后获取Cookie:

./Get_Cookies.sh

会要求输入BZOJ账号密码,如果需要爬取权限题的话请输入权限号。

会生成一个cookies.txt,内容就是cookie内容,是有有效期的,有多久我不知道。

接着设置一下爬取的题目范围:

编辑begin.txt,将里面的数字设置为“需要爬取的最小题目编号”,再编辑end.txt,将里面的数字设置为“需要爬取的最大题目编号”,爬虫将会爬取编号在区间[begin, end]内的题目。

然后下载原始题目文件:

./Get_Bzoj.sh

大概等个四十分钟的样子(网速不同可能有所差异)。。。爬虫会把题目下载到www.lydsy.com文件夹内。

最后生成题库首页和题目页面:

./Render.sh

脚本会把原始题目备份到www.lydsy.com_bak文件夹中,然后生成好的BZPRO会放在www.lydsy.com中。

如果爬虫在运行过程中出现问题,请检查:

  • 网络是否通畅
  • Cookie是否获取正确以及是否过期
  • 是否存在有题目未被下载的情况

如果还有问题可以提交issue。

Thx

感谢对此项目提供了很大帮助的大佬:

Xeonacid

(本来在contributor里可以看到这位大佬的,结果因为Remmina不会用Github导致好像。。。覆盖了。。。就。。。没了QwQ)

At Last

至于为什么爬虫要延迟0.3秒再爬下一道题,是因为BZOJ添加了检查机制,访问速度太快会导致被拒绝访问导致很多题目下载不下来。

还有代码很可能有问题,因为作者是个制杖。

Powered by Remmina.

The UI is based on syzoj, using GPL License.

bzpro's People

Contributors

konnyakuxzy avatar remmina avatar trinitrotofu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bzpro's Issues

题目中rar与pdf未爬

为了只爬题面而不爬discuss.php之类的,窝用了个很丑的做法qwq

wget -m -E -k -A=problem.php?id=$pid.tmp,png,jpg,gif,bmp,pdf,rar,css,js --load-cookies= .....

can you add <mata charset="utf-8" /> in <head> for every html file?

QAQ,我在clone了这个离线题库后本机使用firefox打开发现乱码...
本机配置 正常的windows10系统, firefox 61.0.2.

您这里的文件使用了utf-8编码,但是没有在head中使用meta标签指定编码,所以firefox按照系统环境使用了gbk编码造成了乱码问题. 虽然可以通过每次手动调节编码来解决或者通过设置 intl.charset.fallback.utf8_for_file这个选项为true来解决但是都比较麻烦.

请问您能否写个脚本为每个html文件在head标签中加入来显式指定编码呢.

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.