diff --git a/utils/scraper.py b/utils/scraper.py index d9caaba..9f2d659 100644 --- a/utils/scraper.py +++ b/utils/scraper.py @@ -176,12 +176,7 @@ class Scraper(ClientSession): return document.select_one('source')['src'] - async def download_attachment( - self, - url: str, - save_dir: Path, - chunk_size = 8192 - ) -> Attachment: + async def download_attachment(self, url: str, save_dir: Path) -> Attachment: """ 첨부 파일을 받아옵니다 @@ -208,7 +203,7 @@ class Scraper(ClientSession): with NamedTemporaryFile('wb') as temp_file: async with await self.get(attachment.source_url) as response: - async for chunk in response.content.iter_chunked(chunk_size): + async for chunk, _ in response.content.iter_chunks(): temp_file.write(chunk) hash.update(chunk) @@ -244,7 +239,7 @@ class Scraper(ClientSession): urls = [ # 이미지 *[ - tag['data-original'].strip() + tag.attrs.get('data-mp4', tag['data-original']).strip() for tag in post.body.select('img[data-original]') ],