Dcard crawler using asyncio(coroutine)
Project description
dcard_coworker
==============
Dcard crawler using asyncio(coroutine)
Feature
-------
| Get article list and content using coroutine
Dependencies
------------
* Python 3.3 and :mod:`asyncio` or Python 3.4+
* aiohttp
Installation
------------
::
python setup.py install
or
::
pip install dcard_coworker
Example
-------
::
import asyncio
import aiohttp
import dcard_coworker
@asyncio.coroutine
def get_funny_articles():
session = aiohttp.ClientSession()
forum_name = 'funny'
page_index = 1
result = yield from dcard_coworker.get_articles_of_page(session, forum_name, page_index)
print(result)
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait([get_funny_articles()]))
if __name__ == '__main__':
main()
Todo
----
* Add testings
* Add more examples
Authors and License
-------------------
The ``dcard_coworker`` package is written by Chien-Wei Huang. It’s MIT licensed and freely available.
Feel free to improve this package and send a pull request to GitHub.
==============
Dcard crawler using asyncio(coroutine)
Feature
-------
| Get article list and content using coroutine
Dependencies
------------
* Python 3.3 and :mod:`asyncio` or Python 3.4+
* aiohttp
Installation
------------
::
python setup.py install
or
::
pip install dcard_coworker
Example
-------
::
import asyncio
import aiohttp
import dcard_coworker
@asyncio.coroutine
def get_funny_articles():
session = aiohttp.ClientSession()
forum_name = 'funny'
page_index = 1
result = yield from dcard_coworker.get_articles_of_page(session, forum_name, page_index)
print(result)
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait([get_funny_articles()]))
if __name__ == '__main__':
main()
Todo
----
* Add testings
* Add more examples
Authors and License
-------------------
The ``dcard_coworker`` package is written by Chien-Wei Huang. It’s MIT licensed and freely available.
Feel free to improve this package and send a pull request to GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dcard_coworker-0.1.0.tar.gz
(3.0 kB
view details)
File details
Details for the file dcard_coworker-0.1.0.tar.gz
.
File metadata
- Download URL: dcard_coworker-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3b3a8812ce77446382a725b3e6ad5ceeed8d30fc57425ee44e23754ed1833d0 |
|
MD5 | c1d60e20ff089e64925e6565ecdce14b |
|
BLAKE2b-256 | 9a6a42c4e0e7eb3b6a585a327fedc6ea22c3b03063be0ed4c6dafcf1d646d282 |