Giter VIP home page Giter VIP logo

discuzcrawler's Introduction

discuzCrawler

A python crawler of a Discuz forum that famous in China.

Prerequisite

  • python2.7
  • mysql
  • redis

File Structure

file explanation
config.py configuration file (set mysql,redis connection and username / password of this forum etc.)
networkOnly.py do the job that fetch response.content to redis (network part job only).
processRedisPage.py parse the html that cached in redis and save the thread title, post to database respectively.
networkOnly_otherPages.py like the networkOnly.py with the difference that this one crawl from thread page 2 to the last page and networkOnly.py only crawl the first thread page.
refactor.py function library (means refactored from early codes).

Usage

  1. Set the cofinguration in config.py file.
  2. Run files in order networkOnly.py -> processRedisPage.py -> networkOnly_otherPages.py (make sure already created tables in mysql)
CREATE TABLE `TB_Titles` (
  `tid` varchar(50) CHARACTER SET utf8 NOT NULL,
  `title` varchar(500) CHARACTER SET utf8 DEFAULT NULL,
  `board` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `errormsg` varchar(500) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


CREATE TABLE `TB_Posts` (
  `postid` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `tid` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `userId` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `userName` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `postsCount` int(11) DEFAULT NULL,
  `points` int(11) DEFAULT NULL,
  `accountCreatedDate` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `postDateTime` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `floorNum` int(11) DEFAULT NULL,
  `postStatus` varchar(500) CHARACTER SET utf8 DEFAULT NULL,
  `postMessage` varchar(20000) CHARACTER SET utf8 DEFAULT NULL,
  `locked` varchar(500) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

discuzcrawler's People

Contributors

luobin100 avatar

Watchers

James Cloos avatar

Forkers

sealionking

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.