搓了个重排epub格式漫画混淆页码的工具 分享一下
本帖最后由 fuochai 于 2023-4-19 14:14 编辑**** Hidden Message *****使用方法:直接解压epub或者改后缀名为zip 解压出文件夹html和image 将exe与html和image放在同一目录下 运行exe即可
因为某三字母的漫画下载站只有mobi/epub格式下载 但我十分需要pdf/zip格式 epub直接解压出来的页码标号是乱的(calibre的转换pdf有分页问题) 所以搓了一个工具 顺便分享一下 这种东西小范围享受就可以了 别发到其他地方
一直用的epub格式 写完才发现这个站的mobi没有混淆 可以直接用calibre转zip 但是这个站下载限速限总量 所以我还是用epub小一点比较好
pdf我是用ps从图片转的
不想下载的可以自己编译 对其他格式的需要重排的也可以改源码
#include <iostream>
#include <stdio.h>
#include <io.h>
#include <string>
#include <direct.h>
#include <fstream>
#include <regex>
using namespace std;
#define MAX_SIZE 500
int main()
{
char buff;
_getcwd(buff, MAX_SIZE);
string cd(buff);
string data = "html";
string pic = "image";
string oldname = data + "/a.txt";
string newname = data + "/b.txt";
string Path;
Path = cd + '\\';
string filename, temp, picformat;
string line, pagenum = "", pagename = "";
regex regnum("(\\d*)");
regex reg(pic + "/(*\\.(jpg|png))\"");
regex reg2("\\.(.*)");
smatch matchResult;
long handle;
struct _finddata_t fileinfo;
handle = _findfirst((Path + data + "\\*.html").c_str(), &fileinfo);
if (handle == -1)
return -1;
do
{
filename = fileinfo.name;
ifstream infile;
infile.open(Path + data + '\\' + filename);
while (getline(infile, line))
{
if (line.find("title") != string::npos) {
for (int i = 0; line != '\0'; i++) {
if (line >= '0' && line <= '9') {
pagenum = pagenum + line;
}
}
while (pagenum.length() < 3) {
pagenum = '0' + pagenum;
}
}
if (line.find("img src") != string::npos) {
//cout << line << endl;
regex_search(line, matchResult, reg);
pagename = matchResult;
}
if (pagenum != "" && pagename != "") {
infile.close();
break;
}
}
if (pagename == "createby.png") {
pagenum = "999";
}
regex_search(pagename, matchResult, reg2);
picformat = matchResult;
oldname = Path + pic + '\\' + pagename;
newname = Path + pic + '\\' + pagenum + '.' + picformat;
if (pagename != "") {
if (rename(oldname.c_str(), newname.c_str()) == 0) {
cout << "将" << oldname << "重命名为" << newname << endl;
}
}
pagenum = "";
pagename = "";
} while (!_findnext(handle, &fileinfo));
_findclose(handle);
system("pause");
return 0;
}
感谢分享 本帖最后由 azbhg1 于 2023-4-21 13:29 编辑
编辑,我怎么莫名其妙回复了这个贴子 大佬牛逼,页码折腾死我了
页:
[1]