33 lines
638 B
Python
33 lines
638 B
Python
import json
|
|
import asyncio
|
|
|
|
from pathlib import Path
|
|
|
|
from utils.middlewares import SemaphoreMiddleware
|
|
from utils.scraper import Scraper
|
|
from models.post import Post
|
|
|
|
|
|
archive_dir = Path('archives')
|
|
|
|
async def main():
|
|
middlewares = (
|
|
SemaphoreMiddleware(5),
|
|
)
|
|
|
|
async with Scraper(middlewares=middlewares) as scraper:
|
|
post = Post(
|
|
id=2341247,
|
|
boardId='event_voicere',
|
|
boardPath='board'
|
|
)
|
|
|
|
await scraper.view(post)
|
|
await scraper.download_attachments(post, archive_dir)
|
|
|
|
print(post)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(main())
|