diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 3d49ca0..acc71b0 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -20,6 +20,8 @@ import requests NUMBER_REGEX = re.compile('[0-9]+') +DLSITE_ID_REGEX = re.compile('^[BR]J[0-9]+$') + IMAGE_FILE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.tiff'] IGNOREABLE_FILES = ['Thumbs.db', '__MACOSX', '.DS_Store'] @@ -69,6 +71,10 @@ async def fetch_async(args): if res.fetchone() is not None: 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}') metadata = await api.get_work(work_id)