Code Monkey home page Code Monkey logo

onlinejudgecrawlercore's Introduction

OnlineJudge Crawler Core

停止更新, 项目整合到Virtual Judge

Features

  • Random UserAgent Support
  • Simulate Login Support
  • Form Submit Support

Install

  • sudo pip install virtualenvwrapper
  • add the following lines to your ~/.bashrc:
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/local/bin/virtualenvwrapper.sh
fi

Usage

Origin_OJ Init

抓取Origin_OJ现有的所有题目

Command

scrapy crawl `origin_oj`_init

Example:

scrapy crawl poj_init

Problem Crawl

Command

scrapy crawl `origin_oj`_problrm -a problem_id=''
  • argument
    • problem_id

Example:

scrapy crawl poj_problrm -a problem_id='1000'

Script

from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from scrapy.utils.log import configure_logging

setting = get_project_settings()

def problem_crawl(origin_oj, problem_id):
    configure_logging({'LOG_FORMAT': '%(levelname)s: %(message)s'})
    process = CrawlerProcess(settings)
    process.crawl(origin_oj + '_problem', problem_id=problem_id)
    process.start()

Code Submit

提交的代码需要通过 base64 编码

Command

scrapy crawl `origin_oj`_submit -a problem_id='' -a language='' -a source='' -a username='' -a password=''
  • argument
    • problem_id
    • language default: g++
    • source base64 编码
    • username
    • password

各大OJ语言支持

origin_oj language
POJ gcc, g++, java, pascal, c, c++, fortran
HDU_OJ gcc, g++, java, pascal, c, c++, c#
SDUT_OJ gcc, g++, java, pascal, go, lua, dao, perl, ruby, haskell, python2, python3
FZU_OJ gcc, g++, java, pascal, c, c++

Example:

scrapy crawl sdut_submit -a problem_id='1000' -a language='gcc' -a source='I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpCnsKICAgIGludCBhLGI7CiAgICBzY2FuZigiJWQgJWQiLCZhLCAmYik7CiAgICBwcmludGYoIiVkXG4iLGErYik7CiAgICByZXR1cm4gMDsKfQ==' -a username='sdutacm1' -a password='sdutacm'

Script

# ...
def code_submit(origin_oj, problem_id, language, source, username, password):
    configure_logging({'LOG_FORMAT': '%(levelname)s: %(message)s'})
    process = CrawlerProcess(settings)
    process.crawl(origin_oj + '_submit', problem_id=problem_id, language=language, source=source, username=username, password=password)
    process.start()

Account Info

Command

scrapy crawl `origin_oj`_user -a username='' -a password=''
  • argument
    • username
    • password

Example:

scrapy crawl sdut_user -a username='sdutacm1' -a password='sdutacm'

Script

# ...
def account_info(origin_oj, username, password):
    configure_logging({'LOG_FORMAT': '%(levelname)s: %(message)s'})
    process = CrawlerProcess(settings)
    process.crawl(origin_oj + '_user', username=username, password=password)
    process.start()

Account Info Non Password

git checkout account-non-pw

Command

scrapy crawl `origin_oj`_user -a username=''
  • argument
    • username # sdut use argument value is userid

Example:

scrapy crawl sdut_user -a username='15940'
scrapy crawl poj_user -a username='sdutacm1'

Support

onlinejudgecrawlercore's People

Contributors

junnplus avatar

Watchers

 avatar  avatar  avatar

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.