Skip to main content
# What is this?

A streaming async API to 4chan boards. You create a handler class, implement some callbacks and get informed when new
posts and images arrive in threads. There's a bundled `FileHandler` that saves content to the file system and a
`SQLiteHandler` that saves posts in per-date SQLite DBs.

**NOTE**: the `FileHandler` will eat up your `inode`s, a default Debian install scraping */b/* got exhausted in ~ 6
months. Use the `SQLiteHandler` unless you plan to clean the file root regularly.

# How?

The bundled executable called `hurr-durr` is a scraper. You use it as

hurr-durr --directory /tmp/4chan/sqlite-files --board b

There's an optional `-i` flag to also download the images and a `-v` flag to see logging information.

Storage defaults to SQLite DB per day, unless overridden via `-f file`, which produces 1 JSON file per thread in a
structure of `data_dir/YYYYmmdd/threadID/threadID.json`.

All this info is also available via the `-h` flag.

As for the API part, the main entry point is `hurr_durr.ChanWatcher`. You have to implement a handler class and then
do something along the lines of

```python
from hurr_durr import FileHandler, ChanWatcher

watcher = ChanWatcher(FileHandler('/tmp/4chan/b'), 'b', images=True)
watcher.start()
```

or

```python
from hurr_durr import SQLiteHandler, ChanWatcher

watcher = ChanWatcher(SQLiteHandler('/tmp/4chan/b'), 'b')
watcher.start()
```

The handlers currently bundled are `FileHandler` which saves content to disk in files and `SQLiteHandler`, which saves
posts in SQLite DBs. To implement your own handler, you need to create a class inheriting from `Handler`,
containing 4 methods:

* `post(thread_id, new_post)` -- gets called when a new post is made in a thread
* `pruned(thread_id)` -- gets called when a thread is pruned from 4chan
* `img(thread_id, filename, data)` -- gets called with downloaded image data, only relevant if images are downloaded
* `download_img(thread_id, filename)` -- gets called to check if a particular image should be downloaded, only relevant
if images are downloaded

# Installing

It's in PyPI, just use pip

pip install hurr-durr

# Why?

Because I needed a 4chan scraper, everything else sucked, and I wanted to give Tornado a ride around the block.

# License

Copyright 2014 Emils Solmanis

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Metadata

Release files for hurr-durr 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hurr-durr 0.2.2
File Size Uploaded
hurr-durr-0.2.2.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hurr-durr 0.2.2
File Interpreter ABI Platform
hurr_durr-0.2.2-py2.7.egg Legacy Egg format - - Details

Total release size: 26.9 kB

Release files / hurr-durr-0.2.2.tar.gz

Download URL hurr-durr-0.2.2.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
008f1d1dd49d183cd915ee75d12cee28df1f112f96ae365f9c945f53b991d75b
BLAKE2b-256 checksum
How to use checksums
11842450b496530dcd89e6f9446462517af3c5908f678e56a4ca48666ddcac61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / hurr_durr-0.2.2-py2.7.egg

Download URL hurr_durr-0.2.2-py2.7.egg
Size 17.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
ef2c3d9d6073369c8f1f3a2153ebe480a610b57888de8de0309d99c125aa844f
BLAKE2b-256 checksum
How to use checksums
1088db37eb11a6a53f33ff210ebfcbc22dd1a96187d873dbde49dc6836af09a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page