Skip to main content

Fully asynchronous read-only API wrapper for 2ch.hk (dvach)

Project description

License PyPi Python

Fully asynchronous read-only API wrapper for 2ch.hk (dvach, Двач)

Requirements

  • Python 3.5+

Install with pip

$ pip3 install aio2ch

Build from source

$ git clone https://github.com/wkpn/aio2ch
$ cd ./aio2ch
$ python3 setup.py install

Usage

>>> from aio2ch.api import Api
>>> api = Api()

Get all boards

>>> status, boards = await api.get_boards()

>>> boards
[<Board name: Фагготрия, id: fag>, ... ]

Get all threads from a board

>>> status, threads = await api.get_board_threads(board='b')

>>> threads
[<Thread 180981319>, ... ]

Get top threads from a board sorted by method (views, score or posts_count)

>>> status, top_threads = await api.get_top_board_threads(board='b', method='views', num=3)

>>> top_threads
[<Thread 180894312>, <Thread 180946622>, <Thread 180963318>]

Get all thread’s posts (thread is an instance of Thread)

>>> status, thread_posts = await api.get_thread_posts(thread=thread)

>>> thread_posts
[<Post 180894312>, ... ]

Get all media in all thread’s posts (images, webm and so on)

>>> status, thread_media = await api.get_thread_media(thread=thread)

>>> thread_media
[<File name:15336559148500.jpg, path:/b/src/180979032/15336559148500.jpg, size:19>, ... ]

Download all thread media

>>> await api.download_thread_media(files=thread_media, save_to='./downloads/')

Project details


Download files

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

Source Distribution

aio2ch-1.4.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aio2ch-1.4.3-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file aio2ch-1.4.3.tar.gz.

File metadata

  • Download URL: aio2ch-1.4.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for aio2ch-1.4.3.tar.gz
Algorithm Hash digest
SHA256 36129b82c601279a38e223da078c4d43a69e9ac8d056ca0b8097179578fa31d7
MD5 b69094d71c4647956a96e15762f9d119
BLAKE2b-256 81fa08b44931b0450a4314d27950e0fbdd6204c68173c3da2c3d42b143e29635

See more details on using hashes here.

File details

Details for the file aio2ch-1.4.3-py3-none-any.whl.

File metadata

  • Download URL: aio2ch-1.4.3-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for aio2ch-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 101d7cdd285aa04c862d6dcc891c9ea65a91def28243ec850ace5c2d002d8bd8
MD5 5fa28aa77a3c3807d86cbca2b3582106
BLAKE2b-256 46d9f72057980bae67ac4727b5e19a2f1506ddf14ce9255df4fb693f8834fa20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page