Showing 4 changed files with 51 additions and 20 deletions
+1
config.json
... ...
@@ -6,6 +6,7 @@
6 6
     "csvTemp": "output.temp",
7 7
     "debug": 0,
8 8
     "logfile": "output.log",
9
+    "favorite": "favorite.txt",
9 10
     "name": "Proxy",
10 11
     "port": 8080,
11 12
     "version": "1.0",
+4
configuration.py
... ...
@@ -42,6 +42,7 @@ default_config = {
42 42
     "port": 8080,
43 43
     "address": "0.0.0.0",
44 44
     "logfile": "output.log",
45
+    "favorite": "favorite.txt",
45 46
     "csv": "output.csv",
46 47
     "csvTemp": "output.temp",
47 48
     "csvMax": 10,
... ...
@@ -59,6 +60,9 @@ def get_debug():
59 60
 def get_logfile():
60 61
     return server['logfile']
61 62
     
63
+def get_favorite():
64
+    return server['favorite']
65
+    
62 66
 def get_pageBegin():
63 67
     return server['pageStart']
64 68
     
+45 -20
mangaProxy.py
... ...
@@ -60,11 +60,16 @@ def completedManganeloTV(genre):
60 60
 
61 61
 def getManganeloTV(url):
62 62
   debug("Downloading: "+url)
63
-  if "manganelo.com" in url:
64
-    url=url.replace("manganelo.com","manganelo.tv")
65
-    say("Replace URL:"+url)
63
+  #if "manganelo.com" in url:
64
+  #  url=url.replace("manganelo.com","manganelo.tv")
65
+  #  say("Replace URL:"+url)
66 66
   r = requests.get(url, allow_redirects=True)
67 67
   content = r.text
68
+
69
+  isMangakakalot = 0
70
+  if "mangakakalot.com" in url:
71
+    isMangakakalot = 1
72
+
68 73
   #print(r.text)
69 74
   lineNextChapter = None
70 75
   linePreviousChapter = None
... ...
@@ -76,10 +81,21 @@ def getManganeloTV(url):
76 81
     if "navi-change-chapter-btn-prev a-h" in line and linePreviousChapter is None:
77 82
       linePreviousChapter = line
78 83
     elif "navi-change-chapter-btn-next a-h" in line and lineNextChapter is None:
79
-      # ~ print("Found at"+str(line))
84
+      print("Found at"+str(line))
80 85
       lineNextChapter = line
86
+
81 87
     elif "<meta property=\"og:title\" content=\"" in line and lineTitle is None:
82 88
       lineTitle = line
89
+
90
+    elif isMangakakalot == 1 and "<div class='btn-navigation-chap'>" in line and lineNextChapter is None and linkNext is None:
91
+      for subLine in line.split("><"):
92
+        if "NEXT CHAPTER" in subLine:
93
+          linkNext=subLine.split("'")[1]
94
+    elif isMangakakalot == 1 and "<div class='btn-navigation-chap'>" in line and linePreviousChapter is None and linkPrev is None:
95
+      for subLine in line.split("><"):
96
+        if "PREV CHAPTER" in subLine:
97
+          linkPrev=subLine.split("'")[1]
98
+
83 99
     elif "<img class=\"img-loading\" data-src=\"" in line:
84 100
       if ".jpg" in line:
85 101
         listImages.append(line.split("\"")[3])    
... ...
@@ -120,7 +136,10 @@ def getManganeloTV(url):
120 136
       linkNext="https://manganelo.tv"+lineNextChapter.split("\"")[5]
121 137
         
122 138
   mangaImagesNum = len(listImages)
123
-  mangaTitle=lineTitle.split("\"")[3].split(" - Manganelo")[0]
139
+  if not isMangakakalot:
140
+    mangaTitle=lineTitle.split("\"")[3].split(" - Manganelo")[0]
141
+  else:
142
+    mangaTitle=lineTitle.split("\"")[3].split(" - Mangakakalot.com")[0]
124 143
   say("Manga :"+mangaTitle)
125 144
   pageContent = ""
126 145
   pageContent += "<div class=\"mangaChapNavig\">\n"
... ...
@@ -130,8 +149,6 @@ def getManganeloTV(url):
130 149
   if linkNext is not None:
131 150
     pageContent += "  <div class=\"mangaChapNavigNext\"><a href=\"?url="+linkNext+"\"><div class=\"arrow-right\"></div><div class=\"arrow-right\"></div></a></div>\n"
132 151
   pageContent += "  <div class=\"mangaChapNavigHome\"><a href=\".\"><div class=\"arrow-up\"></div></a></div>\n"
133
-  #pageContent += "  <div class=\"mangaRead\" onclick=\"onArticle(0)\">&#x1F4D6;</div>\n"
134
-  #pageContent += "  <div class=\"mangaChapNavigHome\"><div class=\"arrow-down\" onclick=\"onArticle(0)\"></div><a></div>\n"
135 152
   pageContent += "  <span id=\"mangaCurrPage\"></span><span id=\"mangaNumPages\"> / "+str(mangaImagesNum)+"</span>\n"
136 153
   pageContent += "  <span id=\"mangaFSStatus\" style=\"display: none;\">0</span>\n"
137 154
   pageContent += "  <span id=\"mangaFSToggle\" onclick=\"openFullscreen();\"><div class=\"fs-on\"></div></span>\n"
... ...
@@ -142,8 +159,6 @@ def getManganeloTV(url):
142 159
   pageContent += "  <span id=\"mangaOpacityValue\">"+str(opacityValue)+"</span>"
143 160
   pageContent += "  <span id=\"mangaOpacityPlus\" onclick=\"onOpacityPlus()\">&#9728;</span>\n"
144 161
   pageContent += "  <span id=\"mangaReload\" onClick=\"window.location.reload();\"><div class=\"reload-circle\"></div></span>\n" 
145
-  #pageContent += "  <div class=\"column\" id=\"colLeft\" onclick=\"onArticle("+str(cpt-1)+")\">\n"
146
-  #pageContent += "  <div class=\"column\" id=\"colRight\" onclick=\"onArticle("+str(cpt+1)+")\">\n"
147 162
   pageContent += "</div>\n"
148 163
   
149 164
   pageContent += "<a name=\"article-top\"></a><div id=\"article-current\"></div>\n"
... ...
@@ -185,25 +200,23 @@ class MyServer(BaseHTTPRequestHandler):
185 200
         csvFilename = rootdir + server['csv']
186 201
         csvFilenameTemp = rootdir + server['csvTemp']
187 202
 
188
-        if '/genre.html' in self.path:
203
+        if '/list.html' in self.path:
189 204
             page=[]
190 205
             data_begin = ""
191 206
 
192
-            s = self.path
193
-            genre = None
194
-            if "genre" in s:
195
-                strGenre = "genre="
196
-                indexGenre = s.index(strGenre) 
197
-                genre = s[indexGenre+len(strGenre):len(s)] 
198
-            say(genre)
199
-
200 207
             with open(configuration.get_pageBegin(),'r') as fStart:
201 208
                 data_begin += fStart.read().replace( 'CSTAPPNAME', server['name'] )
202 209
             
203 210
             data_end = ""
204 211
             with open(configuration.get_pageEnd(),'r') as fEnd:
205 212
                 data_end += fEnd.read().replace( 'CSTAPPNAME', server['name'] ).replace( 'CSTAPPVERSION', server['version'] )
206
-            data_page = completedManganeloTV(genre)
213
+
214
+            data_page = ""
215
+            with open("list.html", "rt") as f:
216
+                lines=f.readlines()
217
+                for line in lines:
218
+                    data_page += "<li><a href=\"./?url="+line.split("@")[0]+"\">"+line.split("@")[1]+"</a></li>"
219
+                    f.close()
207 220
             page.append(data_begin)
208 221
             page.append(data_page)
209 222
             page.append(data_end)
... ...
@@ -248,10 +261,22 @@ class MyServer(BaseHTTPRequestHandler):
248 261
                     data_page += getManganeloTV(url)
249 262
                 elif "readmanganato.com" in url:
250 263
                     data_page += getManganeloTV(url)
264
+                elif "mangakakalot.com" in url:
265
+                    data_page += getManganeloTV(url)
251 266
                 else:
252
-                    date_page += "Unsupported hoster at "+url
267
+                    warn("Unsupported Hoster at "+url)
268
+                    data_page += "<span id=\"lbl\">Unsupported hoster at "+url+"</span>"
269
+                    data_page += "<div class=\"mangaChapNavigHome\"><a href=\".\"><div class=\"arrow-up\"></div></a></div>"
253 270
 
254 271
             else:
272
+                try:
273
+                    with open(server['favorite'], "rt") as f:
274
+                        lines=f.readlines()
275
+                        for line in lines:
276
+                            data_page += "<li><a href=\"./?url="+line+"\">"+line+"</a></li>"
277
+                        f.close()
278
+                except:
279
+                    pass
255 280
                 data_form = "<form action=\"\">\n\
256 281
 <span id=\"lbl\">Url:</span>\n\
257 282
 <input type=\"text\" id=\"srvIp\" name=\"url\" value=\"\">\n\
+1
start.sh
... ...
@@ -1,3 +1,4 @@
1 1
 #!/bin/bash
2
+cd /home/ycawidro/dev/mangaProxy
2 3
 screen -S manga python3 mangaProxy.py
3 4