Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import ipywidgets as widgets
- from IPython.display import display
- API_TOKEN = "CHANGE TOJEEENN"
- textarea = widgets.Textarea(
- placeholder="1 link per baris...",
- layout=widgets.Layout(width='100%', height='200px')
- )
- upload_button = widgets.Button(
- description="Upload",
- button_style='success'
- )
- progress = widgets.IntProgress(
- value=0,
- min=0,
- max=100,
- description='Progress:',
- bar_style='info',
- layout=widgets.Layout(width='100%')
- )
- output = widgets.Output()
- def upload_links(b):
- with output:
- output.clear_output()
- links_text = textarea.value.strip()
- if not links_text:
- print("Isi link dulu")
- return
- links = [x.strip() for x in links_text.split("\n") if x.strip()]
- total = len(links)
- success = 0
- failed = 0
- progress.value = 0
- progress.max = total
- upload_button.description = "Sedang upload..."
- upload_button.disabled = True
- print("Total link :", total)
- print()
- for i, link in enumerate(links):
- try:
- res = requests.post(
- "https://krakenfiles.com/api/remote-upload",
- headers={
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-AUTH-TOKEN": API_TOKEN
- },
- json={"url": link},
- timeout=60
- )
- print("STATUS CODE:", res.status_code)
- try:
- data = res.json()
- except:
- data = res.text
- if isinstance(data, dict) and data.get("status") == "success":
- success += 1
- print("✔ SUCCESS :", link)
- else:
- failed += 1
- print("❌ FAILED :", link)
- print("RESPONSE :", data)
- except Exception as e:
- failed += 1
- print("❌ ERROR :", link)
- print("ERROR :", str(e))
- progress.value = i + 1
- print("-"*50)
- print("\n========== RESULT ==========")
- print("Total :", total)
- print("Success :", success)
- print("Failed :", failed)
- upload_button.description = "Upload"
- upload_button.disabled = False
- upload_button.on_click(upload_links)
- display(textarea, upload_button, progress, output)
Advertisement
Add Comment
Please, Sign In to add comment