import urllib2
import json

print "Services: Youtube (Y), Twitch (T)"
type = raw_input("Service: ")
og = raw_input("OG Name: ")
length = len("og")
if type == "T" and length > 0:
	try:
		request = urllib2.urlopen('https://api.twitch.tv/kraken/users/' + og)
		response = request.read()
	except urllib2.HTTPError, e:
		if e.code == 404:
			print og + " is available for Twitch!"
if type == "Y" and length > 0:     
	request = urllib2.urlopen('http://www.youtube.com/user_ajax?action_check_username=1&user=' + og)
	response = request.read()
	json1 = json.loads(response)
	if 'available' in json1['username_status']:
		print og + " is available for Youtube!"