Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. from Tkinter import *
  2. import subprocess
  3. import urllib2
  4. import os
  5. username = "Name"
  6. password = "PW"
  7.  
  8.  
  9. pathToFilter = "filter.txt"
  10. pathToFormatFile = "Streamformats.txt"
  11. pathToYouTubeDL = "youtube-dl.exe"
  12. pathToDownloadBat = "download.bat"
  13. pathToATxt = "a.txt"
  14. pathToABat = "a.bat"
  15.  
  16.  
  17. def oldGetLinkpy():
  18. formatFileContent = open(pathToFormatFile).readlines()
  19.  
  20. links = []
  21. for i in range(len(formatFileContent)):
  22. if("audio only" not in formatFileContent[i] and "unknown" not in formatFileContent[i]):
  23. if(v.get() == 2):
  24. if(("Sub" in formatFileContent[i]or "(UT)" in formatFileContent[i]) and int(formatFileContent[i].split()[2].split("x")[1])>= 720):
  25. links.append(formatFileContent[i])
  26. if(v.get() == 1):
  27. if("Dub" in formatFileContent[i] and int(formatFileContent[i].split()[2].split("x")[1])>= 720):
  28. links.append(formatFileContent[i])
  29.  
  30. if(v.get() == 1):
  31. subprocess.call((pathToDownloadBat + " " + lnkInput.get("1.0",'end-1c') + " "+ links[0].split()[0] + " " + epiInput.get("1.0",'end-1c') + " " + getNameForEpisode(lnkInput.get("1.0",'end-1c'), "GerDub", epiInput.get("1.0",'end-1c'), "720p")))
  32. subprocess.call((pathToDownloadBat + " " + lnkInput.get("1.0",'end-1c') + " "+ links[len(links)-1].split()[0] + " " + epiInput.get("1.0",'end-1c')+ " " + getNameForEpisode(lnkInput.get("1.0",'end-1c'), "GerDub", epiInput.get("1.0",'end-1c'), "1080p.Plus")))
  33. if(v.get() == 2):
  34. subprocess.call((pathToDownloadBat+ " " + lnkInput.get("1.0",'end-1c') + " "+ links[0].split()[0] + " " + epiInput.get("1.0",'end-1c')+ " " + getNameForEpisode(lnkInput.get("1.0",'end-1c'), "GerSub", epiInput.get("1.0",'end-1c'), "720p")))
  35. subprocess.call((pathToDownloadBat+" " + lnkInput.get("1.0",'end-1c') + " "+ links[len(links)-1].split()[0] + " " + epiInput.get("1.0",'end-1c')+ " " + getNameForEpisode(lnkInput.get("1.0",'end-1c'), "GerSub", epiInput.get("1.0",'end-1c'), "1080p.Plus")))
  36.  
  37. def getStreamformatsFromAoD():
  38. os.system(pathToYouTubeDL+ " \"" + lnkInput.get("1.0",'end-1c') +"\""+ " --password "+password+" -u "+username+" --all-formats"+" --get-format"+ " > " + pathToFormatFile)
  39. print(pathToYouTubeDL+ " \"" + lnkInput.get("1.0",'end-1c') +"\""+ " --password geheim -u geheim --all-formats"+" --get-format"+ " > " + pathToFormatFile)
  40.  
  41.  
  42. def getNameForEpisode(url, mode, epi, size):
  43. AnimeName = ""
  44. Episode = epi
  45. EpisodenName = ""
  46. Typ = mode
  47. Additional = ".Webrip.AAC."
  48. Aufloesung = size
  49. End = ".[Share-Bot]"
  50.  
  51. content = urllib2.urlopen(url).read().split("\n")
  52. for i in range(len(content)):
  53. if("itemprop=\"name\"" in content[i]):
  54. filterContent = open(pathToFilter).readlines();
  55. AnimeName = (content[i+1].replace(" " , ".").replace("..","."))
  56. if(("Episode " + str(Episode)+"<br />") in content[i]):
  57. EpisodenName = (content[i].split("Episode " + str(Episode)+"<br />")[1].split("<")[0]).replace(" ",".")
  58. filterContent = open(pathToFilter).readlines();
  59. output = AnimeName + ".Ep." + str(Episode) + "." + EpisodenName + "."+Typ + Additional + size + End
  60. for j in range(len(filterContent)):
  61. print(filterContent[j].replace("\n",""))
  62. output = output.replace(filterContent[j].replace("\n", "") , "")
  63. return(output.replace("..","."))
  64.  
  65.  
  66.  
  67. print(getNameForEpisode("https://www.anime-on-demand.de/anime/112", "GerSub", 1, "720p"))
  68.  
  69. root = Tk()
  70. root.title("All in one Downloader made by Felix#2103")
  71. root.geometry("1200x300")
  72. root.resizable(0, 0)
  73.  
  74. linkLabel = Label(root, font = "Arial 16")
  75. linkLabel.config(text="Link hier einfuegen: ")
  76. linkLabel.pack()
  77.  
  78. lnkInput = Text(root, height=1, width=80, font = "Arial 16")
  79. lnkInput.pack()
  80.  
  81. additionalContent = Label(root, font = "Arial 12")
  82. additionalContent.config(text="\nZusaetzliche Informationen (nur bei AoD Downloads)")
  83. additionalContent.pack()
  84.  
  85. v = IntVar()
  86.  
  87. Radiobutton(root, text="Dub", padx = 20, variable=v, value=1, font = "Arial 12").pack()
  88. Radiobutton(root, text="Sub", padx = 20, variable=v, value=2, font = "Arial 12").pack()
  89.  
  90. epiLabel = Label(root, font = "Arial 12")
  91. epiLabel.config(text="Episode: ")
  92. epiLabel.pack()
  93.  
  94.  
  95. epiInput = Text(root, height=1, width=10, font = "Arial 12")
  96. epiInput.pack()
  97.  
  98.  
  99. def action():
  100. if(lnkInput.get("1.0",'end-1c')!=""):
  101. if("crunchyroll" in lnkInput.get("1.0",'end-1c')):
  102. os.system("echo " + lnkInput.get("1.0",'end-1c') + " > " + pathToATxt)
  103. os.system(pathToABat)
  104. if("anime-on-demand" in lnkInput.get("1.0",'end-1c')):
  105. getStreamformatsFromAoD()
  106. oldGetLinkpy()
  107. b = Button(root, text="Start", command=action, font = "Arial 16 bold")
  108. b.pack()
  109.  
  110. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement