Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Readcomiconline download issue #1089

Closed
EpicLunchBox opened this issue Sep 16, 2022 · 3 comments · Fixed by #1112
Closed

[bug] Readcomiconline download issue #1089

EpicLunchBox opened this issue Sep 16, 2022 · 3 comments · Fixed by #1112

Comments

@EpicLunchBox
Copy link

Prerequisite

  • ✅ I'm using the latest version.
  • ✅ All website modules are up to date.
  • ✅ This is not temporary server issue.

System information
Win10

Describe the bug
I can't download any comic from the website. In status shows "Failed, try resuming task!" I tried that and nothing changed at all.

Screenshots
Captura de pantalla (31)

@cobaltsardine
Copy link

I think this is related to the beau function in https://readcomiconline.li/Scripts/rguard.min.js?v=1.2.4 which obfuscates the image urls

@cobaltsardine
Copy link

@Slasar41 Could you help test this fix?

Based on the rguard.min.js version 1.2.4 file and a previous issue in Xonshiz/comic-dl#299, I figured out the code to de-obfuscate a single image identifier based on :

        if (wv.indexOf("https") !== 0) {
            var m = wv;
            var containsS = m.indexOf("=s0?") > 0
            var x = m.substring(m.indexOf("?"));
            if (containsS) {
            	m = m.substring(0, m.indexOf("=s0?"));
            } else {
            	m = m.substring(0, m.indexOf("=s1600?"));
            }
            m = m.substring(4, 22) + m.substring(25)
            m = m.substring(0, m.length - 6) + m[m.length - 2] + m[m.length - 1];
            m = decodeURIComponent(escape(atob(m)));
            m = m.substring(0, 13) + m.substring(17);
            if (containsS) {
            	m = m.substring(0, m.length - 2) + "=s0";
        	} else {
        		m = m.substring(0, m.length - 2) + "=s1600";
        	}
            m = m + x;
            wv = "https://2.bp.blogspot.com/" + m;
        }

I then put it through a javascript to lua converter online, and then put it into the GetPageNumber() function in ReadComicOnline.lua:

function GetPageNumber()
	local u = MaybeFillHost(MODULE.RootURL, URL .. '&quality=hq')
	if MODULE.GetOption('datasaver') then
		u = MaybeFillHost(MODULE.RootURL, URL .. '&quality=lq')
	end
	sleep(3000)
	if HTTP.GET(u) then
		local body = HTTP.Document.ToString()
		local s = body:match('var%s+lstImages%s+.-;(.-)%s+var%s')
		local i; for i in s:gmatch('%('(.-)'%)') do
			--new code based on view-source:https://readcomiconline.li/Scripts/rguard.min.js?v=1.2.4
			wv = i:gsub("_x236", "d")
			wv = wv:gsub("_x945", "g")
			if wv.indexOf("https") ~= 0 then
			    local m = wv
			    local containsS = m.indexOf("=s0?") > 0
			    local x = m.substring(m.indexOf("?"))
			    if containsS then
			        m = m.substring(0, m.indexOf("=s0?"))
			    else
			        m = m.substring(0, m.indexOf("=s1600?"))
			    end
			    m = m.substring(4, 22) + m.substring(25)
			    m = m.substring(0, m.length - 6) + m[m.length - 2] + m[m.length - 1]
			    m = decodeURIComponent(escape(atob(m)))
			    m = m.substring(0, 13) + m.substring(17)
			    if containsS then
			        m = m.substring(0, m.length - 2) + "=s0"
			    else
			        m = m.substring(0, m.length - 2) + "=s1600"
			    end
			    m = m + x
			    wv = "https://2.bp.blogspot.com/" + m
			end
			TASK.PageLinks.Add(wv)
		end
		return true
	else
		return false
	end
end

However, I run into problems trying to test it on fmd2. Do I have to install lua or compile fmd2 from source? I tried running fmd.exe after changing lua/modules/ReadComicOnline.lua directly but now it won't show up in the list of websites.

@Slasar41
Copy link
Collaborator

@cobaltsardine There's no need to compile FMD yourself to test a website module.
You can check Options -> Misc. -> Logs to see what happen with a failed website module.

cobaltsardine added a commit to cobaltsardine/FMD2 that referenced this issue Oct 18, 2022
@Slasar41 Slasar41 linked a pull request Oct 19, 2022 that will close this issue
Slasar41 pushed a commit that referenced this issue Oct 19, 2022
* Fix ReadComicOnline 

Possibly fixes #1028 and #1089

* Use fmd2 base64 decoder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants