No project description provided
Project description
pAsynCrawler
Installation
pip install pAsynCrawler
Features
- Fetch data -
Asynchronously
- Parse data - with
multiprocessing
Example
from bs4 import BeautifulSoup
from pAsynCrawler import AsynCrawler, flattener
def parser_0(response_text):
soup = BeautifulSoup(response_text)
menus = soup.select('ul > li > span > a')
datas = tuple(x.text for x in menus)
urls = tuple(x.attrs['href'] for x in menus)
return (datas, urls)
def parser_0(response_text):
soup = BeautifulSoup(response_text)
menus = soup.select('ul > li > a')
datas = tuple(x.text for x in menus)
urls = tuple(x.attrs['href'] for x in menus)
return (datas, urls)
if __name__ == '__main__':
ac = AsynCrawler(asy_fetch=20, mp_parse=8)
datas_1, urls_1 = ac.fetch_and_parse(parser_0, ['https://www.example.com'])
datas_2, urls_2 = ac.fetch_and_parse(parser_1, flattener(urls_1))
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
pAsynCrawler-0.1.11.tar.gz
(7.5 kB
view details)
Built Distribution
File details
Details for the file pAsynCrawler-0.1.11.tar.gz
.
File metadata
- Download URL: pAsynCrawler-0.1.11.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e99b8fb8c13775f8edf7ce3afecc493956c952fa9de88e5a2e712d706a5ea3d3 |
|
MD5 | 3c75f78664090825519235a48ae9dfe2 |
|
BLAKE2b-256 | dd88fcbcff0b47c320f13da9d8ec2087dc458bbbe7b5a74e7c31e1037366f52c |
File details
Details for the file pasyncrawler-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: pasyncrawler-0.1.11-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d0edf1e3686472c1b804ceea0679ebc86497630eef7010eeacd57156bcf35c0 |
|
MD5 | dae36fc8873bbccd99d796096b9c9a60 |
|
BLAKE2b-256 | db646990f3653758a9466090cc2e861863f2e9ee55d40b3d614748fc74390752 |