python - Youtube API not returning a video is live even when it is? -
so i'm getting unintended behavior youtube api -
class youtube: def __init__(self): #self.youtube= youtubeapi('aizasycocdd-vl2znilqvnarxkxltqkixcnj6ma') self.api_key=my_number def channel_id(self,name): string= "https://www.googleapis.com/youtube/v3/channels?key=" + self.api_key + "&forusername=" +name + "&part=id" r=requests.get(string) data=json.loads(r.text) chan_id_list= data["items"][0] chan_id = chan_id_list["id"] return chan_id def is_live(self,channels_id): string = "https://www.googleapis.com/youtube/v3/search?part=snippet&channelid="+ channels_id+ "&type=video&eventtype=live&key=" + self.api_key r=requests.get(string) data = json.loads(r.text) print data x=youtube() x.is_live(x.channel_id("wwe")) print x.channel_id("wwe")
when run code output
{u'regioncode': u'us', u'kind': u'youtube#searchlistresponse', u'etag': u'"m2yskbqfythfe4irbtieogyyfbu/-f6ja5_ocxz2rwuh1mpaa2_9mm8"', u'pageinfo': {u'resultsperpage': 5, u'totalresults': 0}, u'items': []} uc2oxk5j24c1gyhdwprdnplw
i response empty. feel i'm missing trivial. know whats going on?
Comments
Post a Comment