Advertisement
Guest User

Python file

a guest
Oct 16th, 2021
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. import math
  2. import requests, enlighten
  3. import os
  4.  
  5. def downdisc():
  6. url = 'https://discord.com/api/downloads/distributions/app/installers/latest?channel=stable&platform=win&arch=x86'
  7. fname = 'DiscordSetup.exe'
  8.  
  9. # Should be one global variable
  10. MANAGER = enlighten.get_manager()
  11.  
  12. r = requests.get(url, stream = True)
  13. dlen = int(r.headers.get('Content-Length', '0')) or None
  14.  
  15. with MANAGER.counter(color = 'green', total = dlen and math.ceil(dlen / 2 ** 20), unit = 'MiB', leave = False) as ctr, \
  16. open(fname, 'wb', buffering = 2 ** 24) as f:
  17. for chunk in r.iter_content(chunk_size = 2 ** 20):
  18. f.write(chunk)
  19. ctr.update()
  20.  
  21.  
  22. def downsteam():
  23. url = 'https://cdn.akamai.steamstatic.com/client/installer/SteamSetup.exe'
  24. fname = 'SteamSetup.exe'
  25.  
  26. # Should be one global variable
  27. MANAGER = enlighten.get_manager()
  28.  
  29. r = requests.get(url, stream = True)
  30. dlen = int(r.headers.get('Content-Length', '0')) or None
  31.  
  32. with MANAGER.counter(color = 'green', total = dlen and math.ceil(dlen / 2 ** 20), unit = 'MiB', leave = False) as ctr, \
  33. open(fname, 'wb', buffering = 2 ** 24) as f:
  34. for chunk in r.iter_content(chunk_size = 2 ** 20):
  35. f.write(chunk)
  36. ctr.update()
  37.  
  38. def downLogitech():
  39. url = 'https://download01.logi.com/web/ftp/pub/techsupport/gaming/lghub_installer.exe'
  40. fname = 'lghub_installer.exe'
  41.  
  42. # Should be one global variable
  43. MANAGER = enlighten.get_manager()
  44.  
  45. r = requests.get(url, stream = True)
  46. dlen = int(r.headers.get('Content-Length', '0')) or None
  47.  
  48. with MANAGER.counter(color = 'green', total = dlen and math.ceil(dlen / 2 ** 20), unit = 'MiB', leave = False) as ctr, \
  49. open(fname, 'wb', buffering = 2 ** 24) as f:
  50. for chunk in r.iter_content(chunk_size = 2 ** 20):
  51. f.write(chunk)
  52. ctr.update()
  53.  
  54. def downepic():
  55. url = 'https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/installer/download/EpicGamesLauncherInstaller.msi?trackingId=034d2b021b8e4bd6ac0c0ae3c56c6d3e'
  56. fname = 'EpicInstaller-13.0.0-034d2b021b8e4bd6ac0c0ae3c56c6d3e.msi'
  57.  
  58. # Should be one global variable
  59. MANAGER = enlighten.get_manager()
  60.  
  61. r = requests.get(url, stream = True)
  62. dlen = int(r.headers.get('Content-Length', '0')) or None
  63.  
  64. with MANAGER.counter(color = 'green', total = dlen and math.ceil(dlen / 2 ** 20), unit = 'MiB', leave = False) as ctr, \
  65. open(fname, 'wb', buffering = 2 ** 24) as f:
  66. for chunk in r.iter_content(chunk_size = 2 ** 20):
  67. f.write(chunk)
  68. ctr.update()
  69.  
  70.  
  71. a = input("What would you like to download:\nEpic games (1)\nSteam (2)\nDiscord (3)\nLogitechHub (4)\nAll (5)\n")
  72.  
  73. answer = int(a)
  74.  
  75. if answer == 1:
  76. downepic()
  77. elif answer == 2:
  78. downsteam()
  79. elif answer == 3:
  80. downdisc()
  81. elif answer == 4:
  82. downLogitech()
  83. elif answer == 5:
  84. downepic()
  85. downsteam()
  86. downdisc()
  87. downLogitech()
  88.  
  89. os.system("pause")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement