Scrape Academy
Scrape Academy provides a framework and an utility helps you to develop web scraping applications.
Simple web page scraping
Scrape Academy helps you to download web pages to scrape.
# Download a page from https://www.python.jp
from bs4 import BeautifulSoup
from scrapeacademy import context, run
async def run_simple():
page = await context.get("https://www.python.jp")
soup = BeautifulSoup(page, features="html.parser")
print(soup.title.text)
run(run_simple())
scrapeacademy.run() starts asyncio event loop and run a scraping function.
In the async function, you can use context.get() method to download the page. The context.get() throttle the requests to the server. By default, context.get() waits 0.1 seconds between requests.
Cache downloaded files
While developping the scraper, you usually need to investigate the HTML over and over. To help investigations, you can save the downloaded files to the cache directory.
The context.get() method saves downloaded file to the cache directory if name parameter is supplied.
# Save https://www.python.jp
from scrapeacademy import context, run
async def save_index():
page = await context.get("https://www.python.jp", name="python_jp_index")
run(run_simple())
Later, you can load the saved HTML from the cache to scrape using another script.
# Parse saved HTML file.
from scrapeacademy import context
html = context.load("python_jp_index")
soup = BeautifulSoup(page, features="html.parser")
print(soup.title.text)
Command line utility
Scrape Academy provides the scrapeacademy command to make development easier.
You can inspect the cached files with web browser.
$ scrapeacademy open python_jp_index
Or, you can view the file with vi editor as follow.
$ vi `scrapeacademy path python_jp_index`
Metadata
Release files for scape-academy 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scape_academy-0.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for scape_academy-0.0.1-py2.py3-none-any.whl |
Release files / scape_academy-0.0.1-py2.py3-none-any.whl
| Download URL | scape_academy-0.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
60699b43bb933207b72456b787a4a599e92c7cb379913f16e62fe22866954163
|
|
BLAKE2b-256 checksum How to use checksums |
ba9cc8e3f3e16d4140a294e48083ed9d72c26f1d186ef9b14b51af0836fba28f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1
|
Security for scape-academy 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.