import requests,traceback
from fake_useragent import UserAgent


#method follow
def upFollow(slink,toket):
	ua = UserAgent()
	uafix=ua.random
	try:
		headers={'User-Agent':''+uafix+'','Authorization':'Token '+toket,'origin':'https://www.spooncast.net','referer':'https://www.spooncast.net/','content-type':'application/json'}
		response = requests.post('https://id-api.spooncast.net/users/'+str(slink)+'/follow/',headers=headers,timeout=2)
		print(response.json())
		if response:
			print("berhasil")
	except:
		print(traceback.format_exc())

#upcast
def upCast(slink,toket):
	ua = UserAgent()
	uafix=ua.random
	try:
		headers={'User-Agent':''+uafix+'','Authorization':'Token '+toket,'origin':'https://www.spooncast.net','referer':'https://www.spooncast.net/','content-type':'application/json'}
		response = requests.post('https://id-api.spooncast.net/casts/'+slink+'/like/',headers=headers,timeout=2)
		print(response.json())
		if response:
			print("berhasil")
	except:
		print(traceback.format_exc())



#method castlistener
def upCastListener(slink):
	ua = UserAgent()
	uafix=ua.random
	try:
		headers={'User-Agent':uafix,'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3','origin':'https://www.spooncast.net','referer':'https://www.spooncast.net/','content-type':'application/json'}
		response = requests.post('https://id-api.spooncast.net/casts/'+slink+'/play/',headers=headers,timeout=2)
		print(response.json())
		if response:
			print("berhasil")
	except:
		print(traceback.format_exc())
		

#login return
# 0 tokens
# 1 uafix
def login(nomer,password):
	ua = UserAgent()
	uafix = ua.random
	headers = {"User-Agent":uafix,'origin':'https://www.spooncast.net','referer':'https://www.spooncast.net/','content-type':'application/json'}
	tokens = requests.post('https://id-auth.spooncast.net/tokens',headers=headers,json={"device_unique_id":uafix,"auth_data":{"act_type":"phone","password":password,"msisdn":nomer}})
	
	return tokens,uafix
		
		
		
		
		
import requests,traceback
from fake_useragent import UserAgent


#method follow
def upFollow(slink,toket):
	ua = UserAgent()
	uafix=ua.random
	try:
		headers={'User-Agent':''+uafix+'','Authorization':'Token '+toket,'origin':'https://www.spooncast.net','referer':'https://www.spooncast.net/','content-type':'application/json'}
		response = requests.post('https://id-api.spooncast.net/users/'+str(slink)+'/follow/',headers=headers,timeout=2)
		print(response.json())
		if response:
			print("berhasil")
	except:
		print(traceback.format_exc())

#upcast
def upCast(slink,toket):
	ua = UserAgent()
	uafix=ua.random
	try:
		headers={'User-Agent':''+uafix+'','Authorization':'Token '+toket,'origin':'https://www.spooncast.net','referer':'https://www.spooncast.net/','content-type':'application/json'}
		response = requests.post('https://id-api.spooncast.net/casts/'+slink+'/like/',headers=headers,timeout=2)
		print(response.json())
		if response:
			print("berhasil")
	except:
		print(traceback.format_exc())



#method castlistener
def upCastListener(slink):
	ua = UserAgent()
	uafix=ua.random
	try:
		headers={'User-Agent':uafix,'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3','origin':'https://www.spooncast.net','referer':'https://www.spooncast.net/','content-type':'application/json'}
		response = requests.post('https://id-api.spooncast.net/casts/'+slink+'/play/',headers=headers,timeout=2)
		print(response.json())
		if response:
			print("berhasil")
	except:
		print(traceback.format_exc())
		

#login return
# 0 tokens
# 1 uafix
def login(nomer,password):
	ua = UserAgent()
	uafix = ua.random
	headers = {"User-Agent":uafix,'origin':'https://www.spooncast.net','referer':'https://www.spooncast.net/','content-type':'application/json'}
	tokens = requests.post('https://id-auth.spooncast.net/tokens',headers=headers,json={"device_unique_id":uafix,"auth_data":{"act_type":"phone","password":password,"msisdn":nomer}})
	
	return tokens,uafix
		
		
		
		
		
#method follow #upcast #method castlistener #login return # 0 tokens # 1 uafix