BoubSter18

Untitled

Nov 24th, 2020
568
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. with open('temp.zip', 'wb') as f:
  2.     number = 1
  3.     total = 0
  4.     for item in jsonsong: total += 1
  5.     for item in jsonsong:
  6.         if item['hash'] in history: print("{} has already be downloaded\n\n".format(item['songName']))
  7.         else:
  8.             dlstart = int(time() * 1000)
  9.             print("Now downloading {}".format(item['songName']))
  10.             req = get('{}{}'.format(hashurl, item['hash'].lower()), headers=headers)
  11.             f.write(req.content)
  12.             zip = zf.ZipFile('temp.zip', 'r')
  13.             try:
  14.                 zip.extractall(playlistpath + "/" + item['songName'] + " " + item['hash'].lower())
  15.             except NotADirectoryError:
  16.                 print("Error when trying to extract {}\n\n".format(item['songName']))
  17.             except OSError:
  18.                 print("Error when trying to extract {}\n\n".format(item['songName']))
  19.             else:
  20.                 dlend = int(time() * 1000)
RAW Paste Data