| ... | ... |
@@ -17,52 +17,11 @@ from userio import * |
| 17 | 17 |
server = None |
| 18 | 18 |
csvFilename = None |
| 19 | 19 |
connectionResults = None |
| 20 |
- |
|
| 21 |
-def completedManganeloTV(genre): |
|
| 22 |
- if genre is None: |
|
| 23 |
- genre="" |
|
| 24 |
- url = "https://manganelo.tv/genre/"+genre+"?state=completed" |
|
| 25 |
- say("display by genre: ["+genre+"]")
|
|
| 26 |
- say(url) |
|
| 27 |
- pageContent = "" |
|
| 28 |
- pageContent += "<div class=\"mangaChapNavig\">\n" |
|
| 29 |
- pageContent += " <div class=\"mangaChapNavigHome\"><a href=\".\"><div class=\"arrow-up\"></div><a></div>\n" |
|
| 30 |
- pageContent += "</div>\n" |
|
| 31 |
- pageContent += "<div class=\"row\">\n" |
|
| 32 |
- if configuration.get_debug() != 0: |
|
| 33 |
- pageContent += "<p>Request: "+url+"</p>\n" |
|
| 34 |
- r = requests.get(url, allow_redirects=True) |
|
| 35 |
- content = r.text |
|
| 36 |
- #pageContent += content |
|
| 37 |
- articleCstBegin="<div class=\"panel-content-genres\">" |
|
| 38 |
- articleCstEnd="<div class=\"panel-page-number\">" |
|
| 39 |
- indexBegin = content.index(articleCstBegin) |
|
| 40 |
- indexEnd = content.index(articleCstEnd) |
|
| 41 |
- dataContent = content[indexBegin+len(articleCstBegin):indexEnd] |
|
| 42 |
- dataContent = re.sub(r"<span class=\"genres-item-time\">(.*?)</span>", '', dataContent) |
|
| 43 |
- dataContent = re.sub(r"<span class=\"genres-item-view\">(.*?)", '<span>', dataContent) |
|
| 44 |
- dataContent = re.sub(r"onerror=\"javascript:this.src='/res/img/404_not_found.webp';\" ", '', dataContent) |
|
| 45 |
- dataContent = re.sub(r"href=\"\/", 'href=\"//manganelo.tv/', dataContent) |
|
| 46 |
- dataContent = re.sub(r"src=\"\/", 'src=\"//manganelo.tv/', dataContent) |
|
| 47 |
- dataContent = re.sub(r"<a rel=\"nofollow\" class=\"genres-item-img\" href=\"", '<a target="new" href="', dataContent) |
|
| 48 |
- dataContent = re.sub(r"<a rel=\"nofollow\" class=\"genres-item-chap text-nowrap a-h\" href=\"", '<a target="new" href="./?url=https:', dataContent) |
|
| 49 |
- dataContent = re.sub(r"<a rel=\"nofollow\" class=\"genres-item-readmore\" href=\"(.*)\">Read more</a>", '', dataContent) |
|
| 50 |
- dataContent = re.sub(r"<i class=\"genres-item-description-linear\"></i>", '', dataContent) |
|
| 51 |
- dataContent = re.sub(r"<em class=\"genres-item-rate\">(.*)</em>", '', dataContent) |
|
| 52 |
- dataContent = re.sub(r"<span class=\"genres-item-author\">(.*?)</span>", '<p class="genres-item-description">\g<1></p>', dataContent) |
|
| 53 |
- dataContent = re.sub(r"<div class=\"genres-item-info\">", '<div>', dataContent) |
|
| 54 |
- dataContent = re.sub(r"<div class=\"content-genres-item\">", '<div class="content-genres-item"><hr>', dataContent) |
|
| 55 |
- dataContent = re.sub(r"<span>(.*),(.*)", '<span>', dataContent) |
|
| 56 |
- pageContent += "</div>\n" |
|
| 57 |
- pageContent += dataContent |
|
| 58 |
- |
|
| 59 |
- return pageContent |
|
| 20 |
+opacity = -1 |
|
| 60 | 21 |
|
| 61 | 22 |
def getReadManganatoCOM(url): |
| 62 |
- debug("getReadManganatoCOM: "+url)
|
|
| 63 |
- #if "manganelo.com" in url: |
|
| 64 |
- # url=url.replace("manganelo.com","manganelo.tv")
|
|
| 65 |
- # say("Replace URL:"+url)
|
|
| 23 |
+ global opacity |
|
| 24 |
+ say("getReadManganatoCOM: "+url)
|
|
| 66 | 25 |
r = requests.get(url, allow_redirects=True) |
| 67 | 26 |
content = r.text |
| 68 | 27 |
|
| ... | ... |
@@ -90,12 +49,8 @@ def getReadManganatoCOM(url): |
| 90 | 49 |
linkPrev=subLine.split("\"")[5]
|
| 91 | 50 |
elif "<img src=\"" in line: |
| 92 | 51 |
if ".jpg" in line: |
| 93 |
- #print("============="+line)
|
|
| 94 |
- #for subLine in line.split("><"):
|
|
| 95 | 52 |
for subLine in line.split("><img"):
|
| 96 |
- #print("============="+subLine)
|
|
| 97 | 53 |
if ".jpg" in subLine: |
| 98 |
- #print(line.split("\"")[1])
|
|
| 99 | 54 |
listImages.append(subLine.split("\"")[1])
|
| 100 | 55 |
debug(line.split("\"")[1])
|
| 101 | 56 |
|
| ... | ... |
@@ -140,11 +95,13 @@ def getReadManganatoCOM(url): |
| 140 | 95 |
pageContent += " <span id=\"mangaCurrPage\"></span><span id=\"mangaNumPages\"> / "+str(mangaImagesNum)+"</span>\n" |
| 141 | 96 |
pageContent += " <span id=\"mangaFSStatus\" style=\"display: none;\">0</span>\n" |
| 142 | 97 |
pageContent += " <span id=\"mangaFSToggle\" onclick=\"openFullscreen();\"><div class=\"fs-on\"></div></span>\n" |
| 143 |
- opacityValue=2; |
|
| 144 |
- if 7 <= datetime.datetime.now().hour and 20 >= datetime.datetime.now().hour: |
|
| 145 |
- opacityValue=10; |
|
| 98 |
+ if opacity == -1: |
|
| 99 |
+ opacityValue=2; |
|
| 100 |
+ if 7 <= datetime.datetime.now().hour and 20 >= datetime.datetime.now().hour: |
|
| 101 |
+ opacityValue=10; |
|
| 102 |
+ opacity=opacityValue |
|
| 146 | 103 |
pageContent += " <span id=\"mangaOpacityMinus\" onclick=\"onOpacityMinus()\">☼</span>" |
| 147 |
- pageContent += " <span id=\"mangaOpacityValue\">"+str(opacityValue)+"</span>" |
|
| 104 |
+ pageContent += " <span id=\"mangaOpacityValue\">"+str(opacity)+"</span>" |
|
| 148 | 105 |
pageContent += " <span id=\"mangaOpacityPlus\" onclick=\"onOpacityPlus()\">☀</span>\n" |
| 149 | 106 |
pageContent += " <span id=\"mangaReload\" onClick=\"window.location.reload();\"><div class=\"reload-circle\"></div></span>\n" |
| 150 | 107 |
pageContent += "</div>\n" |
| ... | ... |
@@ -177,6 +134,7 @@ def getReadManganatoCOM(url): |
| 177 | 134 |
return pageContent |
| 178 | 135 |
|
| 179 | 136 |
def getMangakakalotCom(url): |
| 137 |
+ global opacity |
|
| 180 | 138 |
debug("getMangakakalotCom :"+url)
|
| 181 | 139 |
r = requests.get(url, allow_redirects=True) |
| 182 | 140 |
content = r.text |
| ... | ... |
@@ -256,11 +214,13 @@ def getMangakakalotCom(url): |
| 256 | 214 |
pageContent += " <span id=\"mangaCurrPage\"></span><span id=\"mangaNumPages\"> / "+str(mangaImagesNum)+"</span>\n" |
| 257 | 215 |
pageContent += " <span id=\"mangaFSStatus\" style=\"display: none;\">0</span>\n" |
| 258 | 216 |
pageContent += " <span id=\"mangaFSToggle\" onclick=\"openFullscreen();\"><div class=\"fs-on\"></div></span>\n" |
| 259 |
- opacityValue=2; |
|
| 260 |
- if 7 <= datetime.datetime.now().hour and 20 >= datetime.datetime.now().hour: |
|
| 261 |
- opacityValue=10; |
|
| 217 |
+ if opacity == -1: |
|
| 218 |
+ opacityValue=2; |
|
| 219 |
+ if 7 <= datetime.datetime.now().hour and 20 >= datetime.datetime.now().hour: |
|
| 220 |
+ opacityValue=10; |
|
| 221 |
+ opacity=opacityValue |
|
| 262 | 222 |
pageContent += " <span id=\"mangaOpacityMinus\" onclick=\"onOpacityMinus()\">☼</span>" |
| 263 |
- pageContent += " <span id=\"mangaOpacityValue\">"+str(opacityValue)+"</span>" |
|
| 223 |
+ pageContent += " <span id=\"mangaOpacityValue\">"+str(opacity)+"</span>" |
|
| 264 | 224 |
pageContent += " <span id=\"mangaOpacityPlus\" onclick=\"onOpacityPlus()\">☀</span>\n" |
| 265 | 225 |
pageContent += " <span id=\"mangaReload\" onClick=\"window.location.reload();\"><div class=\"reload-circle\"></div></span>\n" |
| 266 | 226 |
pageContent += "</div>\n" |
| ... | ... |
@@ -293,17 +253,12 @@ def getMangakakalotCom(url): |
| 293 | 253 |
return pageContent |
| 294 | 254 |
|
| 295 | 255 |
def getManganeloTV(url): |
| 256 |
+ global opacity |
|
| 296 | 257 |
debug("getManganeloTV :"+url)
|
| 297 |
- #if "manganelo.com" in url: |
|
| 298 |
- # url=url.replace("manganelo.com","manganelo.tv")
|
|
| 299 |
- # say("Replace URL:"+url)
|
|
| 300 | 258 |
r = requests.get(url, allow_redirects=True) |
| 301 | 259 |
content = r.text |
| 302 | 260 |
|
| 303 | 261 |
isMangakakalot = 0 |
| 304 |
- if "mangakakalot.com" in url: |
|
| 305 |
- isMangakakalot=1 |
|
| 306 |
- |
|
| 307 | 262 |
#print(r.text) |
| 308 | 263 |
lineNextChapter = None |
| 309 | 264 |
linePreviousChapter = None |
| ... | ... |
@@ -333,8 +288,10 @@ def getManganeloTV(url): |
| 333 | 288 |
elif "<img class=\"img-loading\" data-src=\"" in line: |
| 334 | 289 |
if ".jpg" in line: |
| 335 | 290 |
listImages.append(line.split("\"")[3])
|
| 336 |
- print("NEXT :"+linkNext)
|
|
| 337 |
- print("PREV :"+linkPrev)
|
|
| 291 |
+ if None is not linkNext: |
|
| 292 |
+ print("NEXT :"+linkNext)
|
|
| 293 |
+ if None is not linkPrev: |
|
| 294 |
+ print("PREV :"+linkPrev)
|
|
| 338 | 295 |
|
| 339 | 296 |
if 0 == len(listImages): |
| 340 | 297 |
# Attempt to extract images once more, most likely all are on one line |
| ... | ... |
@@ -385,11 +342,13 @@ def getManganeloTV(url): |
| 385 | 342 |
pageContent += " <span id=\"mangaCurrPage\"></span><span id=\"mangaNumPages\"> / "+str(mangaImagesNum)+"</span>\n" |
| 386 | 343 |
pageContent += " <span id=\"mangaFSStatus\" style=\"display: none;\">0</span>\n" |
| 387 | 344 |
pageContent += " <span id=\"mangaFSToggle\" onclick=\"openFullscreen();\"><div class=\"fs-on\"></div></span>\n" |
| 388 |
- opacityValue=2; |
|
| 389 |
- if 7 <= datetime.datetime.now().hour and 20 >= datetime.datetime.now().hour: |
|
| 390 |
- opacityValue=10; |
|
| 345 |
+ if opacity == -1: |
|
| 346 |
+ opacityValue=2; |
|
| 347 |
+ if 7 <= datetime.datetime.now().hour and 20 >= datetime.datetime.now().hour: |
|
| 348 |
+ opacityValue=10; |
|
| 349 |
+ opacity=opacityValue |
|
| 391 | 350 |
pageContent += " <span id=\"mangaOpacityMinus\" onclick=\"onOpacityMinus()\">☼</span>" |
| 392 |
- pageContent += " <span id=\"mangaOpacityValue\">"+str(opacityValue)+"</span>" |
|
| 351 |
+ pageContent += " <span id=\"mangaOpacityValue\">"+str(opacity)+"</span>" |
|
| 393 | 352 |
pageContent += " <span id=\"mangaOpacityPlus\" onclick=\"onOpacityPlus()\">☀</span>\n" |
| 394 | 353 |
pageContent += " <span id=\"mangaReload\" onClick=\"window.location.reload();\"><div class=\"reload-circle\"></div></span>\n" |
| 395 | 354 |
pageContent += "</div>\n" |
| ... | ... |
@@ -426,6 +385,7 @@ class MyServer(BaseHTTPRequestHandler): |
| 426 | 385 |
# To silence the default output of server (too verbose) |
| 427 | 386 |
return |
| 428 | 387 |
def do_GET(self): |
| 388 |
+ global opacity |
|
| 429 | 389 |
global csvFilename |
| 430 | 390 |
global csvFilenameTemp |
| 431 | 391 |
global connectionResults |
| ... | ... |
@@ -484,6 +444,14 @@ class MyServer(BaseHTTPRequestHandler): |
| 484 | 444 |
|
| 485 | 445 |
data_page = "" |
| 486 | 446 |
|
| 447 |
+ opacity=-1 |
|
| 448 |
+ #try: |
|
| 449 |
+ #if urlArgs['opacity'] is not None: |
|
| 450 |
+ # opacity=urlArgs['opacity'][0] |
|
| 451 |
+ #print(self) |
|
| 452 |
+ #except: |
|
| 453 |
+ #pass |
|
| 454 |
+ |
|
| 487 | 455 |
#Forging response |
| 488 | 456 |
#if configuration.get_debug() != 0: |
| 489 | 457 |
# data_page += "<p>Request: "+self.path+"</p>\n" |
| ... | ... |
@@ -13,9 +13,15 @@ |
| 13 | 13 |
setTimeout(onArticle(0), 500); |
| 14 | 14 |
} |
| 15 | 15 |
window.onload = init; |
| 16 |
+ function changeHref() {
|
|
| 17 |
+ var curOpacity = parseInt(document.getElementById("mangaOpacityValue").innerHTML);
|
|
| 18 |
+ var curPage = parseInt(document.getElementById("mangaCurrPage").innerHTML);
|
|
| 19 |
+ location.href="#opacity="+curOpacity+"&page="+curPage; |
|
| 20 |
+ } |
|
| 16 | 21 |
function changeOpacity() {
|
| 17 | 22 |
var curOpacity = parseInt(document.getElementById("mangaOpacityValue").innerHTML);
|
| 18 | 23 |
document.getElementById("article-current").style.opacity = curOpacity/10;
|
| 24 |
+ changeHref(); |
|
| 19 | 25 |
} |
| 20 | 26 |
function onOpacityPlus() {
|
| 21 | 27 |
var curOpacity = parseInt(document.getElementById("mangaOpacityValue").innerHTML);
|
| ... | ... |
@@ -44,7 +50,14 @@ |
| 44 | 50 |
function onChapterNext() {
|
| 45 | 51 |
var el = document.getElementsByClassName("mangaChapNavigNext")[0];
|
| 46 | 52 |
var elLink = el.getElementsByTagName("a")[0].getAttribute("href");
|
| 47 |
- location.href=elLink; |
|
| 53 |
+ var indexHash=location.href.indexOf("#");
|
|
| 54 |
+ if( -1 != indexHash) {
|
|
| 55 |
+ var curHref = location.href.substring(indexHash); |
|
| 56 |
+ location.href=elLink + curHref; |
|
| 57 |
+ } else {
|
|
| 58 |
+ location.href=elLink; |
|
| 59 |
+ } |
|
| 60 |
+ //location.href=elLink; |
|
| 48 | 61 |
} |
| 49 | 62 |
function onChapterPrev() {
|
| 50 | 63 |
var el = document.getElementsByClassName("mangaChapNavigPrev")[0];
|
| ... | ... |
@@ -100,7 +113,7 @@ |
| 100 | 113 |
x.className = string_index; |
| 101 | 114 |
document.getElementById("article-current").innerHTML =
|
| 102 | 115 |
document.getElementById(string_index).innerHTML; |
| 103 |
- location.href = "#article-top"; |
|
| 116 |
+ location.href = "#"; |
|
| 104 | 117 |
//console.log(document.getElementById(string_index).innerHTML); |
| 105 | 118 |
document.getElementById("mangaCurrPage").innerHTML = index+1;
|
| 106 | 119 |
} |