找回密码
 立即注册
搜索
查看: 2623|回复: 3

[漫画] 搓了个重排epub格式漫画混淆页码的工具 分享一下

[复制链接]
     
发表于 2023-4-19 14:12 | 显示全部楼层 |阅读模式
本帖最后由 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从图片转的

不想下载的可以自己编译 对其他格式的需要重排的也可以改源码
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <io.h>
  4. #include <string>
  5. #include <direct.h>
  6. #include <fstream>
  7. #include <regex>
  8. using namespace std;
  9. #define MAX_SIZE 500

  10. int main()
  11. {
  12.     char buff[MAX_SIZE];
  13.     _getcwd(buff, MAX_SIZE);
  14.     string cd(buff);

  15.     string data = "html";
  16.     string pic = "image";
  17.     string oldname = data + "/a.txt";
  18.     string newname = data + "/b.txt";
  19.         string Path;
  20.     Path = cd + '\\';
  21.     string filename, temp, picformat;
  22.     string line, pagenum = "", pagename = "";
  23.     regex regnum("(\\d*)");
  24.     regex reg(pic + "/([a-zA-Z0-9-]*\\.(jpg|png))"");
  25.     regex reg2("\\.(.*)");
  26.     smatch matchResult;
  27.     long handle;
  28.     struct _finddata_t fileinfo;
  29.    
  30.     handle = _findfirst((Path + data + "\\*.html").c_str(), &fileinfo);
  31.     if (handle == -1)
  32.         return -1;
  33.     do
  34.     {
  35.         filename = fileinfo.name;
  36.         
  37.         ifstream infile;
  38.         infile.open(Path + data + '\\' + filename);
  39.         while (getline(infile, line))
  40.         {
  41.             if (line.find("title") != string::npos) {
  42.                 for (int i = 0; line[i] != '\0'; i++) {
  43.                     if (line[i] >= '0' && line[i] <= '9') {
  44.                         pagenum = pagenum + line[i];
  45.                     }
  46.                 }
  47.                 while (pagenum.length() < 3) {
  48.                     pagenum = '0' + pagenum;
  49.                 }
  50.             }
  51.             if (line.find("img src") != string::npos) {
  52.                 //cout << line << endl;
  53.                 regex_search(line, matchResult, reg);
  54.                 pagename = matchResult[1];
  55.             }
  56.             if (pagenum != "" && pagename != "") {
  57.                 infile.close();
  58.                 break;
  59.             }
  60.         }
  61.         if (pagename == "createby.png") {
  62.             pagenum = "999";
  63.         }
  64.         regex_search(pagename, matchResult, reg2);
  65.         picformat = matchResult[1];
  66.         oldname = Path + pic + '\\' + pagename;
  67.         newname = Path + pic + '\\' + pagenum + '.' + picformat;
  68.         if (pagename != "") {
  69.             if (rename(oldname.c_str(), newname.c_str()) == 0) {
  70.                 cout << "将" << oldname << "重命名为" << newname << endl;
  71.             }
  72.         }
  73.         pagenum = "";
  74.         pagename = "";
  75.     } while (!_findnext(handle, &fileinfo));

  76.     _findclose(handle);

  77.     system("pause");
  78.         return 0;
  79. }
复制代码



回复

使用道具 举报

     
发表于 2023-4-21 10:38 | 显示全部楼层
感谢分享
回复

使用道具 举报

     
发表于 2023-4-21 10:41 来自手机 | 显示全部楼层
本帖最后由 azbhg1 于 2023-4-21 13:29 编辑

编辑,我怎么莫名其妙回复了这个贴子
回复

使用道具 举报

     
发表于 2023-5-15 17:44 | 显示全部楼层
大佬牛逼,页码折腾死我了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|上海互联网违法和不良信息举报中心|网上有害信息举报专区|962110 反电信诈骗|举报电话 021-62035905|Stage1st ( 沪ICP备13020230号-1|沪公网安备 31010702007642号 )

GMT+8, 2025-2-1 16:47 , Processed in 0.030912 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表