本帖最后由 fuochai 于 2023-4-19 14:14 编辑
游客,本帖隐藏的内容需要积分高于 1000 才可浏览,您当前积分为 0 使用方法:直接解压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[MAX_SIZE];
- _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 + "/([a-zA-Z0-9-]*\\.(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[i] != '\0'; i++) {
- if (line[i] >= '0' && line[i] <= '9') {
- pagenum = pagenum + line[i];
- }
- }
- while (pagenum.length() < 3) {
- pagenum = '0' + pagenum;
- }
- }
- if (line.find("img src") != string::npos) {
- //cout << line << endl;
- regex_search(line, matchResult, reg);
- pagename = matchResult[1];
- }
- if (pagenum != "" && pagename != "") {
- infile.close();
- break;
- }
- }
- if (pagename == "createby.png") {
- pagenum = "999";
- }
- regex_search(pagename, matchResult, reg2);
- picformat = matchResult[1];
- 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;
- }
复制代码
|