Guest User

Untitled

a guest
Mar 7th, 2026
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. import requests
  2. import ipywidgets as widgets
  3. from IPython.display import display
  4.  
  5. API_TOKEN = "CHANGE TOJEEENN"
  6.  
  7. textarea = widgets.Textarea(
  8. placeholder="1 link per baris...",
  9. layout=widgets.Layout(width='100%', height='200px')
  10. )
  11.  
  12. upload_button = widgets.Button(
  13. description="Upload",
  14. button_style='success'
  15. )
  16.  
  17. progress = widgets.IntProgress(
  18. value=0,
  19. min=0,
  20. max=100,
  21. description='Progress:',
  22. bar_style='info',
  23. layout=widgets.Layout(width='100%')
  24. )
  25.  
  26. output = widgets.Output()
  27.  
  28.  
  29. def upload_links(b):
  30.  
  31. with output:
  32. output.clear_output()
  33.  
  34. links_text = textarea.value.strip()
  35.  
  36. if not links_text:
  37. print("Isi link dulu")
  38. return
  39.  
  40. links = [x.strip() for x in links_text.split("\n") if x.strip()]
  41.  
  42. total = len(links)
  43. success = 0
  44. failed = 0
  45.  
  46. progress.value = 0
  47. progress.max = total
  48.  
  49. upload_button.description = "Sedang upload..."
  50. upload_button.disabled = True
  51.  
  52. print("Total link :", total)
  53. print()
  54.  
  55. for i, link in enumerate(links):
  56.  
  57. try:
  58.  
  59. res = requests.post(
  60. "https://krakenfiles.com/api/remote-upload",
  61. headers={
  62. "Accept": "application/json",
  63. "Content-Type": "application/json",
  64. "X-AUTH-TOKEN": API_TOKEN
  65. },
  66. json={"url": link},
  67. timeout=60
  68. )
  69.  
  70. print("STATUS CODE:", res.status_code)
  71.  
  72. try:
  73. data = res.json()
  74. except:
  75. data = res.text
  76.  
  77. if isinstance(data, dict) and data.get("status") == "success":
  78. success += 1
  79. print("✔ SUCCESS :", link)
  80.  
  81. else:
  82. failed += 1
  83. print("❌ FAILED :", link)
  84. print("RESPONSE :", data)
  85.  
  86. except Exception as e:
  87. failed += 1
  88. print("❌ ERROR :", link)
  89. print("ERROR :", str(e))
  90.  
  91. progress.value = i + 1
  92. print("-"*50)
  93.  
  94. print("\n========== RESULT ==========")
  95. print("Total :", total)
  96. print("Success :", success)
  97. print("Failed :", failed)
  98.  
  99. upload_button.description = "Upload"
  100. upload_button.disabled = False
  101.  
  102.  
  103. upload_button.on_click(upload_links)
  104.  
  105. display(textarea, upload_button, progress, output)
Advertisement
Add Comment
Please, Sign In to add comment