diff --git a/README.md b/README.md index 8e02e7d..1f3a75a 100755 --- a/README.md +++ b/README.md @@ -60,8 +60,11 @@ Download all images/videos from Pinterest user/board/section. Normally used with -rs -rs, --re-scrape Default is only fetch new images since latest Pin ID image to speed up update process. This option disable - this behavior and re-scrape all, use it when you feel - missing images somewhere(caused by reorder). + that behavior and re-scrape all, use it when you feel + missing images somewhere or incomplete download. This + issue is because Pinterest only lists reordered as you + see in the webpage which affects sort by time/PinID + trick. -es, --exclude-section Exclude sections if download from username or board. -ps HTTPS_PROXY, --https-proxy HTTPS_PROXY @@ -96,5 +99,19 @@ Download all images/videos from Pinterest user/board/section. Download into directory: comp/antonellomiglio/Computer/ [✔] Downloaded: |##################################################| 100.0% Complete [i] Time Spent: 0:00:06 - xb@dnxb:~/Downloads/pinterest/pinterest-downloader$ + +##### Rerun(ensure same directory) will no new item found since latest pin Id file: + xb@dnxb:~/Downloads/pinterest/pinterest-downloader$ python3 pinterest-downloader.py -d comp https://www.pinterest.com/antonellomiglio/computer/ + [i] Job is download single board by username/boardname: antonellomiglio/computer + [...] Getting all images in this board: computer ... [ 0 / ? ] + [i] No new item found. + [i] Time Spent: 0:00:04 + +##### Rerun in future(upload or delete highest pin id files to test) to fetch new items only which Pin IDs higher than exising Pin ID(speed up without fetch all pages(use -rs if user reordered concerns): + xb@dnxb:~/Downloads/pinterest/pinterest-downloader$ python3 pinterest-downloader.py -d comp https://www.pinterest.com/antonellomiglio/computer/ + [i] Job is download single board by username/boardname: antonellomiglio/computer + [...] Getting all images in this board: computer ... [ 0 / ? ] [➕] Found 5 new image/videos + Download into directory: comp/antonellomiglio/Computer/ + [✔] Downloaded: |##################################################| 100.0% Complete + [i] Time Spent: 0:00:04 diff --git a/pinterest-downloader.py b/pinterest-downloader.py index a77463f..f96f724 100755 --- a/pinterest-downloader.py +++ b/pinterest-downloader.py @@ -954,7 +954,7 @@ def write_log(arg_timestamp_log, url_path, shortform, save_dir, images, pin, arg def sort_func(x): prefix = x.split('.')[0].split('_')[0] if prefix.isdigit(): - return float(prefix) + return int(prefix) return 0 @@ -1155,7 +1155,7 @@ Please ensure your username/boardname/[section] or link has media item.\n') ) if (('videos' in img) and img['videos']) or 'images' in img: if img['id'].isdigit(): img_curr = img['id'] - if img_prev and (float(img_curr) > float(img_prev)): + if img_prev and (int(img_curr) > int(img_prev)): cprint(''.join([ HIGHER_YELLOW, '%s' % ('\n[W] This images list is not sorted(Due to user reorder or alphanumeric pin ID), fallback to -rs for this list.\n\n') ]), attrs=BOLD_ONLY, end='' ) sorted_api = False reach_lastest_pin = False @@ -1273,7 +1273,8 @@ def main(): arg_parser.add_argument('-f', '--force', action='store_true', help='Force re-download even if image already exist. Normally used with -rs') # Need reverse images order(previously is latest to oldest) to avoid abort this need re-download in-between missing images. arg_parser.add_argument('-rs', '--re-scrape', dest='rescrape', action='store_true', help='Default is only fetch new images since latest Pin ID image to speed up update process.\n\ - This option disable this behavior and re-scrape all, use it when you feel missing images somewhere(caused by reorder).') + This option disable that behavior and re-scrape all, use it when you feel missing images somewhere or incomplete download.\n\ + This issue is because Pinterest only lists reordered as you see in the webpage which affects sort by time/PinID trick.') arg_parser.add_argument('-es', '--exclude-section', dest='exclude_section', action='store_true', help='Exclude sections if download from username or board.') arg_parser.add_argument('-ps', '--https-proxy', help='Set proxy for https.') arg_parser.add_argument('-p', '--http-proxy', help='Set proxy for http.')