Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- import json
- import os
- import os.path
- import sys
- import shutil
- from time import sleep
- os.system("clear")
- print """
- \t=====================================================
- \t __ __ __ __
- \t \ \/ /__ __ __/ /___ __/ / ___
- \t \ / _ \/ // / __/ // / _ \/ -_) LINK
- \t /_/\___/\_,_/\__/\_,_/_.__/\__/ __
- \t / __/_ __/ /________ _____/ /____ ____
- \t / _/ \ \ / __/ __/ _ `/ __/ __/ _ \/ __/
- \t V:0.1 /___//_\_\\__/_/ \_,_/\__/\__/\___/_/
- \t=====================================================
- """
- channelid = raw_input("Channel ID : ")
- api_key = "16b06bd9b738835e2d134fe8d596e9ab0086a985" # MZTRAPIS.OOO
- url_api = "http://mztrapis.ooo/v1/ytm4a.php?channelid="+ channelid + "&key=" + api_key
- req = urllib2.Request(url_api)
- opener = urllib2.build_opener()
- data = opener.open(req)
- json = json.loads(data.read())
- print("\n---------------------------------------------\n")
- print("Channel Name : " + json[0]['channel'] + "\n")
- print("---------------------------------------------\n")
- opt = raw_input("Save / Print / Abort / Download ? (s/p/a/d) : ")
- print("\n---------------------------------------------\n")
- if opt == "p":
- for ytlink in json:
- print("\t" + ytlink['result']['link'])
- elif opt == "s":
- if os.path.isfile(json[0]['channel'] + ".txt"):
- os.remove(json[0]['channel'] + ".txt")
- print("Rewriting....")
- sleep(2)
- with open(json[0]['channel']+ ".txt", "w") as output:
- for ytlink in json:
- output.write(str(ytlink['result']['link'] + "\n"))
- else:
- print("Writing.....")
- with open(json[0]['channel']+ ".txt", "w") as output:
- for ytlink in json:
- output.write(str(ytlink['result']['link'] + "\n"))
- elif opt == "d":
- for ytlink in json:
- os.system("wget --trust-server-names '" + json['result']['link'] + "'")
- else:
- print("Aborting... & Quiting.....")
- sleep(2)
- exit()
- print("\n---------------------------------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement