don't try to fetch dlsite metadata for non-dlsite works

This commit is contained in:
xenofem 2024-01-29 03:01:35 -05:00
parent 3ca4dcc807
commit 309f19574d

View file

@ -20,6 +20,8 @@ import requests
NUMBER_REGEX = re.compile('[0-9]+') NUMBER_REGEX = re.compile('[0-9]+')
DLSITE_ID_REGEX = re.compile('^[BR]J[0-9]+$')
IMAGE_FILE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.tiff'] IMAGE_FILE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.tiff']
IGNOREABLE_FILES = ['Thumbs.db', '__MACOSX', '.DS_Store'] IGNOREABLE_FILES = ['Thumbs.db', '__MACOSX', '.DS_Store']
@ -69,6 +71,10 @@ async def fetch_async(args):
if res.fetchone() is not None: if res.fetchone() is not None:
continue continue
if not DLSITE_ID_REGEX.fullmatch(work_id):
print(f"{work_id} doesn't seem to be from DLSite, not attempting to fetch metadata")
continue
print(f'Fetching metadata for {work_id}') print(f'Fetching metadata for {work_id}')
metadata = await api.get_work(work_id) metadata = await api.get_work(work_id)