{ "info": { "author": "Shiimizu", "author_email": "shiimizu@protonmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Code Generators", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# py-chan-api\n\n### Objective:\n- **Unify:** Convert other imageboards to the 4chan api in JSON format\n- **Wrapper:** Parse the JSON to programming-language-specific data structures\n- **Extra:** Ability to download JSON + media \u26a0\ufe0f\n\n### Why?\nI have a lot of threads archived in a plaintext list of links for educational purposes. With the advent of archiving sites cracking down, I realized that it won't always be here and I'd need to save it locally. Later on, it reminded me that not just these need to be archived but everything else on the internet that I value.\n\n### Supports:\n| Feature | Source |\n|-------------------------------|-----------------------------------------------------------|\n| \u2714\ufe0f Single thread |`a.4cdn.org/{board}/thread/{threadnumber}.json` |\n| \u2714\ufe0f Thread index |`a.4cdn.org/{board}/{pagenumber}.json` (threads @ pg #) |\n| \u2714\ufe0f Board list |`a.4cdn.org/boards.json` |\n| \u2714\ufe0f Board catalog |`a.4cdn.org/{board}/catalog.json` |\n| \u2714\ufe0f Thread list |`a.4cdn.org/{board}/threads.json` |\n| \u2714\ufe0f Archived threads |`a.4cdn.org/{board}/archive.json` |\n| \u26a0\ufe0f HTTPS |On by default in `urllib3` |\n| \u26a0\ufe0f Rate limiting |`x` requests allowed in `n` seconds |\n| \u26a0\ufe0f `If-Modified-Since` |`req.headers['last-modified']` |\n| \u26a0\ufe0f In-place thread updating |`req.headers['last-modified']; difflib` |\n\n|**Extra Imageboards** | Compatibility |\n|-------------------------------|----------|\n|\u2714\ufe0f [FFuuka](https://archive.4plebs.org/_/articles/credits/#archives)| `Thread`, `Post` |\n|\u2754 warosu|\n|\u2754 yuki.la |\n\n### API Documentation\n\n#### 4chan\n* [`4chan.org` API (with examples)](https://github.com/catamphetamine/captchan/blob/master/docs/4chan.org.md)\n* [`4chan.org` API (brief official docs)](https://github.com/4chan/4chan-API)\n\n#### FFuuka\n* [`github doc`](https://github.com/FoolCode/FoolFuuka-docs/blob/master/code_guide/documentation/api.rst)\n* [`readthedocs`](https://foolfuuka.readthedocs.io/en/latest/code_guide/documentation/api.html)\n* [`rest api`](https://4plebs.texh/foolfuuka)\n\n---\n\n### Installation\n```bash\npip install py-chan-api # NOTE: Only Python 3.7+\n\n# Or with virtualenv\npip install virtualenv # Install virtualenv if you haven't already\nvirtualenv venv # Create a virtualenv\nsource venv/bin/activate # Activate it\npip install -r requirements.txt # Install required modules\npip install py-chan-api # Install py-chan-api\n```\n### Usage\n\n```python\nimport pychan\n\n# pychan infers what type of object you're giving it. See the above table.\n# Whether its a string pointing to a file/dict/dict in string format.\n\nthreadIndex = pychan.FourChan(\"thread_index.json\")\nboard = pychan.FourChan(\"boards.json\")\nthread = pychan.FourChan(\"thread.json\")\nthreadList = pychan.FourChan(\"thread_list.json\")\narchivedThread = pychan.FourChan(\"archived_threads.json\")\npost = thread.posts[0]\n\nprint(thread.posts[0].com) # Get the first post and its comment\n\nprint(post) # If you're unsure of what fields to call\n # just print the object itself to see a list of key/values\n\n# Or see the type of the unknown object\nprint(type(pychan.FourChan(\"unknown.json\")))\n\nprint(thread.posts[0])\nprint(threadIndex.threads[0].posts[1])\nprint(board.trollflags.AC)\nprint(board.boards[0].title)\nprint(catalog.page[0].threads[0])\nprint(threadList.page[0].threads[0])\nprint(archivedThread[-1])\n\n# To get individual key value/pairs\njdb = thread.posts[0].json # Convert the Post object to a dictionary\nfor k,v in jdb.items(): # Iterate through the key/value pairs\n print(k, v)\n```\n### Converting\n```python\nimport pychan\nfuukaThread = pychan.Fuuka(\"desu_thread.json\") # Specify the imageboard implementation\n\n# Parallelism (multiprocessing) is turned on automatically if you supply more\n# than one key/value pairs in a dictionary.\n# You can override this behaviour by specifying the parallel field\n# By using a dictionary, you can also output it to a file.\nfthread1 = pychan.Fuuka({\"desu_thread.json\" : \"out1.json\"}, parallel = True)\n\n# Which then you could read it as a normal 4chan json\nfthread = pychan.FourChan(\"out1.json\")\n\n# We can also just use the outputed value from before\nprint(fthread1.posts[1]) # Note: fthread1 is the same as fthread and fuukaThread\n```\n\n### Support\nPull requests are welcome.\nFeel free to ping shiimizu @ this [Matrix](https://matrix.to/#/#bibanon-chat:matrix.org) server.\n\n\n### \u26a0\ufe0f Polling (archiving)\n- Archiving capabilities are beyond the scope of this project.\n- Please see \u27a1\ufe0f\n - [`eve`](https://github.com/bibanon/eve)\n - [`hayden`](https://github.com/bbepis/Hayden)\n - [`basc-archiver`](https://github.com/bibanon/BASC-Archiver)\n - [`go-4chan-api`](https://github.com/moshee/go-4chan-api)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/shiimizu/py-chan-api", "keywords": "4chan api imageboard", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "py-chan-api", "package_url": "https://pypi.org/project/py-chan-api/", "platform": "", "project_url": "https://pypi.org/project/py-chan-api/", "project_urls": { "Bug Reports": "https://github.com/shiimizu/py-chan-api/issues", "Homepage": "https://github.com/shiimizu/py-chan-api", "Source": "https://github.com/shiimizu/py-chan-api" }, "release_url": "https://pypi.org/project/py-chan-api/0.1.2/", "requires_dist": null, "requires_python": ">=3.7, <4", "summary": "A Python wrapper for the 4chan API and other imageboards", "version": "0.1.2" }, "last_serial": 5933684, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "47f920d3da5011fcf27044555fc94435", "sha256": "295c71663e92dc153d96ff8211ce2d07bb0eb3c8448f27e2e70d3387a9fa0803" }, "downloads": -1, "filename": "py_chan_api-0.1.1-py3.7.egg", "has_sig": false, "md5_digest": "47f920d3da5011fcf27044555fc94435", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": ">=3.7, <4", "size": 14037, "upload_time": "2019-08-29T16:50:33", "url": "https://files.pythonhosted.org/packages/5b/a5/4bdc02007c69ec871bbb4e2c37ae160534cf300f71a290c06a96d49dd8e4/py_chan_api-0.1.1-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "c25da8d912dead9dbeeee02d5fbc2f92", "sha256": "e25053a11cfdacd71ece3bdc6a6a1efc23680032762ffd1bc4727e822596e531" }, "downloads": -1, "filename": "py-chan-api-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c25da8d912dead9dbeeee02d5fbc2f92", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7, <4", "size": 7314, "upload_time": "2019-08-29T07:21:59", "url": "https://files.pythonhosted.org/packages/f9/62/24796b95a7776f12a736fbb236db61c212956ed7886027afb024d5fffde9/py-chan-api-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "665887b47206ec6f0dada4f8dd1dcc6a", "sha256": "fcde23d049f6decd3481b7d58df80437eab5b746afe18cd7be0362bf2ace9e6e" }, "downloads": -1, "filename": "py_chan_api-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "665887b47206ec6f0dada4f8dd1dcc6a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7, <4", "size": 8651, "upload_time": "2019-10-06T03:15:54", "url": "https://files.pythonhosted.org/packages/d4/6f/879ab85b693692ee249184fd482f744c0ade7c91e750287b59daca6d902a/py_chan_api-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7eb517ca9c5f0d26a7ae7e5776b47a23", "sha256": "e8d48c10068635082460e2bbd97408b836bd3010806c1b76ed995cc0285d6747" }, "downloads": -1, "filename": "py-chan-api-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7eb517ca9c5f0d26a7ae7e5776b47a23", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7, <4", "size": 7711, "upload_time": "2019-10-06T02:46:41", "url": "https://files.pythonhosted.org/packages/f5/ca/64c71a046b730924fd3f957d07bba6c1fbf75f87f0fd8263a8ea70a9cc8d/py-chan-api-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "665887b47206ec6f0dada4f8dd1dcc6a", "sha256": "fcde23d049f6decd3481b7d58df80437eab5b746afe18cd7be0362bf2ace9e6e" }, "downloads": -1, "filename": "py_chan_api-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "665887b47206ec6f0dada4f8dd1dcc6a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7, <4", "size": 8651, "upload_time": "2019-10-06T03:15:54", "url": "https://files.pythonhosted.org/packages/d4/6f/879ab85b693692ee249184fd482f744c0ade7c91e750287b59daca6d902a/py_chan_api-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7eb517ca9c5f0d26a7ae7e5776b47a23", "sha256": "e8d48c10068635082460e2bbd97408b836bd3010806c1b76ed995cc0285d6747" }, "downloads": -1, "filename": "py-chan-api-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7eb517ca9c5f0d26a7ae7e5776b47a23", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7, <4", "size": 7711, "upload_time": "2019-10-06T02:46:41", "url": "https://files.pythonhosted.org/packages/f5/ca/64c71a046b730924fd3f957d07bba6c1fbf75f87f0fd8263a8ea70a9cc8d/py-chan-api-0.1.2.tar.gz" } ] }