Enigma2 plugin to to play various online streams (mostly Latvian).

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. #!/usr/bin/env python
  2. # coding=utf8
  3. #
  4. # This file is part of PlayStream - enigma2 plugin to play video streams from various sources
  5. # Copyright (c) 2016 ivars777 (ivars777@gmail.com)
  6. # Distributed under the GNU GPL v3. For full terms see http://www.gnu.org/licenses/gpl-3.0.en.html
  7. #
  8. import sys, os, os.path, re, sys
  9. import urllib,urllib2
  10. from xml.sax.saxutils import unescape,escape
  11. from urllib import quote, unquote
  12. import datetime
  13. import HTMLParser
  14. import json
  15. import ConfigParser
  16. import datetime
  17. API_URL = 'https://m.lattelecom.tv/'
  18. user_agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; da-dk) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3"
  19. headers2dict = lambda h: dict([l.strip().split(": ") for l in h.strip().splitlines()])
  20. h = HTMLParser.HTMLParser()
  21. class Source(object):
  22. def __init__(self):
  23. self.name = "ltc"
  24. self.token = ""
  25. self.api_url = "https://manstv.lattelecom.tv/api/v1.3/get/"
  26. cur_directory = os.path.dirname(os.path.abspath(__file__))
  27. config_file = os.path.join(cur_directory,"ltc.cfg")
  28. config = ConfigParser.ConfigParser()
  29. if os.path.exists(config_file):
  30. config.read(config_file)
  31. self.user = config.get("ltc","user")
  32. self.password = config.get("ltc","password")
  33. else:
  34. self.user = ""
  35. self.password = ""
  36. #self.login()
  37. def get_content(self, data):
  38. print "[ltc] get_content:", data
  39. if "::" in data:
  40. data = data.split("::")[1]
  41. path = data.split("?")[0]
  42. clist = path.split("/")[0]
  43. params = data[data.find("?"):] if "?" in data else ""
  44. qs = dict(map(lambda x:x.split("="),re.findall("\w+=\w+",params)))
  45. #lang = qs["lang"] if "lang" in qs else self.country
  46. content=[]
  47. content.append(("..return", "back","","Return back"))
  48. if clist=="home":
  49. content.extend([
  50. ("Live streams", "ltc::tv/channels","","TV live streams"),
  51. ("Archive", "ltc::arhivs","","TV live archive"),
  52. ("Video", "ltc::videonoma","","Video on demand"),
  53. ])
  54. return content
  55. ### Tiešraides kanānālu saraksts
  56. elif data=="tv/channels":
  57. if not self.check_logedin():
  58. self.login() # citādi nerāda TV3, LNT, TV6
  59. r= self.call(data)
  60. for item in re.findall(r'(?i)/(tiesraide/[^"]*?)"><div title="([^"]*?)" class="channel-placeholder" style="width: 131px; height: 131px; background-image:url\(/(.+?\.png)\).+?rinfo">([^<]+)</span><span class="info_time">([^<]+)</span>', r):
  61. ch = item[0]
  62. title = item[1]
  63. data2 = item[0]
  64. img = "https://m.lattelecom.tv/"+item[2].replace("105x105","150x150")
  65. desc = "%s\n%s"%(item[3],item[4])
  66. content.append((title,self.name+"::"+data2,img,desc))
  67. return content
  68. ### Kanāla tiesraide
  69. elif clist == "tiesraide" and "/" in data:
  70. ch = data.split("/")[1]
  71. if not self.check_logedin():
  72. if not self.login():
  73. content=("Can not login\nPlease check lattelecom.tv username/password in\n/usr/lib/enigma2/python/Plugins/Extensions/sources/ltc.cfg file","","","No stream found. Please check lattelecom.tv username/password in sources/ltc.cfg file ")
  74. return content
  75. r = self.call("tiesraide")
  76. m = re.search('/%s"><div title="([^"]*?)".+?rinfo">(.+?)</span><span class="info_time">(.+?)</span>'%data, r, re.IGNORECASE)
  77. if m:
  78. title = "%s - %s (%s)"%(m.group(1),m.group(2),m.group(3))
  79. else:
  80. title = ch.upper()
  81. desc = title
  82. data2 = self.get_tv_url(ch)
  83. if not data2:
  84. content=("No stream found for '%s'"%data,"","","No stream found")
  85. return content
  86. content = (title,data2,"",desc)
  87. return content
  88. ### Arhīva kanānālu saraksts
  89. elif data=="arhivs":
  90. r= self.call(data)
  91. for item in re.findall(r'(?i)/(arhivs/[^"]+)".+?<div title="([^"]*?)".+?background-image:url\(/(.+?\.png)\)', r):
  92. ch = item[0]
  93. title = item[1]
  94. data2 = item[0]
  95. img = "https://m.lattelecom.tv/"+item[2].replace("105x105","150x150")
  96. desc = "%s 7 dienu arhīvs"%title
  97. content.append((title,self.name+"::"+data2,img,desc))
  98. return content
  99. ### Arhīva datumi
  100. elif clist=="arhivs" and len(data.split("/"))==2:
  101. ch = data.split("/")[1]
  102. r= self.call(data)
  103. m = re.search('class="spac no_select">([^<]+)</span>', r, re.IGNORECASE)
  104. if m:
  105. ch_name = m.group(1)
  106. else:
  107. ch_name = ""
  108. today = datetime.date.today()
  109. for i in range(7):
  110. date = today-datetime.timedelta(i)
  111. title = ch_name + " - " + date.strftime("%d.%m.%Y")
  112. data2 = "%s/%s"%(data,date.strftime("%Y-%m-%d"))
  113. img = ""
  114. desc = title
  115. content.append((title,self.name+"::"+data2,img,desc))
  116. return content
  117. ### Arhīva dienas raidijumi
  118. elif clist=="arhivs" and len(data.split("/"))==3:
  119. ch = data.split("/")[1]
  120. date = data.split("/")[2]
  121. r= self.call(data)
  122. m = re.search('class="spac no_select">([^<]+)</span>', r, re.IGNORECASE)
  123. if m:
  124. ch_name = m.group(1)
  125. else:
  126. ch_name = ""
  127. for item in re.findall('(?i)href="/([^"]+?)" id="" class="archive_programm_a"><div class="archive_programm "><div class="chanel_time"><span>([^<]+)</span></div><div class="archive_programm_one"><span>([^<]+)', r):
  128. title = "%s - %s"%(item[1],item[2])
  129. data2 = item[0]
  130. img = ""
  131. desc = "%s (%s)\n%s"%(ch_name,date,title)
  132. content.append((title,self.name+"::"+data2,img,desc))
  133. return content
  134. ### Arhīva video
  135. elif clist=="arhivs" and len(data.split("/"))==4:
  136. ch = data.split("/")[1]
  137. video_id=data.split("/")[-1]
  138. if not self.check_logedin():
  139. if not self.login():
  140. content=("Can not login\nPlease check lattelecom.tv username/password in\n/usr/lib/enigma2/python/Plugins/Extensions/sources/ltc.cfg file","","","No stream found. Please check lattelecom.tv username/password in sources/ltc.cfg file ")
  141. return content
  142. data2 = self.get_arhivs_url(video_id)
  143. if not data2:
  144. content=("No stream found for '%s'"%data,"","","No stream found")
  145. return content
  146. r = self.call(data)
  147. m = re.search('<div class="name">([^<]+)</div><div class="channell">([^<]+)</div><div class="bcastinfo"><span>([^<]+)</span><span>([^<]+)</span><span>([^<]+)<', r, re.IGNORECASE)
  148. if m:
  149. title = "%s (%s %s %s %s)"%(m.group(1),m.group(2),m.group(3),m.group(4),m.group(5))
  150. else:
  151. title = ""
  152. desc = title
  153. content = (title,data2,"",desc)
  154. return content
  155. ### Videonoma galvenā
  156. elif data=="videonoma":
  157. content.extend([
  158. ("Filmas - jaunākās", "ltc::videonoma?page=0&genre=all_movies&sorts=laiks&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/media/features/2013-12-17/aa3b_videonoma_dropdown_filmas.png","Jaunākās filmas"),
  159. ("Filmas - pēc nosaukuma", "ltc::videonoma?page=0&genre=all_movies&sorts=title&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/media/features/2013-12-17/aa3b_videonoma_dropdown_filmas.png","Filmas pēc nosaukuma"),
  160. ("Filmas - latviski", 'ltc::videonoma?page=0&genre=all_movies&sorts=title&cnt=40&clear=true&filter={"valoda":["lv"]}',"https://www.lattelecom.tv/media/features/2013-12-17/aa3b_videonoma_dropdown_filmas.png","Filmas latviešu valodā"),
  161. ("Filmas - pēc reitinga", "ltc::videonoma?page=0&genre=all_movies&sorts=imbd&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/media/features/2013-12-17/aa3b_videonoma_dropdown_filmas.png","Filmas pēc IMBD reitinga"),
  162. ("Bērniem - jaunākās", "ltc::videonoma?page=0&genre=3&sorts=laiks&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/images/redesign/videonoma_dropdown_berniem.png","Jaunākie bernu video"),
  163. ("Bērniem - pēc nosaukuma", "ltc::videonoma?page=0&genre=3&sorts=title&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/images/redesign/videonoma_dropdown_berniem.png","Bērnu video pēc nosaukuma"),
  164. ("Bērniem - latviski", 'ltc::videonoma?page=0&genre=3&sorts=title&cnt=40&clear=true&filter={"valoda":[\"lv\"]}',"https://www.lattelecom.tv/images/redesign/videonoma_dropdown_berniem.png","Bērnu video latviski"),
  165. ("Bērniem - pēc reitinga", "ltc::videonoma?page=0&genre=3&sorts=imbd&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/images/redesign/videonoma_dropdown_berniem.png","Bērnu video pēc IMBD reitinga"),
  166. ("Sērijas - jaunākās", "ltc::videonoma?page=0&genre=27&sorts=laiks&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/images/redesign/videonoma_dropdown_raidijumi.png","Jaunākās sērijas"),
  167. ("Sērijas - animācijas", "ltc::videonoma?page=0&genre=27&sorts=title&cnt=40&clear=true&filter={\"zanrs\":[\"201\"]}","https://www.lattelecom.tv/images/redesign/videonoma_dropdown_raidijumi.png","Animācijas serijas"),
  168. ("Sērijas - pēc nosaukuma", "ltc::videonoma?page=0&genre=27&sorts=title&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/images/redesign/videonoma_dropdown_raidijumi.png","Sērijas pēc pēc nosaukuma"),
  169. ("Sērijas - latviski", 'ltc::videonoma?page=0&genre=27&sorts=title&cnt=40&clear=true&filter={"valoda":["lv"]}',"https://www.lattelecom.tv/images/redesign/videonoma_dropdown_raidijumi.png","Sērijas latviski"),
  170. ("Koncerti - jaunākie", "ltc::videonoma?page=0&genre=19&sorts=laiks&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/images/redesign/videonoma_dropdown_koncerti.png","Jaunākie koncerti"),
  171. ("Koncerti - pēc nosaukuma", "ltc::videonoma?page=0&genre=19&sorts=title&cnt=40&clear=true&filter={}","https://www.lattelecom.tv/images/redesign/videonoma_dropdown_koncerti.png","Koncerti pēc pēc nosaukuma"),
  172. ])
  173. return content
  174. ### Videonomas saraksti
  175. elif path == "videonoma":
  176. url = "https://www.lattelecom.tv/movies-snippet.json"+params
  177. r = self._http_request(url,self.headers2)
  178. if not r:
  179. return content
  180. js = json.loads(r,"utf8")
  181. if not r:
  182. return content
  183. for item in js["movies"]:
  184. title = item["title"].encode("utf8")
  185. data2 = item["url"][1:].encode("utf8")
  186. if data2[-1]=="/": data2=data2[:-1]
  187. if "/raidijumi/" in data2:
  188. data2 += "?series"
  189. img = "https://www.lattelecom.tv"+item["image"].encode("utf8")
  190. desc = "%s\n%s"%(title,item["genre"].encode("utf8"))
  191. content.append((title,self.name+"::"+data2,img,desc))
  192. m = re.search("page=(\d+)",data)
  193. if m:
  194. page = int(m.group(1))
  195. data2 = re.sub("page=\d+","page=%s"%(page+1),data)
  196. content.append(("Next page",self.name+"::"+data2,"","Go to next page"))
  197. return content
  198. ### Sērijas
  199. elif clist=="videonoma" and params=="?series":
  200. url = "https://www.lattelecom.tv/"+path
  201. r = self._http_request(url,self.headers2)
  202. if not r:
  203. return content
  204. m = re.search('<div class="movie_details"><div class="movie_titles"><div class="en">([^<]+?)</div>', r, re.DOTALL | re.IGNORECASE)
  205. if m:
  206. raidijums = m.group(1) + " - "
  207. else:
  208. raidijums = ""
  209. for item in re.findall('(?si)<a class="elementxxx forward-link[^"]*" href="([^"]+)">.*?<img src="([^"]+)" class="img"><span class="titlez">([^<]+)</span><span class="epizode_number">([^<]+)</span>', r):
  210. title = "%s%s (%s)"%(raidijums,item[2],item[3])
  211. data2 = item[0][1:]
  212. img = "https://www.lattelecom.tv"+item[1]
  213. desc = title
  214. content.append((title,self.name+"::"+data2,img,desc))
  215. return content
  216. ### Videonomas video
  217. elif clist=="videonoma" and len(data.split("/"))>1:
  218. ch = data.split("/")[1]
  219. video_id=data[data.find("/")+1:]
  220. #video_id=data.split("/")[-1]
  221. if not self.check_logedin():
  222. if not self.login():
  223. content=("Can not login\nPlease check lattelecom.tv username/password in\n/usr/lib/enigma2/python/Plugins/Extensions/sources/ltc.cfg file","","","No stream found. Please check lattelecom.tv username/password in sources/ltc.cfg file ")
  224. return content
  225. data2 = self.get_noma_url(video_id)
  226. if not data2:
  227. content=("No stream found for '%s'"%data,"","","No stream found")
  228. return content
  229. r = self.call(data)
  230. m = re.search('<span class="movie">([^<]+)<', r, re.IGNORECASE)
  231. if m:
  232. title = m.group(1)
  233. else:
  234. title = ""
  235. desc = title
  236. content = (title,data2,"",desc)
  237. return content
  238. else:
  239. return content
  240. def is_video(self,data):
  241. if "::" in data:
  242. data = data.split("::")[1]
  243. cmd = data.split("/")
  244. if cmd[0] in ("tiesraide") and "/" in data:
  245. return True
  246. elif cmd[0]=="arhivs" and len(cmd)==4:
  247. return True
  248. elif cmd[0]=="videonoma" and len(cmd)==3 and not "?" in data:
  249. return True
  250. else:
  251. return False
  252. def call(self, data,params = None, headers=None):
  253. if not headers: headers = self.headers
  254. #if not lang: lang = self.country
  255. url = self.api_url + data
  256. content = self._http_request(url,params, headers)
  257. if content:
  258. try:
  259. result = json.loads(content)
  260. if "status" in result and result["status"]=="ok":
  261. return result
  262. else:
  263. return None
  264. except Exception, ex:
  265. return None
  266. else:
  267. return result
  268. def _http_request(self, url,params = None, headers=None):
  269. if not headers: headers = self.headers
  270. try:
  271. r = urllib2.Request(url, data=params, headers=headers)
  272. u = urllib2.urlopen(r)
  273. content = u.read()
  274. u.close()
  275. return content
  276. except Exception as ex:
  277. return None
  278. def login(self,user="",password=""):
  279. """Login in to site, get token"""
  280. if not user: user=self.user
  281. if not password: password = self.password
  282. # Dabūjam tokenu
  283. url = "https://manstv.lattelecom.tv/api/v1.3/post/user/login"
  284. params = "uid=7f777e938d35e017&password=%s&username=%s&"%(password,user)
  285. headers = headers2dict("""
  286. Content-Type: application/x-www-form-urlencoded; charset=UTF-8
  287. User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.4.2; SM-G900FD Build/KOT49H)
  288. Host: manstv.lattelecom.tv
  289. """ )
  290. try:
  291. r = urllib2.Request(url, data=params, headers=headers)
  292. u = urllib2.urlopen(r)
  293. content = u.read()
  294. u.close()
  295. except Exception as ex:
  296. return None
  297. #r = self.call(data, params)
  298. if r and "token" in content:
  299. self.token=re.search('"token":"(.+?)"', content).group(1)
  300. return True
  301. else:
  302. return False
  303. def refresh_token(self):
  304. data = "user/refresh-token//%s"%self.token
  305. r = self.call(data)
  306. if 'token' in r:
  307. self.token = r["token"]
  308. return True
  309. else:
  310. self.token = ""
  311. return False
  312. def check_logedin(self):
  313. if not self.token:
  314. return False
  315. else:
  316. if self.refresh_token():
  317. return True
  318. else:
  319. return False
  320. def is_logedin(self):
  321. if self.token:
  322. return True
  323. else:
  324. return False
  325. def get_tv_channels(self,):
  326. """Get tv channels list"""
  327. url = "https://m.lattelecom.tv/tiesraide"
  328. response = urllib2.urlopen(urllib2.Request(url, headers=self.headers))
  329. html = response.read()
  330. channels = re.findall(r'(?si)data-url="/tiesraide/(.*?)"><div title="(.*?)" class="channel-placeholder" style="width: 131px; height: 131px; background-image:url\(/media/imse/105x105s/channels/(.*?)\)', html)
  331. for i in range(len(channels)):
  332. channels[i]=[channels[i][0],channels[i][1],"https://m.lattelecom.tv/media/imse/100x100s/channels/"+channels[i][2]]
  333. return channels
  334. #----------------------------------------------------------------------
  335. def get_tv_url(self,video_id):
  336. """Get m3u8 url for given live tv channel"""
  337. url = "https://m.lattelecom.tv/tiesraide/%s"%video_id
  338. data = self.get_video_data("tiesraide/%s"%video_id)
  339. headers = self.headers
  340. headers["Cookie"] = "%s; %s; _hjIncludedInSample=0; MobBitr=1; MobRentBitr=%s; MobRentLang=%s;"%(self.session_id,self.mobtv_cache,data["quality"],data["language"])
  341. response = urllib2.urlopen(urllib2.Request(url, headers=headers))
  342. html = response.read()
  343. m3u8 = re.search('x-mpegURL" src="(.*?)"', html).group(1) if "x-mpegURL" in html else ""
  344. return unescape(m3u8)
  345. #----------------------------------------------------------------------
  346. def get_noma_url(self,video_id,quality="hq",language="lv"):
  347. """Get m3u8 url for given rental video"""
  348. video_id1,video_id2=video_id.split("/")
  349. data = self.get_video_data(video_id)
  350. url = "https://m.lattelecom.tv/free_origin?show_origin=1&type=4&video_url=%s&bitrate=%s&lng=%s"%(video_id2,data["quality"],data["language"])
  351. headers = self.headers
  352. headers["Cookie"] = "%s; %s; MobRentBitr=%s; MobBitr=1; MobRentLang=%s"%(self.session_id,self.mobtv_cache,quality,language)
  353. response = urllib2.urlopen(urllib2.Request(url, headers=headers))
  354. m3u8 = response.read()
  355. return unescape(m3u8)
  356. #----------------------------------------------------------------------
  357. def get_arhivs_url(self,video_id):
  358. """Get m3u8 url for given archive video"""
  359. #data = self.get_video_data("arhivs/%s"%video_id)
  360. url = "https://m.lattelecom.tv/free_origin?show_origin=1&type=arhivs&event_id=%s&bitrate=mhq"%(video_id) #,data["quality"])
  361. headers = self.headers
  362. headers["Cookie"] = "%s; %s; MobBitr=1; "%(self.session_id,self.mobtv_cache)
  363. response = urllib2.urlopen(urllib2.Request(url, headers=headers))
  364. m3u8 = response.read()
  365. return unescape(m3u8)
  366. def get_video_data(self,video_id):
  367. url = "https://www.lattelecom.tv/xmls/%s.xml"%video_id
  368. headers = self.headers2
  369. headers["Cookie"] = self.session_id
  370. #headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
  371. response = urllib2.urlopen(urllib2.Request(url, headers=headers))
  372. r = response.read()
  373. data = {}
  374. data["server"] = re.findall("(?s)<origin>([^<]+)</origin>", r)[1]
  375. data["language"]=re.findall('(?s)<language code="([^"]+)">', r)
  376. data["language"]="lv" if "lv" in data["language"] else "ru" if "ru" in data["language"] else "en"
  377. data["qs"]=re.findall('(?s)<stream quality="([^"]+)">([^<]+)</stream>', r)
  378. data["qs"]=dict(data["qs"])
  379. qs = data["qs"].keys()
  380. data["quality"] = "hd" if "hd" in qs else "hq" if "hq" in qs else "mhq" if "mhq" in qs else "lq"
  381. data["mp4"] = data["qs"][data["quality"]]
  382. data["token"] = re.search("(?s)<auth_token>([^<]+)</auth_token>", r).group(1)
  383. data["resource_id"]=re.search("(?s)<resource_id>([^<]+)</resource_id>", r).group(1)
  384. data["server"]=self.load_balancer(data["server"])
  385. data["hls"] = "http://%s/mobile-vod/%s/playlist.m3u8?resource_id=%s&auth_token=%s"%(data["server"],data["mp4"],data["resource_id"],data["token"])
  386. #data["hls"]="http://%s/mobile-vod/mp4:%s/playlist.m3u8?resource_id=%s&auth_token=app_%s"%(data["server"],data["mp4"],data["resource_id"],data["token"])
  387. return data
  388. def load_balancer(self,server,streams=[]):
  389. headers = headers2dict("""
  390. Connection: keep-alive
  391. User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
  392. X-Requested-With: ShockwaveFlash/21.0.0.242
  393. """)
  394. url = "http://%s/loadbalancer"%server
  395. response = urllib2.urlopen(urllib2.Request(url, headers=headers))
  396. r = response.read()
  397. statuss = re.search("<status>(\d+)</status>",r).group(1)
  398. edge = re.search("<edge>([^<>]+)</edge>",r).group(1)
  399. return edge
  400. if __name__ == "__main__":
  401. c = Source()
  402. print c.login("ivars777","kaskade7")
  403. print c.refresh_token(c.token)
  404. vid = "animation/ultimate_avengers_ii"
  405. data = c.get_video_data(vid)
  406. print data
  407. print data["hls"]
  408. if len(sys.argv)>1:
  409. data= sys.argv[1]
  410. else:
  411. data = "home"
  412. content = c.get_content(data)
  413. for item in content:
  414. print item
  415. #cat = api.get_categories(country)
  416. #chan = api.get_channels("lv")
  417. #prog = api.get_programs(channel=6400)
  418. #prog = api.get_programs(category=55)
  419. #seas = api.get_seasons(program=6453)
  420. #str = api.get_streams(660243)
  421. #res = api.get_videos(802)
  422. #formats = api.getAllFormats()
  423. #det = api.detailed("1516")
  424. #vid = api.getVideos("13170")
  425. pass