Ivars пре 6 година
родитељ
комит
1b7f5f54de
2 измењених фајлова са 505 додато и 728 уклоњено
  1. 493
    717
      project.wpr
  2. 12
    11
      sources/replay.py

+ 493
- 717
project.wpr
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 12
- 11
sources/replay.py Прегледај датотеку

@@ -5,6 +5,7 @@
5 5
 # Copyright (c) 2016 ivars777 (ivars777@gmail.com)
6 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 9
 try:
9 10
     import json
10 11
 except:
@@ -19,7 +20,7 @@ if "_create_unverified_context" in dir(ssl):
19 20
 from SourceBase import SourceBase
20 21
 import util
21 22
 
22
-API_URL = 'http://replay.lsm.lv/%s/'
23
+API_URL = 'https://replay.lsm.lv/%s/'
23 24
 headers2dict = lambda  h: dict([l.strip().split(": ") for l in h.strip().splitlines()])
24 25
 headers0 = headers2dict("""
25 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,7 +74,7 @@ class Source(SourceBase):
73 74
 
74 75
         ### programmu kategorijas ###
75 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 78
             r = self._http_request(url)
78 79
             icons = {
79 80
                 #TODO
@@ -91,7 +92,7 @@ class Source(SourceBase):
91 92
 
92 93
         ### jaunāko raidijumu kategorijas ###
93 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 96
             r = self._http_request(url)
96 97
             for item in re.findall(r'<a href="/(lv|ru)/kategorija/(\w+)/">.+?<i class="[^"]+"></i>.+?<span>([^<]+)</span>', r, re.DOTALL):
97 98
                 title = item[2]
@@ -103,9 +104,9 @@ class Source(SourceBase):
103 104
 
104 105
         ### Tiešraides kanānālu saraksts
105 106
         elif path=="tiesraide":
106
-            url2 = "http://replay.lsm.lv/styles/main.css"
107
+            url2 = "https://replay.lsm.lv/styles/main.css"
107 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 110
             # <div class="visible-xs">
110 111
             r= self._http_request(url)
111 112
             i2 = r.find('<div class="visible-xs">')
@@ -115,7 +116,7 @@ class Source(SourceBase):
115 116
                 ch = data2.split("/")[1]
116 117
                 title = ch.upper()
117 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 120
                 desc = item[1]
120 121
                 # 00:10 &ndash; 00:45
121 122
                 desc = desc + " (%s)" % item[2].replace("&ndash;", "-")
@@ -127,8 +128,8 @@ class Source(SourceBase):
127 128
         elif clist == "tiesraide" and "/" in data:
128 129
             ch = data.split('/')[1]
129 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 133
             r= self._http_request(url)
133 134
 
134 135
             m = re.search('%s/">.+?<h5>([^<]+)+</h5>.*?<time>([^<]+)</time>'%ch, r, re.DOTALL)
@@ -146,7 +147,7 @@ class Source(SourceBase):
146 147
                 url = m.group(1)
147 148
                 headers = headers2dict("""
148 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 152
                 r = self._http_request(url,headers=headers)
152 153
 
@@ -195,7 +196,7 @@ class Source(SourceBase):
195 196
             for item in re.findall('itemprop="image" data-image="([^"]+)".+?<figcaption><h5 itemprop="name"><a itemprop="url" href="([^<]+)">([^<]+)</a></h5></figcaption>', r):
196 197
                 title = item[2]
197 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 200
                 desc  = title
200 201
                 content.append((title,self.name+"::"+data2,img,desc))
201 202
 
@@ -256,7 +257,7 @@ class Source(SourceBase):
256 257
 
257 258
                 headers = headers2dict("""
258 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 262
                 r2 = self._http_request(url2,headers=headers)
262 263
                 m = re.search('"file":"([^"]+)', r2)