A MuseScore PDF scraper.
Project description
MuseScore Scraper
A MuseScore PDF scraper that serves as both a CLI and Python module. For non-subscription paying users.
Set-up
Run pip install musescore-scraper
in your terminal.
PyPI page for more details: https://pypi.org/project/musescore-scraper/
Usage
If as CLI
Execute musescraper <urls>
with as many MuseScore score URLs as desired.
If as Python module
from musescore_scraper import MuseScraper
with MuseScraper() as ms:
ms.to_pdf( <url> )
Custom Output Destination
If as CLI
Execute musescraper <urls> -o <output destinations or just a shared directory>
If as Python module
from musescore_scraper import MuseScraper
with MuseScraper() as ms:
ms.to_pdf( <url>, output= <output destination or just a shared directory> )
Debugging
If as CLI
Execute musescraper <urls> -d [<log file destination>]
Note that if a log file destination isn't provided, logs will be sent to stderr stream.
If as Python module
from musescore_scraper import MuseScraper
with MuseScraper(debug_log= <log file destination> ) as ms:
ms.to_pdf( <url> )
Note that if a empty string is provided instead, logs will be sent to stderr stream.
Asynchronous Python class
Useful if more than one score shall be downloaded.
from musescore_scraper import AsyncMuseScraper
from typing import Optional, List
import asyncio
from functools import partial
urls: List[str] = [ <urls> ]
outputs: List[Optional[Path]] = [None] * len(urls)
def set_output(i: int, task: asyncio.Task) -> None:
outputs[i] = task.result()
async def run():
tasks: List[asyncio.Task] = []
async with AsyncMuseScraper() as ms:
for i in range(len(urls)):
task: asyncio.Task = asyncio.create_task(ms.to_pdf(urls[i]))
task.add_done_callback(partial(set_output, i))
tasks.append(task)
result = await asyncio.gather(*tasks)
return result
asyncio.get_event_loop().run_until_complete(run())
Documentation
Available at https://musescore-scraper.readthedocs.io/en/stable/musescore_scraper.html#module-musescore_scraper.MuseScraper
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
Built Distribution
Hashes for musescore_scraper-2.3.0b2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fb97536d490b0495bcfd5b7f803bf079b45bc730bccbfe6d9cf68376c158f62 |
|
MD5 | 048cc229542ccb2fb2209ffb9d90e891 |
|
BLAKE2b-256 | ffc16292faa8d06de9cc39402ac0f66edfe1c33369ede47f478bb2320350c51b |
Hashes for musescore_scraper-2.3.0b2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eede57164e84d6a610bfa012516c22421ed50c09964b786ef6ebf41d026f0624 |
|
MD5 | 1dc24697ff84fe2beee64fe9b20dfa45 |
|
BLAKE2b-256 | a258c5f589bae5520c248e6fdda62b4f9c5e783a8f494fdfcd4c176120175e53 |