-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHTMLtoMarkdown.ahk
206 lines (178 loc) · 4.27 KB
/
HTMLtoMarkdown.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#singleInstance, force
Gui,+ToolWindow +AlwaysOnTop
Gui,Add,Text,x0 y80 w200 h100 +Center +cffffff vtext_err,Please drop only HTML / HTM!!
GuiControl,Hide,text_err
Gui,Add,Text,x0 y80 w200 h100 +Center vtext,Drop File HTML Here!
Gui,Show,,HTML to Markdown
Return
GuiClose:
ExitApp
Return
GuiDropFiles:
{
StringSplit, drop_filepath, A_GuiEvent, `n
SplitPath, drop_filepath1,, dir, ext
if (ext = "html") || (ext = "htm")
{
Gui,Color,00dd00
GuiControl,Show,text
GuiControl,Hide,text_err
Gosub, Start
}
else
{
Gui,Color,dd0000
GuiControl,Hide,text
GuiControl,Show,text_err
}
}
Return
Start:
;Img Cover
text_output := ""
i:=0
Loop, read, %drop_filepath1%
{
if RegExMatch(A_LoopReadLine, "<img s.*(jpg|png)", result)
{
rer := RegExReplace(result,"<img src=""","")
img_cover_%i% := rer
i++
}
if(i>0)
{
if RegExMatch(A_LoopReadLine, "<table")
{
break
}
}
}
im:=0
img_cover := ""
while(im<i)
{
img_cover .= "[![](" img_cover_%im% ")](" img_cover_%im% ")`r"
im++
}
text_output .= img_cover
;-----------------------------------------------------------------
;General Info Table
i:=0
j:=1
Loop, read, %drop_filepath1%
{
if RegExMatch(A_LoopReadLine, "<td id=""\d+"">.*", result)
{
rer := RegExReplace(result,"<td id=""\d+"">","")
rer := RegExReplace(rer,"<\/td>","")
i++
m := Mod(i, 2)
If(m = 1)
{
if RegExMatch(rer,"(<|<\/)strong>")
{
rer := RegExReplace(rer,"(<|<\/)strong>","**")
column1_%j% := rer
}
else
{
column1_%j% := rer " : "
}
}
else
{
column2_%j% := rer
j++
}
}
}
max_row := j
i:=1
combine:=""
while(i<max_row)
{
data1 .= column1_%i% "`r"
data2 .= column2_%i% "`r"
combine .= column1_%i% column2_%i% "`r"
i++
}
text_output .= "`r**General**"
text_output .= "`r"combine
;-----------------------------------------------------------------
;Img Thumbnail
i:=0
found := 0
Loop, read, %drop_filepath1%
{
if RegExMatch(A_LoopReadLine, "<\/table>")
{
found := 1
}
if(found = 1)
{
if RegExMatch(A_LoopReadLine, "<img s.*(jpg|png)", result)
{
rer := RegExReplace(result,"<img src=""","")
img_thumb_%i% := rer
i++
}
}
if(i>0)
{
if RegExMatch(A_LoopReadLine, "Sample")
{
break
}
}
}
im:=0
img_thumb:=""
while(im<i)
{
img_thumb .= "[![](" img_thumb_%im% ")](" img_thumb_%im% ")`r"
im++
}
text_output .= "`r"img_thumb
;-----------------------------------------------------------------
;Img Sample
i:=0
found := 0
Loop, read, %drop_filepath1%
{
if RegExMatch(A_LoopReadLine, "<div id=""spoiler")
{
found := 1
}
if(found = 1)
{
if RegExMatch(A_LoopReadLine, "<img s.*(jpg|png)", result)
{
rer := RegExReplace(result,"<img src=""","")
img_sam_%i% := rer
i++
}
}
if(i>0)
{
if RegExMatch(A_LoopReadLine, "Sample")
{
break
}
}
}
im:=0
img_sam:=""
while(im<i)
{
img_sam .= "[![](" img_sam_%im% ")](" img_sam_%im% ")`r"
im++
}
text_output .= "`r### Sample"
text_output .= "`r"img_sam
;-----------------------------------------------------------------
;Credit
add_text = ### This Video create with Waifu2X UpRGB Model (and a lot of filter)`r`rGood news. I now have a patreon account! Please consider supporting me on there so that I can continue to make these upscaled hentai, and continue to work on my N4A V2 program. With your support I will continue to post superior resolution hentai here for free. And just so everyone understands, I am not simply increasing resolution for these videos, but I am increasing the quality using my program. This takes a lot of time and a lot of CPU and GPU power. I don’t mind doing it, but any support will really help.`r`r- Patreon https://www.patreon.com/net4anime`r- Discord https://discord.gg/nTN86Pm`r- Facebook Page https://www.facebook.com/Net4Anime`r`r---`r`r- ``Can make tutorial about this?`` - Why not, but i'm not ready. It's hard to teach user to type command, therefore i creating GUI tools for newbie, like https://github.com/aaaboypop/N4A-V2`r- If you want to ``Request video to upscaling`` https://discord.gg/nTN86Pm
text_output .= "`r" add_text
msgbox, %text_output%
Clipboard:= text_output
Return