xl1 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-LZNQK7N5.js +1 -0
- package/dist/{chunk-KLMDRKHJ.js → chunk-NHACCVY4.js} +1 -1
- package/dist/css/github1.css +686 -0
- package/dist/mdd/index.js +3 -0
- package/dist/mdm/index.js +5 -0
- package/dist/quipdl/index.js +1 -1
- package/dist/ssdl/index.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-CGHM55QB.js +0 -1
- package/dist/jsd1/index.js +0 -3
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNEJSZOZXjs = require('./chunk-NEJSZOZX.js');var T=_chunkNEJSZOZXjs.b.call(void 0, (P,u)=>{var b=_chunkNEJSZOZXjs.a.call(void 0, "puppeteer"),v=_chunkNEJSZOZXjs.a.call(void 0, "fs"),x=_chunkNEJSZOZXjs.a.call(void 0, "path");function k(a,l){let s=/(?:href|src)=["'](\/[^"']+)["']/g;return a.replace(s,(d,i)=>{let n=new URL(i,l).href;return d.replace(i,n)})}async function $(a,l="./",s="",d=!1){let i=a.split("/").pop().split("?")[0].split("#")[0].replace(/[<>:"/\\|?*]/g,"-");if(!a.startsWith("https://quip.com/"))throw new Error("Invalid Quip URL. URL must start with https://quip.com/");if(v.readdirSync(l).some(o=>o.endsWith(`${i}.pdf`))&&!d)return;let n=await b.launch({headless:"new",args:["--no-sandbox","--disable-setuid-sandbox",'--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"']});try{let o=await n.newPage();await o.setViewport({width:1200,height:800}),await o.goto(a,{waitUntil:"networkidle0",timeout:3e4}),await o.waitForSelector(".document-content"),await o.evaluate(()=>{let t=document.querySelector(".navigation-controller-header");t&&t.remove();let e=document.querySelector(".navigation-controller-body");e&&(e.classList.remove("navigation-controller-body"),e.removeAttribute("style"))}),await o.evaluate(async()=>{let t=0;for(;t<20;){let e=document.querySelectorAll("a");e[e.length-1].scrollIntoView({behavior:"smooth",block:"start"}),await new Promise(r=>setTimeout(r,2e3)),t++}});let h=await o.title(),p=await o.evaluate(()=>{let t=document.querySelectorAll('link[rel="stylesheet"]');return Array.from(t).map(e=>e.href)}),m=await o.$eval(".document-content",t=>t.outerHTML),g=k(m,a),c=await n.newPage();await c.setContent(`<html><head><title>${h}</title>${p.map(t=>`<link rel="stylesheet" href="${t}">`).join("")}<style>img { max-width: 595px; height: auto; } body { padding-left: 40px; padding-right: 40px; }</style></head><body><h1><a href="${a}">${h}</a></h1><div>${g}</div></body></html>`,{waitUntil:"networkidle0"}),await c.evaluate(async()=>{let t=0,e=document.body.scrollHeight;for(await new Promise(r=>setTimeout(r,2e3));t!==e;)window.scrollTo(0,e),await new Promise(r=>setTimeout(r,2e3)),t=e,e=document.body.scrollHeight;window.scrollTo(0,0)});let y=(s||"")+`${h}-${i}.pdf`.replace(/[<>:"/\\|?*]/g,"-");await c.pdf({path:x.join(l,y),format:"A4",fullPage:!0,printBackground:!1,margin:{top:"20px",right:"20px",bottom:"20px",left:"20px"}}),await c.close()}catch(o){console.error("Error generating PDF:",o)}finally{await n.close()}}u.exports={quipdl:$}});exports.a = T;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEJUO2FGUjs = require('./chunk-EJUO2FGU.js');var _chunkY4GMOS4Yjs = require('./chunk-Y4GMOS4Y.js');var _chunkNEJSZOZXjs = require('./chunk-NEJSZOZX.js');var q=_chunkNEJSZOZXjs.b.call(void 0, (M,f)=>{var p=_chunkNEJSZOZXjs.a.call(void 0, "axios"),w=_chunkNEJSZOZXjs.a.call(void 0, "cheerio"),c=_chunkNEJSZOZXjs.a.call(void 0, "fs"),r=_chunkNEJSZOZXjs.a.call(void 0, "path"),{format:u}=_chunkNEJSZOZXjs.a.call(void 0, "date-fns"),l=_chunkNEJSZOZXjs.a.call(void 0, "winston"),{convertImagesToPDF:S}=_chunkY4GMOS4Yjs.a.call(void 0, ),{convertImagesToPPTX:P}=_chunkEJUO2FGUjs.a.call(void 0, ),a=l.createLogger({level:process.env.LOG_LEVEL||"info",format:l.format.combine(l.format.timestamp(),l.format.printf(({timestamp:h,level:t,message:e})=>`${h} [${t}]: ${e}`)),transports:[new l.transports.Console,new l.transports.File({filename:"combined.log"})]}),g=class{constructor(t,e=null){let{url:s,filename:n}=this.urlParse(t);this.url=s,this.filename=e?e+n:n,this.title="",this.images=[],this.meta={}}urlParse(t){(t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"'))&&(t=t.slice(1,-1)),!t.startsWith("http://")&&!t.startsWith("https://")&&(t="https://"+t);let e=t.split("/").slice(3,5).join("_").replace(/[^0-9a-zA-Z]+/g,"-");return e.trim()===""&&(a.debug("Something wrong to get filename from URL, fallback to result.pdf"),e="output"),{url:t,filename:e}}async startParse(){let e=(await p.get(this.url)).data,s=w.load(e);return this.title=`pdf_images_${u(new Date,"yyyy/MM/dd_HH:mm:ss")}`,this.images=s('img[data-testid="vertical-slide-image"]').toArray(),a.debug(this.images),this.getMeta(s)}async startDownload(t,e,s=!1){if(c.existsSync(t)&&c.readdirSync(t).some(m=>m.match(/\.(jpg|jpeg|png|gif)$/i))){a.debug("images dir is exist",t);return}let n=await this.startParse();if(!this.images||this.images.length===0){a.debug("no image to download");return}let i=r.resolve(r.join(t,this.filename));c.existsSync(i)||c.mkdirSync(i,{recursive:!0});for(let m of this.images){a.debug(m);let d=m.attribs.srcset.split(",").pop().split(" ")[1];a.debug(d),await this.saveFile(d,i)}return console.log("Download completed!",r.join(i)),e.includes("pdf")&&S(i,r.join(t,`${this.filename}.pdf`),s),e.includes("pptx")&&P(i,r.join(t,`${this.filename}.pptx`),s),n}async saveFile(t,e){let s=r.join(e,r.basename(t));if(c.existsSync(s)){a.debug(`file exist! ${s}`);return}(await p.get(t,{responseType:"stream"})).data.pipe(c.createWriteStream(s))}clean(t){return String(t).trim()}getTitle(t){try{return this.clean(t("span.j-title-breadcrumb").text())}catch (e2){return""}}getDesc(t){try{return t("ol.transcripts").children("li").toArray().map(s=>this.clean(t(s).text()))}catch (e3){return[]}}getSummary(t){try{return this.clean(t("#slideshow-description-paragraph").text())}catch (e4){return""}}getAuthor(t){try{return this.clean(t('span[itemprop="name"]').text())}catch (e5){return""}}getPublish(t){try{return this.clean(t('time[itemprop="datePublished"]').text())}catch (e6){return""}}getMeta(t){return this.meta={url:this.url,name:this.filename,title:this.getTitle(t),summary:this.getSummary(t),publish:this.getPublish(t),desc:this.getDesc(t),author:this.getAuthor(t),created_at:u(new Date,"yyyy/MM/dd HH:mm:ss")},this.meta}};async function j(h,t,e,s=["pptx","pdf"],n=!1){await new g(h,e).startDownload(t,s)}f.exports={startDownloadSlideShare:j}});exports.a = q;
|
@@ -0,0 +1,686 @@
|
|
1
|
+
@font-face {
|
2
|
+
font-family: octicons-link;
|
3
|
+
src: url(data:font/woff;charset=utf-8;base64,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)
|
4
|
+
format('woff');
|
5
|
+
}
|
6
|
+
|
7
|
+
body {
|
8
|
+
-webkit-text-size-adjust: 100%;
|
9
|
+
text-size-adjust: 100%;
|
10
|
+
color: #333;
|
11
|
+
font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji',
|
12
|
+
'Segoe UI Emoji', 'Segoe UI Symbol';
|
13
|
+
font-size: 16px;
|
14
|
+
line-height: 1.6;
|
15
|
+
word-wrap: break-word;
|
16
|
+
width: 728px;
|
17
|
+
max-width: 99%;
|
18
|
+
box-sizing: border-box;
|
19
|
+
padding: 30px 30px 8rem 30px;
|
20
|
+
margin-left: auto;
|
21
|
+
margin-right: auto;
|
22
|
+
}
|
23
|
+
|
24
|
+
body a {
|
25
|
+
background-color: transparent;
|
26
|
+
}
|
27
|
+
|
28
|
+
body a:active,
|
29
|
+
body a:hover {
|
30
|
+
outline: 0;
|
31
|
+
}
|
32
|
+
|
33
|
+
body strong {
|
34
|
+
font-weight: bold;
|
35
|
+
}
|
36
|
+
|
37
|
+
body h1 {
|
38
|
+
font-size: 2em;
|
39
|
+
margin: 0.67em 0;
|
40
|
+
}
|
41
|
+
|
42
|
+
body img {
|
43
|
+
border: 0;
|
44
|
+
}
|
45
|
+
|
46
|
+
body hr {
|
47
|
+
box-sizing: content-box;
|
48
|
+
height: 0;
|
49
|
+
}
|
50
|
+
|
51
|
+
body pre {
|
52
|
+
overflow: auto;
|
53
|
+
}
|
54
|
+
|
55
|
+
body code,
|
56
|
+
body kbd,
|
57
|
+
body pre {
|
58
|
+
font-family: monospace, monospace;
|
59
|
+
font-size: 1em;
|
60
|
+
}
|
61
|
+
|
62
|
+
body input {
|
63
|
+
color: inherit;
|
64
|
+
font: inherit;
|
65
|
+
margin: 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
body html input[disabled] {
|
69
|
+
cursor: default;
|
70
|
+
}
|
71
|
+
|
72
|
+
body input {
|
73
|
+
line-height: normal;
|
74
|
+
}
|
75
|
+
|
76
|
+
body input[type='checkbox'] {
|
77
|
+
box-sizing: border-box;
|
78
|
+
padding: 0;
|
79
|
+
}
|
80
|
+
|
81
|
+
body table {
|
82
|
+
border-collapse: collapse;
|
83
|
+
border-spacing: 0;
|
84
|
+
}
|
85
|
+
|
86
|
+
body td,
|
87
|
+
body th {
|
88
|
+
padding: 0;
|
89
|
+
}
|
90
|
+
|
91
|
+
body * {
|
92
|
+
box-sizing: border-box;
|
93
|
+
}
|
94
|
+
|
95
|
+
body input {
|
96
|
+
font:
|
97
|
+
13px / 1.4 Helvetica,
|
98
|
+
arial,
|
99
|
+
nimbussansl,
|
100
|
+
liberationsans,
|
101
|
+
freesans,
|
102
|
+
clean,
|
103
|
+
sans-serif,
|
104
|
+
'Apple Color Emoji',
|
105
|
+
'Segoe UI Emoji',
|
106
|
+
'Segoe UI Symbol';
|
107
|
+
}
|
108
|
+
|
109
|
+
body a {
|
110
|
+
color: #4078c0;
|
111
|
+
text-decoration: none;
|
112
|
+
}
|
113
|
+
|
114
|
+
body a:hover,
|
115
|
+
body a:active {
|
116
|
+
text-decoration: underline;
|
117
|
+
}
|
118
|
+
|
119
|
+
body hr {
|
120
|
+
height: 0;
|
121
|
+
margin: 15px 0;
|
122
|
+
overflow: hidden;
|
123
|
+
background: transparent;
|
124
|
+
border: 0;
|
125
|
+
border-bottom: 1px solid #ddd;
|
126
|
+
}
|
127
|
+
|
128
|
+
body hr:before {
|
129
|
+
display: table;
|
130
|
+
content: '';
|
131
|
+
}
|
132
|
+
|
133
|
+
body hr:after {
|
134
|
+
display: table;
|
135
|
+
clear: both;
|
136
|
+
content: '';
|
137
|
+
}
|
138
|
+
|
139
|
+
body h1,
|
140
|
+
body h2,
|
141
|
+
body h3,
|
142
|
+
body h4,
|
143
|
+
body h5,
|
144
|
+
body h6 {
|
145
|
+
margin-top: 15px;
|
146
|
+
margin-bottom: 15px;
|
147
|
+
line-height: 1.1;
|
148
|
+
}
|
149
|
+
|
150
|
+
body h1 {
|
151
|
+
font-size: 30px;
|
152
|
+
}
|
153
|
+
|
154
|
+
body h2 {
|
155
|
+
font-size: 21px;
|
156
|
+
}
|
157
|
+
|
158
|
+
body h3 {
|
159
|
+
font-size: 16px;
|
160
|
+
}
|
161
|
+
|
162
|
+
body h4 {
|
163
|
+
font-size: 14px;
|
164
|
+
}
|
165
|
+
|
166
|
+
body h5 {
|
167
|
+
font-size: 12px;
|
168
|
+
}
|
169
|
+
|
170
|
+
body h6 {
|
171
|
+
font-size: 11px;
|
172
|
+
}
|
173
|
+
|
174
|
+
body blockquote {
|
175
|
+
margin: 0;
|
176
|
+
}
|
177
|
+
|
178
|
+
body ul,
|
179
|
+
body ol {
|
180
|
+
padding: 0;
|
181
|
+
margin-top: 0;
|
182
|
+
margin-bottom: 0;
|
183
|
+
}
|
184
|
+
|
185
|
+
body ol ol,
|
186
|
+
body ul ol {
|
187
|
+
list-style-type: lower-roman;
|
188
|
+
}
|
189
|
+
|
190
|
+
body ul ul ol,
|
191
|
+
body ul ol ol,
|
192
|
+
body ol ul ol,
|
193
|
+
body ol ol ol {
|
194
|
+
list-style-type: lower-alpha;
|
195
|
+
}
|
196
|
+
|
197
|
+
body dd {
|
198
|
+
margin-left: 0;
|
199
|
+
}
|
200
|
+
|
201
|
+
body code {
|
202
|
+
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
203
|
+
font-size: 12px;
|
204
|
+
}
|
205
|
+
|
206
|
+
body pre {
|
207
|
+
margin-top: 0;
|
208
|
+
margin-bottom: 0;
|
209
|
+
font:
|
210
|
+
12px Consolas,
|
211
|
+
'Liberation Mono',
|
212
|
+
Menlo,
|
213
|
+
Courier,
|
214
|
+
monospace;
|
215
|
+
}
|
216
|
+
|
217
|
+
body .select::-ms-expand {
|
218
|
+
opacity: 0;
|
219
|
+
}
|
220
|
+
|
221
|
+
body .octicon {
|
222
|
+
font: normal normal normal 16px/1 octicons-link;
|
223
|
+
display: inline-block;
|
224
|
+
text-decoration: none;
|
225
|
+
text-rendering: auto;
|
226
|
+
-webkit-font-smoothing: antialiased;
|
227
|
+
-moz-osx-font-smoothing: grayscale;
|
228
|
+
-webkit-user-select: none;
|
229
|
+
-moz-user-select: none;
|
230
|
+
-ms-user-select: none;
|
231
|
+
user-select: none;
|
232
|
+
}
|
233
|
+
|
234
|
+
body .octicon-link:before {
|
235
|
+
content: '\f05c';
|
236
|
+
}
|
237
|
+
|
238
|
+
body:before {
|
239
|
+
display: table;
|
240
|
+
content: '';
|
241
|
+
}
|
242
|
+
|
243
|
+
body:after {
|
244
|
+
display: table;
|
245
|
+
clear: both;
|
246
|
+
content: '';
|
247
|
+
}
|
248
|
+
|
249
|
+
body > *:first-child {
|
250
|
+
margin-top: 0 !important;
|
251
|
+
}
|
252
|
+
|
253
|
+
body > *:last-child {
|
254
|
+
margin-bottom: 0 !important;
|
255
|
+
}
|
256
|
+
|
257
|
+
body a:not([href]) {
|
258
|
+
color: inherit;
|
259
|
+
text-decoration: none;
|
260
|
+
}
|
261
|
+
|
262
|
+
body .anchor {
|
263
|
+
display: inline-block;
|
264
|
+
padding-right: 2px;
|
265
|
+
margin-left: -18px;
|
266
|
+
}
|
267
|
+
|
268
|
+
body .anchor:focus {
|
269
|
+
outline: none;
|
270
|
+
}
|
271
|
+
|
272
|
+
body h1,
|
273
|
+
body h2,
|
274
|
+
body h3,
|
275
|
+
body h4,
|
276
|
+
body h5,
|
277
|
+
body h6 {
|
278
|
+
margin-top: 1em;
|
279
|
+
margin-bottom: 16px;
|
280
|
+
font-weight: bold;
|
281
|
+
line-height: 1.4;
|
282
|
+
}
|
283
|
+
|
284
|
+
body h1 .octicon-link,
|
285
|
+
body h2 .octicon-link,
|
286
|
+
body h3 .octicon-link,
|
287
|
+
body h4 .octicon-link,
|
288
|
+
body h5 .octicon-link,
|
289
|
+
body h6 .octicon-link {
|
290
|
+
color: #000;
|
291
|
+
vertical-align: middle;
|
292
|
+
visibility: hidden;
|
293
|
+
}
|
294
|
+
|
295
|
+
body h1:hover .anchor,
|
296
|
+
body h2:hover .anchor,
|
297
|
+
body h3:hover .anchor,
|
298
|
+
body h4:hover .anchor,
|
299
|
+
body h5:hover .anchor,
|
300
|
+
body h6:hover .anchor {
|
301
|
+
text-decoration: none;
|
302
|
+
}
|
303
|
+
|
304
|
+
body h1:hover .anchor .octicon-link,
|
305
|
+
body h2:hover .anchor .octicon-link,
|
306
|
+
body h3:hover .anchor .octicon-link,
|
307
|
+
body h4:hover .anchor .octicon-link,
|
308
|
+
body h5:hover .anchor .octicon-link,
|
309
|
+
body h6:hover .anchor .octicon-link {
|
310
|
+
visibility: visible;
|
311
|
+
}
|
312
|
+
|
313
|
+
body h1 {
|
314
|
+
padding-bottom: 0.3em;
|
315
|
+
font-size: 1.75em;
|
316
|
+
line-height: 1.2;
|
317
|
+
}
|
318
|
+
|
319
|
+
body h1 .anchor {
|
320
|
+
line-height: 1;
|
321
|
+
}
|
322
|
+
|
323
|
+
body h2 {
|
324
|
+
padding-bottom: 0.3em;
|
325
|
+
font-size: 1.5em;
|
326
|
+
line-height: 1.225;
|
327
|
+
}
|
328
|
+
|
329
|
+
body h2 .anchor {
|
330
|
+
line-height: 1;
|
331
|
+
}
|
332
|
+
|
333
|
+
body h3 {
|
334
|
+
font-size: 1.25em;
|
335
|
+
line-height: 1.43;
|
336
|
+
}
|
337
|
+
|
338
|
+
body h3 .anchor {
|
339
|
+
line-height: 1.2;
|
340
|
+
}
|
341
|
+
|
342
|
+
body h4 {
|
343
|
+
font-size: 1em;
|
344
|
+
}
|
345
|
+
|
346
|
+
body h4 .anchor {
|
347
|
+
line-height: 1.2;
|
348
|
+
}
|
349
|
+
|
350
|
+
body h5 {
|
351
|
+
font-size: 1em;
|
352
|
+
}
|
353
|
+
|
354
|
+
body h5 .anchor {
|
355
|
+
line-height: 1.1;
|
356
|
+
}
|
357
|
+
|
358
|
+
body h6 {
|
359
|
+
font-size: 1em;
|
360
|
+
color: #777;
|
361
|
+
}
|
362
|
+
|
363
|
+
body h6 .anchor {
|
364
|
+
line-height: 1.1;
|
365
|
+
}
|
366
|
+
|
367
|
+
body p,
|
368
|
+
body blockquote,
|
369
|
+
body ul,
|
370
|
+
body ol,
|
371
|
+
body dl,
|
372
|
+
body table,
|
373
|
+
body pre {
|
374
|
+
margin-top: 0;
|
375
|
+
margin-bottom: 16px;
|
376
|
+
}
|
377
|
+
|
378
|
+
body hr {
|
379
|
+
height: 4px;
|
380
|
+
padding: 0;
|
381
|
+
margin: 16px 0;
|
382
|
+
background-color: #e7e7e7;
|
383
|
+
border: 0 none;
|
384
|
+
}
|
385
|
+
|
386
|
+
body ul,
|
387
|
+
body ol {
|
388
|
+
padding-left: 2em;
|
389
|
+
}
|
390
|
+
|
391
|
+
body ul ul,
|
392
|
+
body ul ol,
|
393
|
+
body ol ol,
|
394
|
+
body ol ul {
|
395
|
+
margin-top: 0;
|
396
|
+
margin-bottom: 0;
|
397
|
+
}
|
398
|
+
|
399
|
+
body li > p {
|
400
|
+
margin-top: 16px;
|
401
|
+
}
|
402
|
+
|
403
|
+
body dl {
|
404
|
+
padding: 0;
|
405
|
+
}
|
406
|
+
|
407
|
+
body dl dt {
|
408
|
+
padding: 0;
|
409
|
+
margin-top: 16px;
|
410
|
+
font-size: 1em;
|
411
|
+
font-style: italic;
|
412
|
+
font-weight: bold;
|
413
|
+
}
|
414
|
+
|
415
|
+
body dl dd {
|
416
|
+
padding: 0 16px;
|
417
|
+
margin-bottom: 16px;
|
418
|
+
}
|
419
|
+
|
420
|
+
body blockquote {
|
421
|
+
padding: 0 15px;
|
422
|
+
color: #777;
|
423
|
+
border-left: 4px solid #ddd;
|
424
|
+
}
|
425
|
+
|
426
|
+
body blockquote > :first-child {
|
427
|
+
margin-top: 0;
|
428
|
+
}
|
429
|
+
|
430
|
+
body blockquote > :last-child {
|
431
|
+
margin-bottom: 0;
|
432
|
+
}
|
433
|
+
|
434
|
+
body table {
|
435
|
+
display: block;
|
436
|
+
width: 100%;
|
437
|
+
overflow: auto;
|
438
|
+
word-break: normal;
|
439
|
+
word-break: keep-all;
|
440
|
+
}
|
441
|
+
|
442
|
+
body table th {
|
443
|
+
font-weight: bold;
|
444
|
+
}
|
445
|
+
|
446
|
+
body table th,
|
447
|
+
body table td {
|
448
|
+
padding: 6px 13px;
|
449
|
+
border: 1px solid #ddd;
|
450
|
+
}
|
451
|
+
|
452
|
+
body table tr {
|
453
|
+
background-color: #fff;
|
454
|
+
border-top: 1px solid #ccc;
|
455
|
+
}
|
456
|
+
|
457
|
+
body table tr:nth-child(2n) {
|
458
|
+
background-color: #f8f8f8;
|
459
|
+
}
|
460
|
+
|
461
|
+
body img {
|
462
|
+
max-width: 100%;
|
463
|
+
box-sizing: content-box;
|
464
|
+
background-color: #fff;
|
465
|
+
}
|
466
|
+
|
467
|
+
body code {
|
468
|
+
padding: 0;
|
469
|
+
padding-top: 0;
|
470
|
+
padding-bottom: 0;
|
471
|
+
margin: 0;
|
472
|
+
font-size: 85%;
|
473
|
+
background-color: rgba(0, 0, 0, 0.04);
|
474
|
+
border-radius: 3px;
|
475
|
+
}
|
476
|
+
|
477
|
+
body code:before,
|
478
|
+
body code:after {
|
479
|
+
letter-spacing: -0.2em;
|
480
|
+
content: '\00a0';
|
481
|
+
}
|
482
|
+
|
483
|
+
body pre > code {
|
484
|
+
padding: 0;
|
485
|
+
margin: 0;
|
486
|
+
font-size: 100%;
|
487
|
+
word-break: normal;
|
488
|
+
white-space: pre;
|
489
|
+
background: transparent;
|
490
|
+
border: 0;
|
491
|
+
}
|
492
|
+
|
493
|
+
body .highlight {
|
494
|
+
margin-bottom: 16px;
|
495
|
+
}
|
496
|
+
|
497
|
+
body .highlight pre,
|
498
|
+
body pre {
|
499
|
+
padding: 16px;
|
500
|
+
overflow: auto;
|
501
|
+
font-size: 85%;
|
502
|
+
line-height: 1.45;
|
503
|
+
background-color: #f7f7f7;
|
504
|
+
border-radius: 3px;
|
505
|
+
}
|
506
|
+
|
507
|
+
.sourceCode {
|
508
|
+
background-color: #f7f7f7;
|
509
|
+
}
|
510
|
+
|
511
|
+
body .highlight pre {
|
512
|
+
margin-bottom: 0;
|
513
|
+
word-break: normal;
|
514
|
+
}
|
515
|
+
|
516
|
+
body pre {
|
517
|
+
word-wrap: normal;
|
518
|
+
}
|
519
|
+
|
520
|
+
body pre code {
|
521
|
+
display: inline;
|
522
|
+
max-width: initial;
|
523
|
+
padding: 0;
|
524
|
+
margin: 0;
|
525
|
+
overflow: initial;
|
526
|
+
line-height: inherit;
|
527
|
+
word-wrap: normal;
|
528
|
+
background-color: transparent;
|
529
|
+
border: 0;
|
530
|
+
}
|
531
|
+
|
532
|
+
body pre code:before,
|
533
|
+
body pre code:after {
|
534
|
+
content: normal;
|
535
|
+
}
|
536
|
+
|
537
|
+
body kbd {
|
538
|
+
display: inline-block;
|
539
|
+
padding: 3px 5px;
|
540
|
+
font-size: 11px;
|
541
|
+
line-height: 10px;
|
542
|
+
color: #555;
|
543
|
+
vertical-align: middle;
|
544
|
+
background-color: #fcfcfc;
|
545
|
+
border: solid 1px #ccc;
|
546
|
+
border-bottom-color: #bbb;
|
547
|
+
border-radius: 3px;
|
548
|
+
box-shadow: inset 0 -1px 0 #bbb;
|
549
|
+
}
|
550
|
+
|
551
|
+
body .pl-c {
|
552
|
+
color: #969896;
|
553
|
+
}
|
554
|
+
|
555
|
+
body .pl-c1,
|
556
|
+
body .pl-s .pl-v {
|
557
|
+
color: #0086b3;
|
558
|
+
}
|
559
|
+
|
560
|
+
body .pl-e,
|
561
|
+
body .pl-en {
|
562
|
+
color: #795da3;
|
563
|
+
}
|
564
|
+
|
565
|
+
body .pl-s .pl-s1,
|
566
|
+
body .pl-smi {
|
567
|
+
color: #333;
|
568
|
+
}
|
569
|
+
|
570
|
+
body .pl-ent {
|
571
|
+
color: #63a35c;
|
572
|
+
}
|
573
|
+
|
574
|
+
body .pl-k {
|
575
|
+
color: #a71d5d;
|
576
|
+
}
|
577
|
+
|
578
|
+
body .pl-pds,
|
579
|
+
body .pl-s,
|
580
|
+
body .pl-s .pl-pse .pl-s1,
|
581
|
+
body .pl-sr,
|
582
|
+
body .pl-sr .pl-cce,
|
583
|
+
body .pl-sr .pl-sra,
|
584
|
+
body .pl-sr .pl-sre {
|
585
|
+
color: #183691;
|
586
|
+
}
|
587
|
+
|
588
|
+
body .pl-v {
|
589
|
+
color: #ed6a43;
|
590
|
+
}
|
591
|
+
|
592
|
+
body .pl-id {
|
593
|
+
color: #b52a1d;
|
594
|
+
}
|
595
|
+
|
596
|
+
body .pl-ii {
|
597
|
+
background-color: #b52a1d;
|
598
|
+
color: #f8f8f8;
|
599
|
+
}
|
600
|
+
|
601
|
+
body .pl-sr .pl-cce {
|
602
|
+
color: #63a35c;
|
603
|
+
font-weight: bold;
|
604
|
+
}
|
605
|
+
|
606
|
+
body .pl-ml {
|
607
|
+
color: #693a17;
|
608
|
+
}
|
609
|
+
|
610
|
+
body .pl-mh,
|
611
|
+
body .pl-mh .pl-en,
|
612
|
+
body .pl-ms {
|
613
|
+
color: #1d3e81;
|
614
|
+
font-weight: bold;
|
615
|
+
}
|
616
|
+
|
617
|
+
body .pl-mq {
|
618
|
+
color: #008080;
|
619
|
+
}
|
620
|
+
|
621
|
+
body .pl-mi {
|
622
|
+
color: #333;
|
623
|
+
font-style: italic;
|
624
|
+
}
|
625
|
+
|
626
|
+
body .pl-mb {
|
627
|
+
color: #333;
|
628
|
+
font-weight: bold;
|
629
|
+
}
|
630
|
+
|
631
|
+
body .pl-md {
|
632
|
+
background-color: #ffecec;
|
633
|
+
color: #bd2c00;
|
634
|
+
}
|
635
|
+
|
636
|
+
body .pl-mi1 {
|
637
|
+
background-color: #eaffea;
|
638
|
+
color: #55a532;
|
639
|
+
}
|
640
|
+
|
641
|
+
body .pl-mdr {
|
642
|
+
color: #795da3;
|
643
|
+
font-weight: bold;
|
644
|
+
}
|
645
|
+
|
646
|
+
body .pl-mo {
|
647
|
+
color: #1d3e81;
|
648
|
+
}
|
649
|
+
|
650
|
+
body kbd {
|
651
|
+
display: inline-block;
|
652
|
+
padding: 3px 5px;
|
653
|
+
font:
|
654
|
+
11px Consolas,
|
655
|
+
'Liberation Mono',
|
656
|
+
Menlo,
|
657
|
+
Courier,
|
658
|
+
monospace;
|
659
|
+
line-height: 10px;
|
660
|
+
color: #555;
|
661
|
+
vertical-align: middle;
|
662
|
+
background-color: #fcfcfc;
|
663
|
+
border: solid 1px #ccc;
|
664
|
+
border-bottom-color: #bbb;
|
665
|
+
border-radius: 3px;
|
666
|
+
box-shadow: inset 0 -1px 0 #bbb;
|
667
|
+
}
|
668
|
+
|
669
|
+
body .task-list-item {
|
670
|
+
list-style-type: none;
|
671
|
+
}
|
672
|
+
|
673
|
+
body .task-list-item + .task-list-item {
|
674
|
+
margin-top: 3px;
|
675
|
+
}
|
676
|
+
|
677
|
+
body .task-list-item input {
|
678
|
+
margin: 0 0.35em 0.25em -1.6em;
|
679
|
+
vertical-align: middle;
|
680
|
+
}
|
681
|
+
|
682
|
+
body :checked + .radio-label {
|
683
|
+
z-index: 1;
|
684
|
+
position: relative;
|
685
|
+
border-color: #4078c0;
|
686
|
+
}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
#! /usr/bin/env node
|
2
|
+
"use strict";var _chunkVPQQEJWQjs = require('../chunk-VPQQEJWQ.js');var _chunkLZNQK7N5js = require('../chunk-LZNQK7N5.js');var _chunkNHACCVY4js = require('../chunk-NHACCVY4.js');require('../chunk-KNGN2YR6.js');require('../chunk-EJUO2FGU.js');require('../chunk-Y4GMOS4Y.js');var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var $=_chunkNEJSZOZXjs.b.call(void 0, (I,q)=>{var f=_chunkNEJSZOZXjs.a.call(void 0, "fs"),i=_chunkNEJSZOZXjs.a.call(void 0, "path"),k=_chunkNEJSZOZXjs.a.call(void 0, "axios"),E=_chunkNEJSZOZXjs.a.call(void 0, "marked"),j=_chunkNEJSZOZXjs.a.call(void 0, "glob"),v=_chunkNEJSZOZXjs.a.call(void 0, "https"),{exec:O}=_chunkNEJSZOZXjs.a.call(void 0, "child_process");async function z(t,r,u=!1){try{let p=await k({url:t,method:"GET",responseType:"stream",httpsAgent:new v.Agent({rejectUnauthorized:u})}),c=f.createWriteStream(r);return p.data.pipe(c),new Promise((h,w)=>{c.on("finish",h),c.on("error",w)})}catch(p){console.log("download error",t,r,p)}}async function F(t,r,u,p,c){let h=f.readFileSync(u,"utf-8"),w=E.lexer(h),y=a=>{let s=[];return a.forEach(e=>{e.type==="link"&&s.push(e),e.type==="table"&&e.rows.forEach(n=>{n.forEach(o=>{o.tokens&&(s=s.concat(y(o.tokens)))})}),e.tokens&&(s=s.concat(y(e.tokens))),e.items&&e.items.forEach(n=>{s=s.concat(y(n.tokens))})}),s};for(let a of y(w)){let s=[".mp3",".mp4",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".epub",".mobi",".zip",".rar",".7z",".tar",".gz"].find(e=>a.href.endsWith(e)||a.text.endsWith(e));if(a.type==="link"){let e=a.href;e.startsWith("https://github.com")&&e.includes("/blob/")&&(e=e.replace("/blob/","/"));let n=i.basename(u).replace(".md",""),o=i.join(t,r,n);if(f.existsSync(o)||f.mkdirSync(o,{recursive:!0}),e.startsWith("https://www.slideshare.net")){let l=n+"_"+a.text.replace(/[<>:"/\\|?*\n\r]+/g,"_").replace(".pptx","").replace(".pdf","")+"_";_chunkNHACCVY4js.a.call(void 0, ).startDownloadSlideShare(e,o,l,["pptx","pdf"],!1)}else if(s){let l=n+"_"+a.text.replace(/[<>:"/\\|?*\n\r]+/g,"_").replace(s,"")+"_"+i.basename(decodeURIComponent(e));l.endsWith(s)||(l+=s);let m=i.join(o,l);if(!f.existsSync(m)&&(console.log(`Downloading ${e} to ${m}`),await z(e,m,c),p)){let b=new Date().toISOString(),x=`${r},${n},${l},${e},${b}
|
3
|
+
`;f.appendFileSync(p,x)}}else if(e.startsWith("https://qiita.com/"))_chunkVPQQEJWQjs.a.call(void 0, ).qiitaDl(e,o,n+"_",null,!1);else if(e.startsWith("https://quip.com/"))_chunkLZNQK7N5js.a.call(void 0, ).quipdl(e,o,n+"_",!1);else if(e.startsWith("https://github.com/")&&e.endsWith(".git")){let l=i.basename(e,".git"),m=i.join(o,l);f.existsSync(m)||(console.log(`Cloning ${e} to ${m}`),O(`git clone ${e}`,{cwd:o},(b,x,g)=>{if(b){console.error(`Error: ${b}`);return}x&&console.log(`${x}`),g&&console.error(`${g}`)}))}}}}function N(t){let r=t.docsDir||i.join(process.cwd(),"docs"),u=t.downloadDir||i.join(process.cwd(),"download");j.sync(`${r}/**/*.md`).forEach(c=>{let h=i.relative(r,c),w=i.dirname(h);F(u,w,c,t.csv,t.insecure).catch(console.error)})}var A={command:"*",describe:"mdd",builder:{docs:{alias:"d",describe:"docs directory",demandOption:!1,default:"docs",type:"string"},output:{alias:"o",describe:"output directory",demandOption:!1,default:"download",type:"string"},csv:{alias:"c",describe:"csv log file",demandOption:!1,default:"output.csv",type:"string"},insecure:{alias:"k",describe:"allow insecure server connections",demandOption:!1,default:!1,type:"boolean"}},handler(t){(async()=>N({docsDir:t.docs,downloadDir:t.output,csv:t.csv,insecure:!t.insecure}))()}};q.exports=A});var C=()=>{let t=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("mdd");t.command($());let r=t.parse()};C();
|
@@ -0,0 +1,5 @@
|
|
1
|
+
#! /usr/bin/env node
|
2
|
+
"use strict";var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var w=_chunkNEJSZOZXjs.b.call(void 0, (j,k)=>{var a=_chunkNEJSZOZXjs.a.call(void 0, "fs"),c=_chunkNEJSZOZXjs.a.call(void 0, "path"),S=_chunkNEJSZOZXjs.a.call(void 0, "js-yaml"),T=_chunkNEJSZOZXjs.a.call(void 0, "yargs/yargs"),{hideBin:W}=_chunkNEJSZOZXjs.a.call(void 0, "yargs/helpers"),M=_chunkNEJSZOZXjs.a.call(void 0, "glob"),{execSync:y}=_chunkNEJSZOZXjs.a.call(void 0, "child_process"),l=class{constructor(t,e){this.name="markdownMerge",this.markdownData=[],this.link=t||"",this.sharp=e}isMarkdownFile(t){return t.endsWith(".md")||t.endsWith(".markdown")}loadMd(t){try{let e=a.readFileSync(t,"utf-8"),n=e.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(n){let r=S.load(n[1]),i=n[2];return[r,i]}return[null,e]}catch(e){return console.error(`Error reading file ${t}:`,e),[null,""]}}getTitle(t,e){return e}merge(t){let e=`<div style="page-break-before:always"></div>
|
3
|
+
`;return this.markdownData.push(`[TOC]
|
4
|
+
`),this.markdownData.push(e),(r=>{let i=M.sync("**/*.{md,markdown}",{cwd:r,absolute:!0}),g=[],b=[];for(let u of i){let m=c.basename(u),p=c.resolve(u);if(this.isMarkdownFile(m)){console.log(p);let[D,h]=this.loadMd(p),f=m.replace(".md",""),$=this.sharp?h.replace(/^#/gm,"##"):h,d=this.getTitle(D,f);this.markdownData.push("# "+d),this.markdownData.push($),this.markdownData.push(e),g.push(d),b.push(`[${d}](${this.link}${f}.html)`)}}})(t),this.markdownData}save(t){let e=this.markdownData.join(`
|
5
|
+
`),n=c.dirname(t);console.log("save file",t),a.existsSync(n)||a.mkdirSync(n,{recursive:!0}),a.writeFileSync(t,e,"utf-8")}},x={command:"*",describe:"Merge markdown files and generate documentation",builder:{input:{alias:"i",type:"string",description:"input directory",demandOption:!0},output:{alias:"o",type:"string",description:"output markdown file",default:"output.md"},link:{alias:"l",type:"string",description:"root url"},sharp:{type:"boolean",description:"add # code"},css:{alias:"c",type:"string",description:"css style"},pdf:{type:"boolean",description:"convert to pdf"}},handler(s){(async()=>{let t=s.output.endsWith(".md")?s.output:`${s.output}.md`,e=new l(s.link,s.sharp);e.merge(s.input),e.save(t);let n=t.replace(".md",".html"),r=t.replace(".md",".pdf"),i=s.css||c.join(__dirname,"css","github-markdown.css");s.pdf&&(y(`pandoc -t html -c ${i} --toc -s -o ${n} ${t}`),y(`wkhtmltopdf --enable-local-file-access ${n} ${r}`))})()}};k.exports=x});var F=()=>{let s=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("mdm");s.command(w());let t=s.parse()};F();
|
package/dist/quipdl/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#! /usr/bin/env node
|
2
|
-
"use strict";var
|
2
|
+
"use strict";var _chunkLZNQK7N5js = require('../chunk-LZNQK7N5.js');var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var{quipdl:d}=_chunkLZNQK7N5js.a.call(void 0, ),n={command:"*",describe:"quipdl",builder:{url:{alias:"u",describe:"URL",demandOption:!0,type:"string"},dir:{alias:"d",describe:"Save directory",demandOption:!1,default:"./download",type:"string"},prefix:{alias:"p",describe:"prefix",demandOption:!1,type:"string"},overwrite:{alias:"o",describe:"overwrite",demandOption:!1,type:"boolean"}},handler(e){(async()=>d(e.url,e.dir,e.prefix,e.overwrite))()}},a=()=>{let e=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("quipdl");e.command(n);let s=e.parse()};a();
|
package/dist/ssdl/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#! /usr/bin/env node
|
2
|
-
"use strict";var
|
2
|
+
"use strict";var _chunkNHACCVY4js = require('../chunk-NHACCVY4.js');require('../chunk-EJUO2FGU.js');require('../chunk-Y4GMOS4Y.js');var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var{startDownloadSlideShare:d}=_chunkNHACCVY4js.a.call(void 0, ),i={command:"*",describe:"ssdl",builder:{url:{alias:"u",describe:"URL",demandOption:!0,type:"string"},dir:{alias:"d",describe:"Save directory",demandOption:!1,default:"./download",type:"string"},filename:{alias:"f",describe:"filename",demandOption:!1,type:"string"},filetypes:{alias:"t",describe:"filetypes",demandOption:!1,default:["pptx","pdf"],type:"array"}},handler(e){(async()=>d(e.url,e.dir,e.filename,e.filetypes,!1))()}},n=()=>{let e=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("ssdl");e.command(i);let t=e.parse()};n();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "xl1",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.9",
|
4
4
|
"description": "just some xlsx script.",
|
5
5
|
"bin": {
|
6
6
|
"bash1": "dist/bash1/index.js",
|
@@ -8,9 +8,10 @@
|
|
8
8
|
"img2pdf": "dist/img2pdf/index.js",
|
9
9
|
"img2pptx": "dist/img2pptx/index.js",
|
10
10
|
"jsh1": "dist/jsh1/index.js",
|
11
|
-
"jsd1": "dist/jsd1/index.js",
|
12
11
|
"jsss": "dist/jsss/index.js",
|
13
12
|
"ls1": "dist/ls1/index.js",
|
13
|
+
"mdd": "dist/mdd/index.js",
|
14
|
+
"mdm": "dist/mdm/index.js",
|
14
15
|
"qidl": "dist/qidl/index.js",
|
15
16
|
"ssdl": "dist/ssdl/index.js",
|
16
17
|
"xl1": "dist/xl1/index.js"
|
package/dist/chunk-CGHM55QB.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNEJSZOZXjs = require('./chunk-NEJSZOZX.js');var $=_chunkNEJSZOZXjs.b.call(void 0, (k,u)=>{var y=_chunkNEJSZOZXjs.a.call(void 0, "puppeteer"),b=_chunkNEJSZOZXjs.a.call(void 0, "fs"),v=_chunkNEJSZOZXjs.a.call(void 0, "path");function x(a,r){let l=/(?:href|src)=["'](\/[^"']+)["']/g;return a.replace(l,(c,i)=>{let n=new URL(i,r).href;return c.replace(i,n)})}async function T(a,r="./",l="",c=!1){let i=a.split("/").pop().split("?")[0].split("#")[0].replace(/[<>:"/\\|?*]/g,"-");if(!a.startsWith("https://quip.com/"))throw new Error("Invalid Quip URL. URL must start with https://quip.com/");if(b.readdirSync(r).some(t=>t.endsWith(`${i}.pdf`))||c)return;let n=await y.launch({headless:"new",args:["--no-sandbox","--disable-setuid-sandbox",'--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"']});try{let t=await n.newPage();await t.setViewport({width:1200,height:800}),await t.goto(a,{waitUntil:"networkidle0",timeout:3e4}),await t.waitForSelector(".document-content"),await t.evaluate(()=>{let o=document.querySelector(".navigation-controller-header");o&&o.remove();let e=document.querySelector(".navigation-controller-body");e&&(e.classList.remove("navigation-controller-body"),e.removeAttribute("style"))}),await t.evaluate(async()=>{let o=0;for(;o<20;){let e=document.querySelectorAll("a");e[e.length-1].scrollIntoView({behavior:"smooth",block:"start"}),await new Promise(d=>setTimeout(d,200)),o++}});let w=await t.title(),p=await t.$eval(".document-content",o=>o.outerHTML),m=x(p,a),s=await n.newPage();await s.setContent(`<html><head><title>${w}</title><style>img { max-width: 595px; height: auto; }</style></head><body><h1><a href="${a}">${w}</a></h1><div>${m}</div></body></html>`,{waitUntil:"networkidle0"}),await s.evaluate(async()=>{let o=0,e=document.body.scrollHeight;for(;o!==e;)window.scrollTo(0,e),await new Promise(d=>setTimeout(d,2e3)),o=e,e=document.body.scrollHeight;window.scrollTo(0,0)});let g=(l||"")+`${w}-${i}.pdf`.replace(/[<>:"/\\|?*]/g,"-");await s.pdf({path:v.join(r,g),format:"A4",fullPage:!0,printBackground:!1,margin:{top:"20px",right:"20px",bottom:"20px",left:"20px"}}),await s.close()}catch(t){console.error("Error generating PDF:",t)}finally{await n.close()}}u.exports={quipdl:T}});exports.a = $;
|
package/dist/jsd1/index.js
DELETED
@@ -1,3 +0,0 @@
|
|
1
|
-
#! /usr/bin/env node
|
2
|
-
"use strict";var _chunkVPQQEJWQjs = require('../chunk-VPQQEJWQ.js');var _chunkCGHM55QBjs = require('../chunk-CGHM55QB.js');var _chunkKLMDRKHJjs = require('../chunk-KLMDRKHJ.js');require('../chunk-KNGN2YR6.js');require('../chunk-Y4GMOS4Y.js');require('../chunk-EJUO2FGU.js');var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var $=_chunkNEJSZOZXjs.b.call(void 0, (I,q)=>{var f=_chunkNEJSZOZXjs.a.call(void 0, "fs"),i=_chunkNEJSZOZXjs.a.call(void 0, "path"),j=_chunkNEJSZOZXjs.a.call(void 0, "axios"),k=_chunkNEJSZOZXjs.a.call(void 0, "marked"),E=_chunkNEJSZOZXjs.a.call(void 0, "glob"),v=_chunkNEJSZOZXjs.a.call(void 0, "https"),{exec:O}=_chunkNEJSZOZXjs.a.call(void 0, "child_process");async function z(t,r,u=!1){try{let p=await j({url:t,method:"GET",responseType:"stream",httpsAgent:new v.Agent({rejectUnauthorized:u})}),c=f.createWriteStream(r);return p.data.pipe(c),new Promise((m,w)=>{c.on("finish",m),c.on("error",w)})}catch(p){console.log("download error",t,r,p)}}async function F(t,r,u,p,c){let m=f.readFileSync(u,"utf-8"),w=k.lexer(m),y=a=>{let s=[];return a.forEach(e=>{e.type==="link"&&s.push(e),e.type==="table"&&e.rows.forEach(n=>{n.forEach(o=>{o.tokens&&(s=s.concat(y(o.tokens)))})}),e.tokens&&(s=s.concat(y(e.tokens))),e.items&&e.items.forEach(n=>{s=s.concat(y(n.tokens))})}),s};for(let a of y(w)){let s=[".mp3",".mp4",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".epub",".mobi",".zip",".rar",".7z",".tar",".gz"].find(e=>a.href.endsWith(e)||a.text.endsWith(e));if(a.type==="link"){let e=a.href;e.startsWith("https://github.com")&&e.includes("/blob/")&&(e=e.replace("/blob/","/"));let n=i.basename(u).replace(".md",""),o=i.join(t,r,n);if(f.existsSync(o)||f.mkdirSync(o,{recursive:!0}),e.startsWith("https://www.slideshare.net")){let l=n+"_"+a.text.replace(/[<>:"/\\|?*\n\r]+/g,"_").replace(".pptx","").replace(".pdf","")+"_";_chunkKLMDRKHJjs.a.call(void 0, ).startDownloadSlideShare(e,o,l,["pptx","pdf"],!1)}else if(s){let l=n+"_"+a.text.replace(/[<>:"/\\|?*\n\r]+/g,"_").replace(s,"")+"_"+i.basename(decodeURIComponent(e));l.endsWith(s)||(l+=s);let h=i.join(o,l);if(!f.existsSync(h)&&(console.log(`Downloading ${e} to ${h}`),await z(e,h,c),p)){let b=new Date().toISOString(),x=`${r},${n},${l},${e},${b}
|
3
|
-
`;f.appendFileSync(p,x)}}else if(e.startsWith("https://qiita.com/"))_chunkVPQQEJWQjs.a.call(void 0, ).qiitaDl(e,o,n+"_",null,!1);else if(e.startsWith("https://quip.com/"))_chunkCGHM55QBjs.a.call(void 0, ).quipdl(e,o,n+"_",!1);else if(e.startsWith("https://github.com/")&&e.endsWith(".git")){let l=i.basename(e,".git"),h=i.join(o,l);f.existsSync(h)||(console.log(`Cloning ${e} to ${h}`),O(`git clone ${e}`,{cwd:o},(b,x,g)=>{if(b){console.error(`Error: ${b}`);return}x&&console.log(`${x}`),g&&console.error(`${g}`)}))}}}}function N(t){let r=t.docsDir||i.join(process.cwd(),"docs"),u=t.downloadDir||i.join(process.cwd(),"download");E.sync(`${r}/**/*.md`).forEach(c=>{let m=i.relative(r,c),w=i.dirname(m);F(u,w,c,t.csv,t.insecure).catch(console.error)})}var A={command:"*",describe:"jsd1",builder:{docs:{alias:"d",describe:"docs directory",demandOption:!1,default:"docs",type:"string"},output:{alias:"o",describe:"output directory",demandOption:!1,default:"download",type:"string"},csv:{alias:"c",describe:"csv log file",demandOption:!1,default:"output.csv",type:"string"},insecure:{alias:"k",describe:"allow insecure server connections",demandOption:!1,default:!1,type:"boolean"}},handler(t){(async()=>N({docsDir:t.docs,downloadDir:t.output,csv:t.csv,insecure:!t.insecure}))()}};q.exports=A});var C=()=>{let t=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("jsd1");t.command($());let r=t.parse()};C();
|