Code Monkey home page Code Monkey logo

detectorist-scraper's Introduction

vBulletin Detectorist Scraper

This is an example of how to scrape every post of a vBulletin forum (specifically, http://metaldetectingforum.com, but as long as the XPath targets are the same it should work).

Pagination is handled for pages of different threads, and for pages of individual posts.

Post, thread, and username information is collected in items and saved in a MongoDB database via a pipeline.

It should take about 90 hours to scrape the 2.4M posts using AutoThrottle, or less if you're more aggressive (though you might get banned, depending on the forum).

Requires scrapy, pymongo, and a MongoDB server. Python 3 probably not supported; tested on Python 2.7.


TODO:

  • Investigate the handful of ERROR: Spider error processing ... pages

vBulletin Forum Taxonomy

vBulletin forums are arranged like so:

  • Index (aka Board): example.com, example.com/index.php
    • Forum: example.com/forumdisplay.php?f=111
      • Thread: example.com/showthread.php?t=222222
        • Post: most sanely viewed on the thread page...

You can also view posts individually by their post id, eg example.com/showpost.php?p=1000000 -- but the next post id ?p=1000001 might not be from the same thread!

Every post also has a number, which is its order in the thread. This is what I call post_no.


Get a list of forums on the index page with

'.//td[contains(@id,"f")]/div/a'

You could exclude <a>'s with smallfont ancestors b/c they're subforms:

'.//td[contains(@id,"f")]/div/a[not(ancestor::div[@class="smallfont"])]'

But you might as well crawl all the forms from the main page.

Get a list of threads on a forum with

'.//a[contains(@id,"thread_title")]'

(then //text() or /@href + urljoin the results)

detectorist-scraper's People

Contributors

ianlondon avatar

Watchers

James Cloos 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.