minor changed

This commit is contained in:
limkokhole
2020-06-21 03:26:15 +08:00
parent 1453358be8
commit d67cfd6972

View File

@@ -198,9 +198,9 @@ def get_pin_info(pin_id, arg_timestamp_log, arg_force_update, arg_dir, arg_cut):
IMG_SESSION = get_session(3) IMG_SESSION = get_session(3)
V_SESSION = get_session(4) V_SESSION = get_session(4)
print('[i] Download Pin id: ' + images['id'] + ' in directory: ' + arg_dir) print('[i] Download Pin id: ' + images['id'] + ' in directory: ' + arg_dir)
printProgressBar(0, 1, prefix='[...] Progress:', suffix='Complete', length=50) printProgressBar(0, 1, prefix='[...] Downloading:', suffix='Complete', length=50)
download_img(images, arg_dir, arg_force_update, IMG_SESSION, V_SESSION, arg_cut) download_img(images, arg_dir, arg_force_update, IMG_SESSION, V_SESSION, arg_cut)
printProgressBar(1, 1, prefix='[✔] Progress:', suffix='Complete ', length=50) printProgressBar(1, 1, prefix='[✔] Downloaded:', suffix='Complete ', length=50)
except KeyError: except KeyError:
return quit(traceback.format_exc()) return quit(traceback.format_exc())
print() print()
@@ -780,10 +780,10 @@ Please ensure your username/boardname or link has media item.\n') )
# Get the results # Get the results
# rs = f.result() # rs = f.result()
# print('done') # print('done')
printProgressBar(index + 1, len(images), prefix='[...] Progress:', suffix='Complete', length=50) printProgressBar(index + 1, len(images), prefix='[...] Downloading:', suffix='Complete', length=50)
# Need suffix with extra 2 spaces to replace previos longer ... line to avoid see wrong word "Complete" # Need suffix with extra 3 spaces to replace previos longer ... + Downloading->ed line to avoid see wrong word "Complete"
printProgressBar(len(images), len(images), prefix='[✔] Progress:', suffix='Complete ', length=50) printProgressBar(len(images), len(images), prefix='[✔] Downloaded:', suffix='Complete ', length=50)
print() print()
@@ -824,6 +824,9 @@ def main():
if url_path.startswith('/'): if url_path.startswith('/'):
url_path = url_path[1:] url_path = url_path[1:]
slash_path = url_path.split('/') slash_path = url_path.split('/')
if '.' in slash_path[0]:
# Impossible dot in username, so it means host without https:// and nid remove
slash_path = slash_path[1:]
if len(slash_path) > 3: if len(slash_path) > 3:
return quit('[!] Something wrong with Pinterest URL. Please report this issue at https://github.com/limkokhole/pinterest-downloader/issues , thanks.') return quit('[!] Something wrong with Pinterest URL. Please report this issue at https://github.com/limkokhole/pinterest-downloader/issues , thanks.')
@@ -844,8 +847,9 @@ def main():
if len(slash_path) == 3: if len(slash_path) == 3:
u_url = '/'.join(slash_path) u_url = '/'.join(slash_path)
print('[i] Job is download single board by username/boardname/section: {}'.format(u_url)) print('[i] Job is download single board by username/boardname/section: {}'.format(u_url))
if slash_path[-3] in ('search', 'categories', 'topics'): # Will err if try to create section by naming 'more_ideas'
return quit('{}'.format('\n[✖] Search, Categories and Topics not supported.\n') ) if ( slash_path[-3] in ('search', 'categories', 'topics') ) or ( slash_path[-1] in ['more_ideas'] ):
return quit('{}'.format('\n[✖] Search, Categories, Topics, more_ideas are not supported.\n') )
board = get_board_info(u_url, slash_path[-1]) board = get_board_info(u_url, slash_path[-1])
try: try:
IMGS_SESSION = get_session(2) IMGS_SESSION = get_session(2)