From f0cfae7ebdda017849b907617e0d75b771558889 Mon Sep 17 00:00:00 2001 From: oscarz Date: Sun, 30 Mar 2025 14:39:31 +0800 Subject: [PATCH] modify scripts --- javdb/src/fetch.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/javdb/src/fetch.py b/javdb/src/fetch.py index 726f698..bb52cde 100644 --- a/javdb/src/fetch.py +++ b/javdb/src/fetch.py @@ -203,17 +203,21 @@ def fetch_movies_detail(): if len(movies_list) < 1: logging.info(f'all movies fetched.') break + last_movie_id = 0 + succ_count = 0 for movie in movies_list: url = movie['href'] title = movie['title'] - logging.info(f"Fetching data for movie ({title}), url {url} ...") + logging.debug(f"Fetching data for movie ({title}), url {url} ...") soup, status_code = scraper.fetch_page(url, partial(scraper.generic_validator, tag="div", identifier="video-meta-panel", attr_type="class")) if soup: movie_data = scraper.parse_movie_detail(soup, url, title) if movie_data : movie_id = db_tools.insert_or_update_movie(movie_data) if movie_id: - logging.info(f'insert one movie, id: {movie_id}, title: ({title}) url: {url}') + logging.debug(f'insert one movie, id: {movie_id}, title: ({title}) url: {url}') + last_movie_id = movie_id + succ_count += 1 else: logging.warning(f'insert movie {url} failed.') else: @@ -228,6 +232,7 @@ def fetch_movies_detail(): else: logging.warning(f'fetch_page error. url: {url}') time.sleep(1) + logging.info(f'total request: {len(movies_list)}, succ: {succ_count}. last movie id: {last_movie_id}') # 调试增加break if debug: return True