fix: remove hardcoded integer
This commit is contained in:
@@ -18,6 +18,9 @@ from .typings import BoardPath, SearchType
|
||||
from models import Attachment, Post
|
||||
|
||||
|
||||
LIST_MAX_POSTS = 200
|
||||
|
||||
|
||||
class Scraper(ClientSession):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -29,7 +32,7 @@ class Scraper(ClientSession):
|
||||
|
||||
# 게시글 목록 조회로 한 번에 불러올 항목 수
|
||||
self.cookie_jar.update_cookies({
|
||||
'list_count': '200'
|
||||
'list_count': LIST_MAX_POSTS
|
||||
})
|
||||
|
||||
async def __aenter__(self) -> 'Scraper':
|
||||
@@ -84,7 +87,7 @@ class Scraper(ClientSession):
|
||||
for tag in document.select('.gall-detail-lnktb')
|
||||
]
|
||||
|
||||
async def view(self, post: Post):
|
||||
async def view(self, post: Post) -> Post:
|
||||
"""
|
||||
게시글 내용을 조회합니다
|
||||
|
||||
@@ -137,8 +140,8 @@ class Scraper(ClientSession):
|
||||
# 불필요한 본문 요소 제거
|
||||
for tag in post.body.select('script, style'):
|
||||
tag.extract()
|
||||
|
||||
print(f'{post.board_id}/{post.id}: {post.title}')
|
||||
|
||||
return post
|
||||
|
||||
async def fetch_voice(self, id: str):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user