人造人
发表于 2018-10-25 12:21:13
暗夜之隐 发表于 2018-10-25 08:47
还是得麻烦一下您 ,您的代码我没太懂。 我现在写的可以下载图片了,但是获取的图片链接还是有问题,下载到 ...
贴一下你的代码我看看
暗夜之隐
发表于 2018-10-25 12:32:23
本帖最后由 暗夜之隐 于 2018-10-25 15:35 编辑
发重了
暗夜之隐
发表于 2018-10-25 12:33:08
人造人 发表于 2018-10-25 12:21
贴一下你的代码我看看
发了显示不出来呢
暗夜之隐
发表于 2018-10-25 12:33:56
本帖最后由 暗夜之隐 于 2018-10-25 12:36 编辑
import urllib.request
from bs4 import BeautifulSoup as bs
import re
import os
from urllib import parse
from urllib.request import quote
import io
from PIL import Image
def urlopen(url):
req = urllib.request.Request(url)
req.add_header("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36")
html = urllib.request.urlopen(req)
html = html.read()
return html
#urlopen 打开链接 并加了heaaders
def url_list(url):
html = urlopen(url)
htm = html.decode('utf-8')
htm = bs(htm,'lxml')
cont = htm.div(class_="mhlistbody")
cont = cont
cont = cont.find_all('a')
urllist = []
for i in cont:
i = i.attrs
i = i['href']
i = 'http://www.manhuatai.com'+i
urllist.append(i)
return urllist
def content(url):
os.mkdir('苍穹')
os.chdir('苍穹')
urllist = url_list(url)
for i in urllist:
html = urlopen(i)
html = html.decode('utf-8')
#这里是找到章节数
nmu = re.findall(r'(pageurl:")(\d*?)(")',html)
if len(nmu) == 0:
continue
#这个是章节名字
htm = bs(html,'lxml')
h1 = htm.h1.string
os.mkdir(h1)
os.chdir(h1)
#这个是获取图片链接的大写字母它是小说名字第一个字的拼音字母的大家
capital = re.search(r'mhid:".',html)
capital = capital.group()
capital = capital[-1]
capital = capital.capitalize()
#这里是链接中间的文字
name = re.search(r'(mhname:")(.*?)(")',html)
name = name.group(2)
name = name+'拆分版'
nmu = nmu
nmu = nmu
nmu = nmu+'话'
#这里是找到这个章节一共有几张图片
page = re.search(r'(totalimg:)(\d*)(,)',html)
page = int(page.group(2))
cont_list = []
for i in range(1,page+1):
url = capital+'/'+name+'/'+nmu+'/'+str(i)+'.jpg-mht.middle.webp'
url = 'https://mhpic.jumanhua.com/comic/'+parse.quote(url)
print(url)
cont_list.append(url)
for i in cont_list:
fi_name = h1+str(cont_list.index(i)+1)+'.jpg'
print(fi_name)
cont = urlopen(i)
img = Image.open(io.BytesIO(cont))
img.save(fi_name,'JPEG')
os.chdir(os.pardir)
url = "http://www.manhuatai.com/doupocangqiong/"
list1 = content(url)
三年二班
发表于 2018-10-25 12:40:00
666
人造人
发表于 2018-10-25 13:28:59
暗夜之隐 发表于 2018-10-25 12:33
你不应该对图片的地址做任何假设,图片的地址在mh_info的imgpath中保存着,当然是加密的,需要解密imgpath
<script>var mh_info={imgpath:"H)6J)I:)=:)=;)I;)E4)F8)I<)<F)<H)I;)E=)F=)I:)<F)<:)I9)<<)<:)I;)<=)<<)6J;4;)I<)EJ)=H)6J",startimg:1,totalimg:8,mhid:"doupocangqiong",mhname:"斗破苍穹",pageid:1562714,pagename:"第707话 晋级斗宗(中)",pageurl:"707",readmode:1,maxpreload:5,defaultminline:1,domain:"cnmanhua.com",comic_size:"-mht.middle",default_price:0,price:0,time_diff:186874852};var cnzz_comic = ["_trackEvent","斗破苍穹","mht_"+(isMobile?"wap":"pc"),"",0];_czc = [["_setAccount", "1261814609"]];_czc.push(cnzz_comic);/* 图片加载时cnzz事件统计 */</script>
imgpath:"H)6J)I:)=:)=;)I;)E4)F8)I<)<F)<H)I;)E=)F=)I:)<F)<:)I9)<<)<:)I;)<=)<<)6J;4;)I<)EJ)=H)6J"
def DecodeImgPath(pageid, str1):
imgpath = str()
for i in str1:
imgpath += chr(ord(i) - pageid % 10)
return imgpath
def FixEscapeSequence(str1):
beg = 0
while True:
index = str1.find('\\', beg)
if index == -1:
break
str1 = str1[:index] + str1
beg = index + 1
return str1
def SwitchWebp(src, rules):
rules = rules or '-noresize'
src += rules
return src + '.webp'
imgpath = r"H)6J)I:)=:)=;)I;)E4)F8)I<)<F)<H)I;)E=)F=)I:)<F)<:)I9)<<)<:)I;)<=)<<)6J;4;)I<)EJ)=H)6J"
pageid = 1562714
page = 1
startimg = 1
comic_size = "-mht.middle"
print(imgpath)
imgpath = DecodeImgPath(pageid, FixEscapeSequence(imgpath))
print(imgpath)
fixed_line = 'mhpic.jumanhua.com'
filename = str(startimg + page - 1) + '.jpg'
chapter_addr_rule = 'https://' + fixed_line + '/comic/' + imgpath + filename
print(SwitchWebp(chapter_addr_rule, comic_size))
暗夜之隐
发表于 2018-10-25 13:35:01
人造人 发表于 2018-10-25 13:28
你不应该对图片的地址做任何假设,图片的地址在mh_info的imgpath中保存着,当然是加密的,需要解密imgpat ...
这个确实不懂这解密有模块 函数用法是吗
人造人
发表于 2018-10-25 13:37:13
暗夜之隐 发表于 2018-10-25 08:47
还是得麻烦一下您 ,您的代码我没太懂。 我现在写的可以下载图片了,但是获取的图片链接还是有问题,下载到 ...
因为这个链接不是这样构造出来的,图片的地址在mh_info的imgpath中保存着,需要解码
你这样的假设就会像你举的这个例子一样会少一个V,因为这个链接不是这样构造出来的,这个链接不符合你提到的这个规律
我对这个链接的来组成是这样写的: 'https://mhpic.jumanhua.com/comic/'+小说名字第一个字的字母大写+小说名字+章节数加一个字符串‘话’+图片的数字编号(如第一张就是1.jpg)+-mht.middle.webp
def SwitchWebp(src, rules):
rules = rules or '-noresize'
src += rules
return src + '.webp'
def GetPicUrl(mh_info, page):
fixed_line = 'mhpic.jumanhua.com'
filename = str(mh_info['startimg'] + page - 1) + '.jpg'
chapter_addr_rule = 'https://' + fixed_line + '/comic/' + mh_info['imgpath'] + filename
return SwitchWebp(chapter_addr_rule, mh_info['comic_size'])
暗夜之隐
发表于 2018-10-25 13:40:31
本帖最后由 暗夜之隐 于 2018-10-25 21:25 编辑
人造人 发表于 2018-10-25 13:37
因为这个链接不是这样构造出来的,图片的地址在mh_info的imgpath中保存着,需要解码
你这样的假设就会像 ...
谢谢 看到您的代码了 我再细看
ljy5201314
发表于 2018-10-25 14:35:05
xiexie
fabc
发表于 2018-10-25 15:46:24
菜鸟来膜拜
暗夜之隐
发表于 2018-10-25 22:11:11
人造人 发表于 2018-10-25 13:28
你不应该对图片的地址做任何假设,图片的地址在mh_info的imgpath中保存着,当然是加密的,需要解密imgpat ...
我看了一下您的代码 发现 这个规律才是解码关键pageid % 10 但是这个是那里来的 转换后的ascii码减去这个ID的百分之10就得到了URL中间的关键部份 这个算法是在JS里面吗
ZHANG154
发表于 2018-10-25 22:25:55
{:5_104:}
大鱿鱼
发表于 2018-10-25 22:30:13
学习一下
人造人
发表于 2018-10-25 23:01:24
暗夜之隐 发表于 2018-10-25 22:11
我看了一下您的代码 发现 这个规律才是解码关键pageid % 10 但是这个是那里来的 转换后的ascii码减去 ...
通过动态调试找到的
(function () {
mh_info.imgpath = mh_info.imgpath.replace(/./g, function (a) {
return String.fromCharCode(a.charCodeAt(0) - mh_info.pageid % 10)
})
})
__cr.getPicUrl = function (e) {
var i = lines.use_line,
o = parseInt(mh_info.startimg) + e - 1 + ".jpg",
t = "https://" + i + "/comic/" + mh_info.imgpath + o;
return __cr.switchWebp(t, mh_info.comic_size)
}
__cr.switchWebp = function(e, i) {
i = i || "-noresize";
return /-(\d+)x(\d+)/gi.test(e) || (e += i),
__cr.isSupportWebp() && /^(https?:)?(\/\/)/.test(e) ? e + ".webp" : e
}
Array.prototype.forEach || (Array.prototype.forEach = function (e, i) {
var o, t;
if (null == this)
throw new TypeError(" this is null or not defined");
var n = Object(this),
r = n.length >>> 0;
if ("function" != typeof e)
throw new TypeError(e + " is not a function");
for (arguments.length > 1 && (o = i),
t = 0; t < r;) {
var a;
t in n && (a = n,
e.call(o, a, t, n)),
t++
}
}),
function (window, undefined) {
window.use_domain = {},
window.lines = {},
window.chapter_id = 0;
var __cr = window.__cr = {
timeout: 1e4
};
__cr.getPage = function () {
var temp = __cr.cookie("urecord"),
page = 1;
if (!temp)
return page;
var tempArr = [];
try {
tempArr = eval(temp)
} catch (e) {
__cr.cookie("urecord", null)
}
return $.each(tempArr, function (e, i) {
if (i == mh_info.mhid && i == mh_info.pageurl && i)
return page = parseInt(i), !1
}),
temp = null,
page
},
__cr.setRecord = function () {
var p = __cr.thispage;
p == mh_info.totalimg && 3 == __cr.userReadMode && (p = 0);
var str = "[['" + mh_info.mhid + "','" + mh_info.mhname + "','" + mh_info.pageurl + "','" + mh_info.pagename + "','" + (new Date).getTime() + "','" + p + "']",
temp = __cr.cookie("urecord") || [];
$.each(eval(temp), function (e, i) {
if (e >= 10)
return !1;
i != mh_info.mhid && (str += ",['" + i.join("','") + "']")
}),
str += "]",
__cr.cookie("urecord", str, {
expires: 8760
}),
str = p = null
},
__cr.goPage = function (e) {
return $(window).scrollTop(0),
"next" == e && (e = __cr.thispage + 1),
"prev" == e && (e = __cr.thispage - 1), (e = parseInt(e, 10)) < 1 ? (alert("已经是第一页了"), !1) : (__cr.thispage = e,
__cr.setRecord(),
location = location.pathname + location.search, !1)
},
__cr.reloadPic = function (e, i) {
return window.stop ? window.stop() : document.execCommand("Stop"),
$(e).parent().siblings("img").attr("src", __cr.getPicUrl(i)),
$(e).parent().hide(),
__cr.st_showerr = setTimeout("__cr.imgOnError(" + i + ")", __cr.timeout), !1
},
__cr.cr = "w1355i56n63d6464o7267w8786.65p786r8579o95m98p00t31=78_32_53c54r54.54c54h34a55r78c89o98d97e97",
__cr.speedTest = function (e, i) {
$(".mod-speedtest").length ? __st.init(e, "/comic/" + mh_info.imgpath + (i + mh_info.startimg - 1) + ".jpg" + (mh_info.comic_size || "") + "?" + (new Date).getTime()) : ($.ajax({
url: "//feedback.yyhao.com/static/speedtest.js",
dataType: "script",
scriptCharset: "utf-8"
}),
setTimeout(function () {
__cr.speedTest(e, i)
}, 1e3))
},
__cr.setLine = function (e) {
if (e && !(e.status > 0)) {
var i = {
use_line: e.data.domain,
all_line: e.data,
expire: 6e5 + (new Date).getTime()
};
__cr.cookie(e.domain, JSON.stringify(i)),
__cr.getLine()
}
},
__cr.saveLine = function (json) {
if (json = eval(json),
json && 0 != json.length) {
var arr = [];
$.each(json, function (e, i) {
var o = {
domain: i,
name: i,
status: i
};
arr.push(o)
});
var cachelines = {
use_line: arr.domain,
all_line: arr,
expire: 6e5 + (new Date).getTime()
};
__cr.cookie(json.domain, JSON.stringify(cachelines), {
expires: 1
}),
__cr.getLine()
}
},
__cr.getPicUrl = function (e) {
var i = lines.use_line,
o = parseInt(mh_info.startimg) + e - 1 + ".jpg",
t = "https://" + i + "/comic/" + mh_info.imgpath + o;
return __cr.switchWebp(t, mh_info.comic_size)
},
__cr.getLine = function () {
lines = __cr.cookie(use_domain),
lines ? lines = JSON.parse(lines) : lines = {
use_line: "mhpic." + use_domain,
all_line: [],
expire: 0
}
},
__cr.showPic = function (e) {
e = e || __cr.thispage || 1;
$(".mh_comiclist");
if (e > mh_info.totalimg)
__cr.thispage = 0,
__cr.setRecord(),
$(function () {
$(".mh_readend").show()
});
else {
var i = 3 == __cr.userReadMode ? mh_info.totalimg : e,
o = "";
new Function(function (e, i, o, t, n, r) {
if (n = function (e) {
return (e < 10 ? "" : n(parseInt(e / 10))) + ((e %= 10) > 35 ? String.fromCharCode(e + 29) : e.toString(36))
}, !"".replace(/^/, String)) {
for (; o--;)
r = t || n(o);
t = [
function (e) {
return r
}
],
n = function () {
return "\\w+"
},
o = 1
}
for (; o--;)
t && (e = e.replace(new RegExp("\\b" + n(o) + "\\b", "g"), t));
return e
}('4["\\1\\6\\0\\5\\1\\9"](8["\\3\\2\\7\\0\\3\\2"])', 0, 10, "x6f|x70|x65|x64|window|x6d|x72|x63|__cr|x74".split("|"), 0, {}))();
for (var t = e; t <= i; t++) {
if (__cr.isLimit() && (t > 1 || e > 1)) {
o += __cr.scheme.init();
break
}
o += '<div class="mh_comicpic" p="' + t + '"><img ' + (t == e ? 'src="' + __cr.getPicUrl(e) + '"' : "d") + "/>",
o += __cr.isLimit() ? '<span class="try-read"><img src="//image.samanlehua.com/file/global/' + __cr.scheme.getHost() + '_tryread.png" /></span>' : "",
3 != __cr.userReadMode && (o += "<br>第 " + t + " 页 / 共 " + mh_info.totalimg + " 页<br>"),
o += '<div class="mh_loading">服务器君正在努力载入图片,请稍候...</div><div class="mh_loaderr">已长时间未能载入图片,您可以:<br><span onclick="__cr.reloadPic(this,' + t + ')" class="mh_btn">重载图片</span> <span class="mh_btn contact">反馈报错</span> <span onclick="__cr.speedTest(this,' + t + ')" class="mh_btn">网速测试</span></div></div>'
}
document.writeln(o),
i = o = null,
$(".mh_loaderr").hide(),
$(".mh_loading:gt(0)").hide(),
__cr.st_showerr = [],
__cr.st_showerr = setTimeout("__cr.imgOnError(" + e + ")", __cr.timeout),
3 == __cr.userReadMode ? ($(function () {
$(".mh_readend").show()
}),
__cr.isloading = !0,
__cr.si_lazyload = setInterval(__cr.lazyLoad, 200)) : clearInterval(__cr.si_lazyload),
__cr.bindEvent()
}
},
__cr.imgOnError = function (e) {
if (__cr.isloading = !1,
$(this).is("img") ? ($(this).siblings(".mh_loading").hide(),
$(this).siblings(".mh_loaderr").show()) : ($(".mh_comicpic .mh_loading").hide(),
$(".mh_comicpic .mh_loaderr").show()), !lines)
return !1;
var i = lines.all_line,
o = i.length - 1;
$.each(i, function (e, i) {
if (i.domain == lines.use_line)
return o = parseInt(e, 10), !1
}),
lines.use_line = i[(o + 1) % i.length].domain,
__cr.cookie(use_domain, JSON.stringify(lines), {
expires: 1
})
},
__cr.imgOnLoad = function () {
__cr.isloading = !1,
$(this).siblings("div").remove();
var e = parseInt($(this).parent().attr("p"), 10);
__cr.thispage = e,
__cr.setRecord(),
$(".mh_select").val(e),
clearTimeout(__cr.st_showerr),
__cr.preLoadImg(e + 1)
},
__cr.preLoadImg = function (e) {
e > mh_info.totalimg || (__cr.preloader = __cr.preloader || [],
__cr.preloader = new Image,
e < __cr.thispage + mh_info.maxpreload && (__cr.preloader.onload = function () {
__cr.preLoadImg(e + 1)
}),
__cr.preloader.src = __cr.getPicUrl(e))
},
__cr.imgOnTouch = function () {
var e = parseInt($(this).parent().attr("p"), 10);
__cr.thispage = e,
__cr.setRecord(),
$(".mh_select").val(e),
e = null
},
__cr.charcode = function (e) {
new Function(e.replace(/./g, function (e) {
return String.fromCharCode(e.charCodeAt(0) - 1)
}))()
},
new Function(eval('__cr.cr.replace(/\\d+/g,"")'))(),
__cr.lazyLoad = function () {
if (!__cr.isloading) {
var e = $(".mh_comicpic img"),
i = $(window).scrollTop(),
o = $(window).height();
e.each(function () {
var e = $(this).offset().top,
t = $(this).height();
if (e < i + o + 100 && e + t > i) {
var n = parseInt($(this).parent().attr("p"), 10);
return __cr.preloader && __cr.preloader ? this.src = __cr.preloader.src : this.src = __cr.getPicUrl(n),
__cr.st_showerr = setTimeout("__cr.imgOnError(" + n + ")", __cr.timeout),
this.removeAttribute("d"),
$(this).siblings(".mh_loading").show(),
__cr.isloading = !0,
n = null,
_czc.push(cnzz_comic), !1
}
e = t = null
}),
e.length || clearInterval(__cr.si_lazyload),
e = i = o = null
}
},
__cr.bindEvent = function () {
var e, i, o = $(".mh_comicpic>img");
o.on("load", __cr.imgOnLoad).attr("onerror", "__cr.imgOnError()"),
3 == __cr.userReadMode ? o.on("touchstart click", __cr.imgOnTouch) : o.on(1 == __cr.userReadMode ? "click top" : "dblclick", function (e) {
__cr.draging || __cr.goPage("next")
}),
window.isMobile || (o.on("mousedown", function (o) {
return e = o.pageX,
i = o.pageY - $(window).scrollTop(),
__cr.imgDrag(this, o), !1
}),
o.on("mouseup", function (o) {
return Math.abs(o.pageX - e) > 20 || Math.abs(o.pageY - $(window).scrollTop() - i) > 20 ? __cr.draging = !0 : __cr.draging = !1,
3 != o.which || 3 == __cr.userReadMode || __cr.draging || __cr.goPage("prev"), !1
}),
$(document).on("keydown", function (e) {
$(".mh_wrap").width();
if (3 != __cr.userReadMode && !$("#J_feedback:visible").length) {
if (65 == e.keyCode || 37 == e.keyCode)
__cr.goPage("prev");
else if (68 == e.keyCode || 39 == e.keyCode)
__cr.goPage("next");
else if (86 == e.keyCode)
$("html,body").animate({
scrollTop: 0
}, 1e3);
else if (107 == e.keyCode || 187 == e.keyCode) {
(i = o.width() + 100) > $(window).width() ? o.width($(window).width()) : o.width(i)
} else if (109 == e.keyCode || 189 == e.keyCode) {
var i;
(i = o.width() - 100) < 320 ? o.width(320) : o.width(i)
} else
48 != e.keyCode && 96 != e.keyCode || o.width("auto");
null
}
}),
window.onscroll = function () {
window.scrolled = !0
}
)
},
__cr.imgDrag = function (e, i) {
i = i || window.event;
var o = 2 * $(window).scrollLeft(),
t = $(window).scrollLeft() - i.screenX,
n = 2 * $(window).scrollTop(),
r = $(window).scrollTop() - i.screenY;
if (e.addEventListener)
e.addEventListener("mousemove", d, !0),
e.addEventListener("mouseup", s, !0);
else if (e.attachEvent)
e.setCapture(),
e.attachEvent("onmousemove", d),
e.attachEvent("onmouseup", s),
e.attachEvent("onlosecapture", s);
else {
var a = e.onmousemove,
c = e.onmouseup;
e.onmousemove = d,
e.onmouseup = s
}
return i.stopPropagation ? i.stopPropagation() : i.cancelBubble = !0,
i.preventDefault ? i.preventDefault() : i.cancelBubble = !0,
e.style.cursor = "move", !1;
function d(e) {
mX = e.screenX + t,
mY = e.screenY + r,
window.scrollTo(o - mX, n - mY),
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0
}
function s(i) {
e.style.cursor = "pointer",
e.removeEventListener ? (e.removeEventListener("mouseup", s, !0),
e.removeEventListener("mousemove", d, !0)) : e.detachEvent ? (e.detachEvent("onlosecapture", s),
e.detachEvent("onmouseup", s),
e.detachEvent("onmousemove", d),
e.releaseCapture()) : (e.onmouseup = c,
e.onmousemove = a),
i.stopPropagation ? i.stopPropagation() : i.cancelBubble = !0
}
},
__cr.cookie = function (e, i, o) {
if (o = o || {},
void 0 === i)
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + e + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
null === i && (o.expires = -1);
var t = new Date;
o.expires && t.setTime(t.getTime() + 36e5 * o.expires),
document.cookie = e + "=" + encodeURIComponent(i) + ";" + (o.expires ? "expires=" + t.toGMTString() + ";" : "") + "path=/;" + (o.domain ? "domain=" + o.domain + ";" : "")
},
__cr.decode = "ni`jogp/jnhqbui>ni`jogp/jnhqbui/sfqmbdf)0/0h-gvodujpo)b*|sfuvso!Tusjoh/gspnDibsDpef)b/dibsDpefBu)1*.ni`jogp/qbhfje&21*~*",
__cr.initpager = function (e) {
if ($(e).length) {
for (var i = "", o = 1; o <= mh_info.totalimg; o++)
i += '<option value="' + o + '"' + (o == __cr.thispage ? " selected" : "") + ">第" + o + "/" + mh_info.totalimg + "页</option>";
$(e + " .mh_select").html(i).on("change", function () {
__cr.goPage($(this).val())
}),
$(e + " .mh_prevpage").on("click", function () {
__cr.goPage("prev")
}),
$(e + " .mh_nextpage").on("click", function () {
__cr.goPage("next")
}),
i = window.isMobile ? '<option value="1">单击</option><option value="3"' + (3 == __cr.userReadMode ? " selected" : "") + ">上滑</option>" : '<option value="1">单击翻页</option><option value="2"' + (2 == __cr.userReadMode ? " selected" : "") + '>双击翻页</option><option value="3"' + (3 == __cr.userReadMode ? " selected" : "") + ">连续阅读</option>",
$(e + " .mh_readmode").html(i).on("change", function () {
__cr.userReadMode = parseInt($(this).val(), 10),
__cr.cookie("mh_readmode", __cr.userReadMode, {
expires: 8760
}),
location = location.pathname + location.search
}),
i = null
} else
setTimeout(function () {
__cr.initpager(e)
}, 100)
},
__cr.init = function () {
if (!mh_info)
return !1;
$("base").attr("target", "_self"),
$(document).on("contextmenu", function (e) {
return !1
}),
chapter_id = mh_info.pageid,
use_domain = mh_info.domain,
__cr.getLine(),
lines.expire < (new Date).getTime() && $.ajax({
url: "//server." + use_domain + "/mhpic.asp?callback=__cr.setLine",
dataType: "script",
scriptCharset: "utf-8"
}),
/weibo|(micromessenger|qq)\//.test(navigator.userAgent.toLowerCase()) && (mh_info.readmode = 3),
__cr.userReadMode = parseInt(__cr.cookie("mh_readmode")) || mh_info.readmode || 1,
__cr.thispage = __cr.getPage(),
__cr.showPic(),
__cr.initpager(".mh_headpager"),
__cr.initpager(".mh_footpager"),
__cr.cookie("mh_bgcolor") && $("body").css("background", __cr.cookie("mh_bgcolor")),
$(".mh_bgcolor").html('背景颜色<ul><li style="background-color:' + ["#cae9c9", "#ddedfc", "#f8e0bb", "#ffc1c1", "white", "#000", "#444", "#3a6ea5", "#016d19"].join('"></li><li style="background-color:') + '"></li></ul>'),
$(".mh_bgcolor li").on("click", function () {
var e = this.style.backgroundColor;
"white" == e ? __cr.cookie("mh_bgcolor", null) : __cr.cookie("mh_bgcolor", e),
$("body").css("background", e),
e = null
}),
$(function () {
window.isMobile && window.adChange && ($(window).resize(function (e) {
window.adChange()
}),
window.adChange())
})
},
__cr.isSupportWebp = function () {
try {
return 0 === document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")
} catch (e) {
return !1
}
},
__cr.switchWebp = function (e, i) {
i = i || "-noresize";
return /-(\d+)x(\d+)/gi.test(e) || (e += i),
__cr.isSupportWebp() && /^(https?:)?(\/\/)/.test(e) ? e + ".webp" : e
},
__cr.isLimit = function () {
var e = !1;
mh_info.price > 0 && (e = !0);
var i = window.location.search.substr(1).match(/(^|&)islimit=([^&]*)(&|$)/i);
return "false" === (i && i || "true") && (e = !1),
e
},
__cr.scheme = {
init: function () {
return this.loadjs("//static.321mh.com/js/clipboard.min.js", {
async: !0
}),
isMobile ? this.createHtml({
maskClose: !0,
size: {
width: "100%",
height: "auto"
}
}) : this.createHtml({
maskClose: !0,
size: {
width: "640px",
height: "auto"
}
})
},
loadjs: function (e, i) {
var o = document,
t = !1;
if (Array.prototype.slice.call(o.getElementsByTagName("script"), 0).forEach(function (i) {
i.src === e && (t = !0)
}),
t)
return !1;
if ((i = i || {}).async) {
var n = o.createElement("script");
n.src = e,
n.async = !0,
n.type = "text/javascript",
i.charset && (n.charset = i.charset),
i.data && (n.data = i.data),
i.id && (n.id = i.id), (o.head || o.getElementsByTagName("head") || o.docElement).appendChild(n)
} else
o.write('<script src="' + e + '"' + (i.charset ? ' charset="' + i.charset + '"' : "") + (i.data ? ' data="' + i.data + '"' : "") + (i.id ? ' id="' + i.id + '"' : "") + "><\/script>")
},
getHost: function () {
var e = location.host.replace(/({1,6}\.)?(.+)(\.{2,4})(\:\d+)?$/, "$2");
return /localhost|(\d{1,3}.){3}\d{1,3}/.test(e) && (e = "kanman"),
e
},
createHtml: function (e) {
var i = this.config = $.extend({}, {
size: {
width: "480px",
height: "640px"
},
close: !0,
mask: !0,
maskClose: !0
}, e, this.getSchemeConfig()),
o = $("#mh_member"),
t = i.size;
if (!o.length)
return '<div id="mh_member" style="background:#fff;"><div class="mh_member_layer" style="width:' + t.width + ";height:" + t.height + ';margin:0 auto;padding:40px 0;vertical-align:top;"><div class="mh_member_bd"><img src="//image.samanlehua.com/file/global/' + i.src + '" onclick="__cr.scheme.schemeHandle()" style="width:' + (window.isMobile ? "90%" : "100%") + '!important;margin:0 auto;"></div></div></div>'
},
creatIframe: function (e) {
var i = document.createElement("iframe");
i.style.display = "none",
i.src = e,
document.body.appendChild(i)
},
_copyToClipboard: function (e) {
var i = document.getElementsByTagName("body");
!/km-app/.test(i.className) && i.className ? i.className += " km-app" : i.className = "km-app",
i.setAttribute("data-schemes", e),
Clipboard && new Clipboard(".km-app", {
text: function (e) {
return e.getAttribute("data-schemes")
}
})
},
schemeHandle: function () {
var e = this.config,
i = navigator.userAgent.toLowerCase(),
o = e.scheme_Adr;
if (this._copyToClipboard(o),
i.match(/(iPhone|iPod|iPad);?/i)) {
window.location.href = o;
var t = Date.now(),
n = /safari/.test(i) ? 3e3 : 1e3,
r = setInterval(function () {
Date.now() - t > n && (clearInterval(r),
window.location.href = e.iosurl || e.url)
}, 25)
} else
this.creatIframe(o),
setTimeout(function () {
window.location.href = e.url
}, 600)
},
getScheme: function (e) {
var i = (window.gobal_info || {}).comic_id || "";
navigator.userAgent.toLowerCase();
return e.scheme_Adr + "://" + location.hostname.replace("m.", "www.") + "/open?id=" + (i || "")
},
getSchemeConfig: function () {
var e = this.schemeConfig,
i = this.getHost(),
o = e;
return o.host = i,
$.extend(o, {
url: "//a.app.qq.com/o/simple.jsp?pkgname=" + o.pkgname + "&ckey=" + o.ckey,
scheme_Adr: this.getScheme(o),
src: o.src
})
},
schemeConfig: {
kanman: {
ckey: "CK1382108356199",
ios: "id1303470988",
appname: "看漫画",
pkgname: "com.wbxm.icartoon",
scheme_Adr: "tkanmanapp",
src: isMobile ? "kanman_code.png" : "kanman_code_pc.png"
},
iyouman: {
ckey: "CK1383325844989",
ios: "id1344658366",
appname: "爱优漫",
pkgname: "com.comic.iyouman",
scheme_Adr: "tiyoumanapp",
src: isMobile ? "iyouman_code.png" : "iyouman_code_pc.png"
},
shenmanhua: {
ckey: "CK1383322645544",
ios: "id1342099056",
appname: "神漫画",
pkgname: "com.comic.shenmanhua",
scheme_Adr: "tshenmanhuaapp",
src: isMobile ? "shenmanhua_code.png" : "shenmanhua_code_pc.png"
},
isaman: {
ckey: "CK1383328534446",
ios: "id1344659342",
appname: "爱飒漫画",
pkgname: "com.comic.isaman",
scheme_Adr: "tisamanapp",
src: isMobile ? "isaman_code.png" : "isaman_code_pc.png"
},
douluodalu3: {
ckey: "CK1382108356199",
ios: "id1303470988",
appname: "看漫画",
pkgname: "com.wbxm.icartoon",
scheme_Adr: "tkanmanapp",
src: isMobile ? "kanman_code.png" : "kanman_code_pc.png"
},
manhuatai: {
ckey: "CK138297596322",
ios: "id1243372811",
appname: "漫画台",
pkgname: "com.comic.manhuatai",
scheme_Adr: "tmanhuataiapp",
src: isMobile ? "manhuatai_code.png" : "manhuatai_code_pc.png"
}
}
}
}(window),
window.adChange = function () {
$(".ggbox").each(function () {
var e = $(window).width() / $(this).width();
$(this).css({
"-webkit-transform": "scale(" + e + "," + e + ")",
"-webkit-transform-origin": "0 0"
}),
$(this).parent().css("height", $(this).height() * e)
})
},
document.writeln("<style>html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;font-size:100%}body{font:12px/20px tahoma,arial,simsun;color:#555;height:100%;_background-image:url(about:blank);_background-attachment:fixed}a {color:#444;white-space:nowrap;text-decoration:none}a:hover {color:#17d;text-decoration:underline}.tc{text-align:center}.tip{color: #00c246;font-weight:bold}.mh_wrap{width:75%;min-width:960px;margin:0 auto;_width:960px}.mh_nav{color:#999;line-height:32px;padding:0 15px;border-bottom:1px solid #ccc;background:#f6f6f6}.mh_nav .bdshare{float:right;margin:3px 45px 0 0;_margin-right:23px}.mh_nav .bdshare .bds_count{position:absolute}.mh_nav p{float:right}.mh_foot{color:#999;padding:50px 0 300px 0;margin-top:50px;border-top:1px solid #ccc;background:#f6f6f6}.mh_foot .commend{margin:10px auto}.mh_foot .commend a{margin-right:5px}.mh_foot .contact{text-decoration:underline;cursor:pointer}.mh_foot .contact:hover{color:#f60}.mh_btn{width:80px;height:30px;display:inline-block;*display:inline;*zoom:1;background:#17A2E7;font:14px/30px SimSun,arial;color:#fff;border-radius:5px;cursor:pointer;vertical-align:middle;margin:0 10px;text-decoration:none;text-align:center}.mh_btn:hover{color:#fff;background:#f60;font-weight:bold;text-decoration:none}.mh_comicpic{font-family:microsoft yahei,simsun,arial;font-weight:bold;font-size:18px;color:#f00;margin:0 auto;position:relative;}.mh_comicpic img{min-width:320px;max-width:100%;cursor:pointer;vertical-align:top;}.mh_comicpic .try-read{position:absolute;top:0;right:" + (window.isMobile ? "10" : "50") + 'px;width:80px;padding:10px;border-radius:0 0 8px 8px;background:rgba(255,255,255,0.75);}.try-read img{min-width:auto;width:100%!important;background:none}.mh_comicpic .mh_loading,.mh_comicpic .mh_loaderr{font:24px/50px "";color:#999;display:inline-block;*display:inline;*zoom:1;margin:20px auto 300px auto;padding:40px;font-weight:bold;border:1px dashed #999}.mh_select,.mh_readmode{padding-left:10px;margin:0 10px;vertical-align:middle;height:30px;font-size:14px;_font-size:20px;min-width:100px;_width:120px}.mh_readtitle{position:relative;margin:40px 0;width:100%}.mh_readtitle h1{font:bold 32px/40px microsoft yahei,simhei,simsun,arial;color: #f00}.mh_readtitle a{height:50px;line-height:50px;position:absolute;top:10px}.mh_readtitle a.l{left:5px}.mh_readtitle a.r{right:5px}.mh_readtitle .readtip{color:#999;margin-top:5px}.mh_headpager,.mh_footpager{margin:20px 0;padding:15px 0;border:1px solid #ccc;border-radius:5px;background:#f6f6f6}.mh_bgcolor{overflow:hidden;border-radius:0;position:relative}.mh_bgcolor:hover{overflow:visible}.mh_bgcolor ul{position:absolute;top:30px;left:0;width:100%;z-index:999999}.mh_bgcolor li{list-style:none;height:25px}.mh_readend{font: 14px/25px "";margin:20px auto;border:5px solid #8bf;color: #17d;padding:50px;background:#eef;border-radius:5px;display:none}.mh_readend li{list-style:none;display:inline-block;*display:inline;*zoom:1;text-align:center;margin:30px 10px}.mh_readend li a{display:inline-block;*display:inline;*zoom:1;border-radius:5px;background:#cef;border:1px solid #8bf;padding:10px 30px;text-decoration:none}.mh_readend li a:hover{color:#fff;background:#17d;text-decoration:none}.mh_readend li a strong{display:block}.mh_readend .endtip2{border: 1px solid #fc9;padding:10px;margin:10px;background:#ffc;color:#e35;border-radius:3px}.mh_readend .endtip2 a{color:#e35;text-decoration:none}.ggbox{width:960px;overflow:hidden;margin:0 auto}.ggwarp{overflow:hidden}.ft-operate li{cursor:pointer;padding:10px;margin:0 10px;color:#444;display:inline-block;*display:inline;*zoom:1}.ft-operate li:hover{color:#17d;text-decoration:underline}.ft-operate li.active{font-weight:bold}' + (window.isMobile ? '.mh_wrap{width:100%;min-width:inherit}.mh_nav,.mh_nav p,.readtip{display:none}.mh_select,.mh_readmode{margin:0 5px;min-width:inherit;}.mh_foot{padding:0 0 200px 0}.mh_foot p{display:none;margin:0 10px}.mh_foot .commend{width:100%;border:6px solid #f6f6f6;box-sizing:border-box}.mh_foot .commend a{white-space:normal}.mh_btn{padding:0 10px;margin:0 5px;border-radius:3px;width:auto}.mh_btn:hover{font-weight:normal}.mh_comicpic .mh_loading,.mh_comicpic .mh_loaderr{font:18px/50px "";margin:10px auto 300px auto;padding:40px 0;border:none}.mh_readtitle{margin:10px 0}.mh_readtitle h1{font:bold 20px/40px microsoft yahei,simhei,simsun,arial;color:#f00;margin:0 70px;overflow:hidden;line-height:32px;height:32px}.mh_readtitle a{height:32px;line-height:32px;top:0}.mh_readend{padding:0;margin:0;border:none;background:inherit;border-radius:5px;display:none}.mh_readend li{margin:10px}.mh_headpager,.mh_footpager{margin:20px 0;padding:10px 0;text-align:center;border-radius:0}.mh_bgcolor{display:none}.mh_readtitle a.l,.mh_readtitle a.r{width:40px; overflow:hidden}.mh_readtitle a.l:first-letter,.mh_readtitle a.r:first-letter{margin:0 85px 0 -100px}' : ".w300{margin:0 5px;width:300px;height:250px;overflow:hidden;display:inline-block;*display:inline;*zoom:1}") + "</style>");
人造人
发表于 2018-10-25 23:04:09
暗夜之隐 发表于 2018-10-25 22:11
我看了一下您的代码 发现 这个规律才是解码关键pageid % 10 但是这个是那里来的 转换后的ascii码减去 ...
__cr.switchWebp = function(e, i) {
i = i || "-noresize";
return /-(\d+)x(\d+)/gi.test(e) || (e += i),
__cr.isSupportWebp() && /^(https?:)?(\/\/)/.test(e) ? e + ".webp" : e
}
def SwitchWebp(src, rules):
rules = rules or '-noresize'
src += rules
return src + '.webp'
__cr.getPicUrl = function (e) {
var i = lines.use_line,
o = parseInt(mh_info.startimg) + e - 1 + ".jpg",
t = "https://" + i + "/comic/" + mh_info.imgpath + o;
return __cr.switchWebp(t, mh_info.comic_size)
}
def GetPicUrl(mh_info, page):
fixed_line = 'mhpic.jumanhua.com'
filename = str(mh_info['startimg'] + page - 1) + '.jpg'
chapter_addr_rule = 'https://' + fixed_line + '/comic/' + mh_info['imgpath'] + filename
return SwitchWebp(chapter_addr_rule, mh_info['comic_size'])
暗夜之隐
发表于 2018-10-25 23:05:47
人造人 发表于 2018-10-25 23:01
通过动态调试找到的
厉害, 谢谢您。 我一会儿也去看一下麻烦您了
屌丝恨作业多
发表于 2018-10-25 23:17:40
感谢楼主分享!{:10_256:}
游学者
发表于 2018-10-26 00:03:37
强啊霸哥
Agoni
发表于 2018-10-26 03:54:45
看看