Skip to main content

API wrapper for 4chan.

Project description


  • 4chan API reader.


python3 -m pip install aio4chan


import asyncio
import aiohttp
import aio4chan

loop = asyncio.get_event_loop()

session = aiohttp.ClientSession(loop = loop)

client = aio4chan.Client(session = session, loop = loop)

async def execute():

    Traverse 4chan.

    boards = await client.get_boards()

    # short names
    board_ids = (board.board for board in boards)

    for board_id in board_ids:

        pages = await client.get_threads(board_id)

        # list of pages, each containing threads
        thread_ids = ( for page in pages for thread in page.threads)

        for thread_id in thread_ids:

            # need both board_id and thread_id
            thread = await client.get_thread(board_id, thread_id)

            for post in thread:


                    # might not exist
                    comment =

                except AttributeError:


                # print where we got it, and the comment
                print(board_id, '>', thread_id, '>',, '\n',



except KeyboardInterrupt:





Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aio4chan, version 0.0.0
Filename, size File type Python version Upload date Hashes
Filename, size aio4chan-0.0.0-py3-none-any.whl (4.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aio4chan-0.0.0.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page