Ivars 6 anni fa
parent
commit
1b7f5f54de
2 ha cambiato i file con 505 aggiunte e 728 eliminazioni
  1. 493
    717
      project.wpr
  2. 12
    11
      sources/replay.py

+ 493
- 717
project.wpr
File diff soppresso perché troppo grande
Vedi File


+ 12
- 11
sources/replay.py Vedi File

5
 # Copyright (c) 2016 ivars777 (ivars777@gmail.com)
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
6
 # Distributed under the GNU GPL v3. For full terms see http://www.gnu.org/licenses/gpl-3.0.en.html
7
 #
7
 #
8
+
8
 try:
9
 try:
9
     import json
10
     import json
10
 except:
11
 except:
19
 from SourceBase import SourceBase
20
 from SourceBase import SourceBase
20
 import util
21
 import util
21
 
22
 
22
-API_URL = 'http://replay.lsm.lv/%s/'
23
+API_URL = 'https://replay.lsm.lv/%s/'
23
 headers2dict = lambda  h: dict([l.strip().split(": ") for l in h.strip().splitlines()])
24
 headers2dict = lambda  h: dict([l.strip().split(": ") for l in h.strip().splitlines()])
24
 headers0 = headers2dict("""
25
 headers0 = headers2dict("""
25
 User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
26
 User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
73
 
74
 
74
         ### programmu kategorijas ###
75
         ### programmu kategorijas ###
75
         elif clist=="categories":
76
         elif clist=="categories":
76
-            url = "http://replay.lsm.lv/lv/raidijumi/?lang=lv&type=video" if lang =="lv" else "http://replay.lsm.lv/ru/peredachi/?lang=ru&type=video"
77
+            url = "https://replay.lsm.lv/lv/raidijumi/?lang=lv&type=video" if lang =="lv" else "https://replay.lsm.lv/ru/peredachi/?lang=ru&type=video"
77
             r = self._http_request(url)
78
             r = self._http_request(url)
78
             icons = {
79
             icons = {
79
                 #TODO
80
                 #TODO
91
 
92
 
92
         ### jaunāko raidijumu kategorijas ###
93
         ### jaunāko raidijumu kategorijas ###
93
         elif clist=="kategorijas":
94
         elif clist=="kategorijas":
94
-            url = "http://replay.lsm.lv/lv/" if lang =="lv" else "http://replay.lsm.lv/ru/"
95
+            url = "https://replay.lsm.lv/lv/" if lang =="lv" else "https://replay.lsm.lv/ru/"
95
             r = self._http_request(url)
96
             r = self._http_request(url)
96
             for item in re.findall(r'<a href="/(lv|ru)/kategorija/(\w+)/">.+?<i class="[^"]+"></i>.+?<span>([^<]+)</span>', r, re.DOTALL):
97
             for item in re.findall(r'<a href="/(lv|ru)/kategorija/(\w+)/">.+?<i class="[^"]+"></i>.+?<span>([^<]+)</span>', r, re.DOTALL):
97
                 title = item[2]
98
                 title = item[2]
103
 
104
 
104
         ### Tiešraides kanānālu saraksts
105
         ### Tiešraides kanānālu saraksts
105
         elif path=="tiesraide":
106
         elif path=="tiesraide":
106
-            url2 = "http://replay.lsm.lv/styles/main.css"
107
+            url2 = "https://replay.lsm.lv/styles/main.css"
107
             r2= self._http_request(url2)
108
             r2= self._http_request(url2)
108
-            url = "http://replay.lsm.lv/lv/tiesraide/ltv1/"
109
+            url = "https://replay.lsm.lv/lv/tiesraide/ltv1/"
109
             # <div class="visible-xs">
110
             # <div class="visible-xs">
110
             r= self._http_request(url)
111
             r= self._http_request(url)
111
             i2 = r.find('<div class="visible-xs">')
112
             i2 = r.find('<div class="visible-xs">')
115
                 ch = data2.split("/")[1]
116
                 ch = data2.split("/")[1]
116
                 title = ch.upper()
117
                 title = ch.upper()
117
                 m = re.search(r'channel-logo--%s{background-image:url\("([^"]+)"\)' % ch, r2, re.DOTALL)
118
                 m = re.search(r'channel-logo--%s{background-image:url\("([^"]+)"\)' % ch, r2, re.DOTALL)
118
-                img = "http://replay.lsm.lv" + m.group(1)
119
+                img = "https://replay.lsm.lv" + m.group(1)
119
                 desc = item[1]
120
                 desc = item[1]
120
                 # 00:10 &ndash; 00:45
121
                 # 00:10 &ndash; 00:45
121
                 desc = desc + " (%s)" % item[2].replace("&ndash;", "-")
122
                 desc = desc + " (%s)" % item[2].replace("&ndash;", "-")
127
         elif clist == "tiesraide" and "/" in data:
128
         elif clist == "tiesraide" and "/" in data:
128
             ch = data.split('/')[1]
129
             ch = data.split('/')[1]
129
             veids = "audio" if "lr" in ch else "video"
130
             veids = "audio" if "lr" in ch else "video"
130
-            #url = "http://replay.lsm.lv/lv/tiesraide/ltv7/"
131
-            url = "http://replay.lsm.lv/lv/tiesraide/%s/"%ch
131
+            #url = "https://replay.lsm.lv/lv/tiesraide/ltv7/"
132
+            url = "https://replay.lsm.lv/lv/tiesraide/%s/"%ch
132
             r= self._http_request(url)
133
             r= self._http_request(url)
133
 
134
 
134
             m = re.search('%s/">.+?<h5>([^<]+)+</h5>.*?<time>([^<]+)</time>'%ch, r, re.DOTALL)
135
             m = re.search('%s/">.+?<h5>([^<]+)+</h5>.*?<time>([^<]+)</time>'%ch, r, re.DOTALL)
146
                 url = m.group(1)
147
                 url = m.group(1)
147
                 headers = headers2dict("""
148
                 headers = headers2dict("""
148
             User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
149
             User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
149
-            Referer: http://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-gatavojas-referendumam-par-tu/
150
+            Referer: https://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-gatavojas-referendumam-par-tu/
150
                     """)
151
                     """)
151
                 r = self._http_request(url,headers=headers)
152
                 r = self._http_request(url,headers=headers)
152
 
153
 
195
             for item in re.findall('itemprop="image" data-image="([^"]+)".+?<figcaption><h5 itemprop="name"><a itemprop="url" href="([^<]+)">([^<]+)</a></h5></figcaption>', r):
196
             for item in re.findall('itemprop="image" data-image="([^"]+)".+?<figcaption><h5 itemprop="name"><a itemprop="url" href="([^<]+)">([^<]+)</a></h5></figcaption>', r):
196
                 title = item[2]
197
                 title = item[2]
197
                 data2 = item[1].replace("/%s/"%lang,"")+"?lang=%s"%lang
198
                 data2 = item[1].replace("/%s/"%lang,"")+"?lang=%s"%lang
198
-                img = "http://replay.lsm.lv" + item[0]
199
+                img = "https://replay.lsm.lv" + item[0]
199
                 desc  = title
200
                 desc  = title
200
                 content.append((title,self.name+"::"+data2,img,desc))
201
                 content.append((title,self.name+"::"+data2,img,desc))
201
 
202
 
256
 
257
 
257
                 headers = headers2dict("""
258
                 headers = headers2dict("""
258
 User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
259
 User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
259
-Referer: http://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-gatavojas-referendumam-par-tu/
260
+Referer: https://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-gatavojas-referendumam-par-tu/
260
             """)
261
             """)
261
                 r2 = self._http_request(url2,headers=headers)
262
                 r2 = self._http_request(url2,headers=headers)
262
                 m = re.search('"file":"([^"]+)', r2)
263
                 m = re.search('"file":"([^"]+)', r2)