-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscrape.py
570 lines (562 loc) · 19.9 KB
/
scrape.py
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
import requests
import os
# Search for: node/[0-9]+ edit delete
# or system.*delete
all = '''/events/COMBINE_2019/abstracts
/events/COMBINE_2019/agenda
/standards/sbml/level-3/version-1/core
about
about_old
andre-testing-html
code-of-conduct
colomoto/old
colomoto/old/meetings
colomoto/old/meetings/2010
colomoto/old/meetings/2012
colomoto/old/meetings/2014
colomoto/old/news
colomoto/old/software
combine2011
combine2011
comm
coordinators
documents
documents/archive
documents/archive_0.1
documents/criteria
events
events/calendar
events/COMBINE
events/COMBINE_2010
events/COMBINE_2011
events/COMBINE_2011/Additional_Notes
events/COMBINE_2011/agenda
events/COMBINE_2011/attendees
events/COMBINE_2011/evo
events/COMBINE_2011/exit-survey
events/COMBINE_2011/participants
events/COMBINE_2011/posters
events/COMBINE_2011/Shuttle_Bus
events/COMBINE_2011/Travel_Information
events/COMBINE_2012
events/COMBINE_2012/agenda
events/COMBINE_2012/attendees
events/COMBINE_2012/Tutorial
events/COMBINE_2012/Tutorial2
events/COMBINE_2012/Tutorials
events/COMBINE_2013
events/COMBINE_2013/abstracts
events/COMBINE_2013/agenda
events/COMBINE_2013/attendees
events/COMBINE_2013/exit-survey
events/COMBINE_2013/full-agenda
events/COMBINE_2014
events/COMBINE_2014/abstracts
events/COMBINE_2014/agenda
events/COMBINE_2014/attendees
events/COMBINE_2014/exit-survey
events/COMBINE_2015
events/COMBINE_2015/abstracts
events/COMBINE_2015/agenda
events/COMBINE_2015/attendees
events/COMBINE_2016
events/COMBINE_2016/abstracts
events/COMBINE_2016/agenda
events/COMBINE_2016/attendees
events/COMBINE_2017
events/COMBINE_2017/Abstracts
events/COMBINE_2017/Attendees
events/COMBINE_2018
events/COMBINE_2018/abstracts
events/COMBINE_2018/agenda
events/COMBINE_2018/attendees
events/COMBINE_2019
events/COMBINE_2019/abstracts
events/COMBINE_2019/agenda
events/COMBINE_2019/agenda_old
events/COMBINE_2019/attendees
events/COMBINE_2019/CoC
events/COMBINE_2019/COMBINE2019_Travel
events/COMBINE_2019/Posters
events/COMBINE_2019/STANDS4PM
events/COMBINE_2020
events/COMBINE_2021
events/future
events/harmony-2011/attendees
events/harmony-2011/exit-survey
events/harmony-2011/organizers
events/harmony-2011/supplementary-materials
events/harmony-2011/travel-information
events/harmony-2012/organizers
events/HARMONY_2011
events/HARMONY_2012
events/HARMONY_2012/agenda
events/HARMONY_2012/attendees
events/HARMONY_2012/exit-survey
events/HARMONY_2012/poster-list
events/HARMONY_2013
events/HARMONY_2013/attendees
events/HARMONY_2013/organizers
events/HARMONY_2013/travel-options
events/HARMONY_2014
events/HARMONY_2014/presentations
events/HARMONY_2014/travel-options
events/HARMONY_2015
events/HARMONY_2015/Attendees
events/HARMONY_2015/Posters
events/HARMONY_2016
events/HARMONY_2016/Attendees
events/HARMONY_2017
events/HARMONY_2017/agenda
events/HARMONY_2017/Attendees
events/HARMONY_2017/travel
events/HARMONY_2018
events/HARMONY_2018/Attendees
events/HARMONY_2019
events/HARMONY_2019/Activity_suggestions
events/HARMONY_2019/Attendees
events/HARMONY_2019/CoC
events/HARMONY_2019/HARMONY2019_Travel
events/HARMONY_2019/Lightning_talks
events/HARMONY_2019/Location_Information
events/HARMONY_2019/Posters
events/HARMONY_2020
events/HARMONY_2020/Attendees
events/HARMONY_2020/CoC
events/HARMONY_2020/HARMONY2020_Travel
events/HARMONY_2021
events/HARMONY_2021/Attendees
events/ICSB_2013
events/organization
events/tutorial2014
events/tutorial2014/fullagenda
events/tutorial2015
events/tutorial2016
events/tutorial2017
events/tutorial2017/fullagenda
events/tutorial2018
events/tutorial2019
help
help_template1
help_template2
help_template3
home
login
nagios_test_page
specifications.sed-ml.proposal.kisao.RA.version-1
specifications/biopax
specifications/biopax.level-1
specifications/biopax.level-1.pdf
specifications/biopax.level-2
specifications/biopax.level-2.pdf
specifications/biopax.level-3
specifications/biopax.level-3.pdf
specifications/cellml
specifications/cellml.1
specifications/cellml.1.0
specifications/cellml.1.1
specifications/combine_archive-Draft1.pdf
specifications/frog-fva-version-1
specifications/frog-genedeletion-version-1
specifications/frog-json-version-1
specifications/frog-metadata-version-1
specifications/frog-objective-version-1
specifications/frog-reactiondeletion-version-1
specifications/gpml
specifications/neuroml
specifications/omex
specifications/omex-annotation
specifications/omex-annotation/json
specifications/omex-annotation/turtle
specifications/omex-annotation/xml
specifications/omex-archive
specifications/omex-manifest
specifications/omex-metadata
specifications/omex-metadata/1
specifications/omex-metadata/1/0
specifications/omex.RC-1
specifications/omex.RC-2
specifications/omex.version-1
specifications/omex.version-1.pdf
specifications/petab.version-1
specifications/qualifiers
specifications/sbgn
specifications/sbgn.af
specifications/sbgn.af.level-1
specifications/sbgn.af.level-1.version-1
specifications/sbgn.af.level-1.version-1.0
specifications/sbgn.af.level-1.version-1.0.pdf
specifications/sbgn.af.level-1.version-1.2
specifications/sbgn.af.level-1.version-1.2.pdf
specifications/sbgn.er
specifications/sbgn.er.level-1
specifications/sbgn.er.level-1.version-1
specifications/sbgn.er.level-1.version-1.0
specifications/sbgn.er.level-1.version-1.0.pdf
specifications/sbgn.er.level-1.version-1.1
specifications/sbgn.er.level-1.version-1.1.pdf
specifications/sbgn.er.level-1.version-1.2
specifications/sbgn.er.level-1.version-1.2.pdf
specifications/sbgn.er.level-1.version-2
specifications/sbgn.er.level-1.version-2.pdf
specifications/sbgn.pd
specifications/sbgn.pd.level-1
specifications/sbgn.pd.level-1.version-1
specifications/sbgn.pd.level-1.version-1.0
specifications/sbgn.pd.level-1.version-1.0.pdf
specifications/sbgn.pd.level-1.version-1.1
specifications/sbgn.pd.level-1.version-1.1.pdf
specifications/sbgn.pd.level-1.version-1.2
specifications/sbgn.pd.level-1.version-1.2.pdf
specifications/sbgn.pd.level-1.version-1.3
specifications/sbgn.pd.level-1.version-1.3.pdf
specifications/sbgn.pd.level-1.version-2.0
specifications/sbgnml.version-0.3.release-1
specifications/sbgnml.version-0.3.release-1.pdf
specifications/sbml
specifications/sbml-level-3.version-1.core.release-2.pdf
specifications/sbml.level-1
specifications/sbml.level-1.version-1
specifications/sbml.level-1.version-1.pdf
specifications/sbml.level-1.version-2
specifications/sbml.level-1.version-2.pdf
specifications/sbml.level-2
specifications/sbml.level-2.version-1
specifications/sbml.level-2.version-1.pdf
specifications/sbml.level-2.version-2
specifications/sbml.level-2.version-2.pdf
specifications/sbml.level-2.version-3
specifications/sbml.level-2.version-3.release-1.pdf
specifications/sbml.level-2.version-3.release-2
specifications/sbml.level-2.version-3.release-2.pdf
specifications/sbml.level-2.version-4
specifications/sbml.level-2.version-4.release-1
specifications/sbml.level-2.version-4.release-1.pdf
specifications/sbml.level-2.version-5
specifications/sbml.level-2.version-5.RC-1
specifications/sbml.level-2.version-5.RC-1.pdf
specifications/sbml.level-2.version-5.release-1
specifications/sbml.level-2.version-5.release-1.pdf
specifications/sbml.level-3
specifications/sbml.level-3.version-1
specifications/sbml.level-3.version-1.comp
specifications/sbml.level-3.version-1.comp.pdf
specifications/sbml.level-3.version-1.comp.version-1
specifications/sbml.level-3.version-1.comp.version-1.pdf
specifications/sbml.level-3.version-1.comp.version-1.release-1
specifications/sbml.level-3.version-1.comp.version-1.release-1.pdf
specifications/sbml.level-3.version-1.comp.version-1.release-2
specifications/sbml.level-3.version-1.comp.version-1.release-2.pdf
specifications/sbml.level-3.version-1.comp.version-1.release-3
specifications/sbml.level-3.version-1.comp.version-1.release-3.pdf
specifications/sbml.level-3.version-1.core
specifications/sbml.level-3.version-1.core.release-1
specifications/sbml.level-3.version-1.core.release-1.pdf
specifications/sbml.level-3.version-1.core.release-2
specifications/sbml.level-3.version-1.core.release-2.pdf
specifications/sbml.level-3.version-1.core.release-3
specifications/sbml.level-3.version-1.core.release-3.pdf
specifications/sbml.level-3.version-1.distrib
specifications/sbml.level-3.version-1.distrib.version-1
specifications/sbml.level-3.version-1.distrib.version-1.release-1
specifications/sbml.level-3.version-1.distrib.version-1.release-1.pdf
specifications/sbml.level-3.version-1.fbc
specifications/sbml.level-3.version-1.fbc.version-1
specifications/sbml.level-3.version-1.fbc.version-1.release-1
specifications/sbml.level-3.version-1.fbc.version-1.release-1.pdf
specifications/sbml.level-3.version-1.fbc.version-2
specifications/sbml.level-3.version-1.fbc.version-2.release-1
specifications/sbml.level-3.version-1.fbc.version-2.release-1.pdf
specifications/sbml.level-3.version-1.groups
specifications/sbml.level-3.version-1.groups.version-1
specifications/sbml.level-3.version-1.groups.version-1.release-1
specifications/sbml.level-3.version-1.groups.version-1.release-1.pdf
specifications/sbml.level-3.version-1.layout
specifications/sbml.level-3.version-1.layout.version-1
specifications/sbml.level-3.version-1.layout.version-1.release-1
specifications/sbml.level-3.version-1.layout.version-1.release-1.pdf
specifications/sbml.level-3.version-1.multi
specifications/sbml.level-3.version-1.multi.version-1
specifications/sbml.level-3.version-1.multi.version-1.release-1
specifications/sbml.level-3.version-1.multi.version-1.release-1.pdf
specifications/sbml.level-3.version-1.multi.version-1.release-2
specifications/sbml.level-3.version-1.multi.version-1.release-2.pdf
specifications/sbml.level-3.version-1.qual
specifications/sbml.level-3.version-1.qual.version-1
specifications/sbml.level-3.version-1.qual.version-1.release-1
specifications/sbml.level-3.version-1.qual.version-1.release-1.pdf
specifications/sbml.level-3.version-1.render
specifications/sbml.level-3.version-1.render.version-1
specifications/sbml.level-3.version-1.render.version-1.release-1
specifications/sbml.level-3.version-1.render.version-1.release-1.pdf
specifications/sbml.level-3.version-1.spatial
specifications/sbml.level-3.version-1.spatial.version-0.92
specifications/sbml.level-3.version-1.spatial.version-1
specifications/sbml.level-3.version-1.spatial.version-1.release-1
specifications/sbml.level-3.version-2.core
specifications/sbml.level-3.version-2.core.release-1
specifications/sbml.level-3.version-2.core.release-1.pdf
specifications/sbml.level-3.version-2.core.release-2
specifications/sbml.level-3.version-2.core.release-2.pdf
specifications/sbml.level-3.version-2.distrib
specifications/sbml.level-3.version-2.distrib.version-1
specifications/sbml.level-3.version-2.distrib.version-1.release-1 node/279
specifications/sbml.level-3.version-2.distrib.version-1.release-1.pdf
specifications/sbml.level-3.version-2.release-1
specifications/sbml.level-3.version-2.release-2
specifications/sbml.proposal.distrib-annotations.version-1
specifications/sbol
specifications/sbol-visual
specifications/sbol-visual.version-1.0.0
specifications/sbol-visual.version-1.0.0.pdf
specifications/sbol-visual.version-2.0
specifications/sbol-visual.version-2.0.pdf
specifications/sbol.version-1.1.0
specifications/sbol.version-1.1.0.pdf
specifications/sbol.version-2.0.0
specifications/sbol.version-2.0.0.pdf
specifications/sbol.version-2.0.1
specifications/sbol.version-2.0.1.pdf
specifications/sbol.version-2.0.pdf
specifications/sbol.version-2.1.0
specifications/sbol.version-2.1.0.pdf
specifications/sbol.version-2.2.0
specifications/sbol.version-2.2.0.pdf
specifications/sed-ml
specifications/sed-ml.level-1
specifications/sed-ml.level-1.version-1
specifications/sed-ml.level-1.version-1.pdf
specifications/sed-ml.level-1.version-2
specifications/sed-ml.level-1.version-2.pdf
specifications/sed-ml.level-1.version-2.RC
specifications/sed-ml.level-1.version-2.RC.pdf
specifications/sed-ml.level-1.version-2.RC2
specifications/sed-ml.level-1.version-2.RC2.pdf
specifications/sed-ml.level-1.version-3
specifications/sed-ml.level-1.version-3-draft-1
specifications/sed-ml.level-1.version-3-draft-1.pdf
specifications/sed-ml.level-1.version-3.pdf
specifications/sed-ml.level-1.version-4
specifications/sed-ml.proposal.accessing-data.version-1
specifications/sed-ml.proposal.accessing-data.version-1.pdf
specifications/sed-ml.proposal.kisao.RA.version-1
specifications/sed-ml.proposal.kisao.RA.version-1.pdf
specifications/sed-ml.proposal.nested-simulations
specifications/sed-ml.proposal.nested-simulations.FB.version-1
specifications/sed-ml.proposal.nested-simulations.FB.version-1.pdf
specifications/sed-ml.proposal.nested-simulations.FB.version-2
specifications/sed-ml.proposal.nested-simulations.FB.version-2.pdf
specifications/sed-ml.proposal.nested-simulations.FB.version-3
specifications/sed-ml.proposal.nested-simulations.FB.version-3.pdf
specifications/sed-ml/level-1.version-1.pdf
specifications/sed-ml/proposal
specifications/sed-ml/proposal/nested-simulations/FB/version-1
specifications/sed-ml/proposal/nested-simulations/FB/version-2
specifications/shdml
specifications/shdml.level-1
specifications/shdml.level-1.version-1
specifications/shdml.level-1.version-1.pdf
specifications/teddy
specifications/teddy.owl
specifications/teddy.rel-2007-06-04
specifications/teddy.rel-2007-06-04.owl
specifications/teddy.rel-2011-08-30
specifications/teddy.rel-2014-04-24
specifications/teddy.rel-2014-04-24.owl
standards
standards/biopax
standards/biopax/level-1
standards/biopax/level-2
standards/biopax/level-3
standards/cellml
standards/cellml/1/0
standards/cellml/1/1
standards/gpml
standards/kisao
standards/kisao/libkisao
standards/mamo
standards/miase
standards/miase/explanation
standards/miriam
standards/miriam_uris
standards/neuroml
standards/omex
standards/omex-archive
standards/omex-manifest
standards/omex-metadata
standards/omex-metdata/1/0
standards/omex/RC-1
standards/omex/RC-2
standards/omex/version-1
standards/petab/version-1
standards/qualifiers
standards/sbgn
standards/sbgn/af
standards/sbgn/af/level-1/version-1/0
standards/sbgn/af/level-1/version-1/2
standards/sbgn/er
standards/sbgn/er/level-1/version-1/0
standards/sbgn/er/level-1/version-1/1
standards/sbgn/er/level-1/version-1/2
standards/sbgn/er/level-1/version-2
standards/sbgn/pd
standards/sbgn/pd/level-1/version-1/0
standards/sbgn/pd/level-1/version-1/1
standards/sbgn/pd/level-1/version-1/2
standards/sbgn/pd/level-1/version-1/3
standards/sbml
standards/sbml/level-1/version-1
standards/sbml/level-1/version-2
standards/sbml/level-2/version-1
standards/sbml/level-2/version-2
standards/sbml/level-2/version-3/release-1
standards/sbml/level-2/version-3/release-2
standards/sbml/level-2/version-4/release-1
standards/sbml/level-2/version-5/RC-1
standards/sbml/level-2/version-5/release-1
standards/sbml/level-3
standards/sbml/level-3/version-1
standards/sbml/level-3/version-1/comp
standards/sbml/level-3/version-1/comp/version-1/
standards/sbml/level-3/version-1/comp/version-1/release-1
standards/sbml/level-3/version-1/comp/version-1/release-2
standards/sbml/level-3/version-1/comp/version-1/release-3
standards/sbml/level-3/version-1/core
standards/sbml/level-3/version-1/core/release-1
standards/sbml/level-3/version-1/core/release-2
standards/sbml/level-3/version-1/core/release-3
standards/sbml/level-3/version-1/distrib
standards/sbml/level-3/version-1/distrib/version-1/
standards/sbml/level-3/version-1/distrib/version-1/release-1
standards/sbml/level-3/version-1/fbc
standards/sbml/level-3/version-1/fbc/version-1/
standards/sbml/level-3/version-1/fbc/version-1/release-1
standards/sbml/level-3/version-1/fbc/version-1/release-1
standards/sbml/level-3/version-1/fbc/version-2/
standards/sbml/level-3/version-1/fbc/version-2/release-1
standards/sbml/level-3/version-1/groups
standards/sbml/level-3/version-1/groups/version-1
standards/sbml/level-3/version-1/groups/version-1/release-1
standards/sbml/level-3/version-1/layout
standards/sbml/level-3/version-1/layout/version-1/
standards/sbml/level-3/version-1/layout/version-1/release-1
standards/sbml/level-3/version-1/multi
standards/sbml/level-3/version-1/multi/version-1
standards/sbml/level-3/version-1/multi/version-1/release-1
standards/sbml/level-3/version-1/multi/version-1/release-2
standards/sbml/level-3/version-1/qual
standards/sbml/level-3/version-1/qual/version-1
standards/sbml/level-3/version-1/qual/version-1/release-1
standards/sbml/level-3/version-1/render
standards/sbml/level-3/version-1/render/version-1
standards/sbml/level-3/version-1/render/version-1/release-1
standards/sbml/level-3/version-1/spatial
standards/sbml/level-3/version-1/spatial/version-1
standards/sbml/level-3/version-1/spatial/version-1/release-1
standards/sbml/level-3/version-2
standards/sbml/level-3/version-2/core
standards/sbml/level-3/version-2/core/release-1
standards/sbml/level-3/version-2/core/release-2
standards/sbml/level-3/version-2/distrib
standards/sbml/level-3/version-2/distrib/version-1
standards/sbml/level-3/version-2/distrib/version-1/release-1
standards/sbo
standards/sbol
standards/sbol-visual
standards/sbol-visual/version-1.0.0
standards/sbol-visual/version-2.0
standards/sbol/version-1.1.0
standards/sbol/version-2.0.0
standards/sbol/version-2.0.1
standards/sbol/version-2.1.0
standards/sbol/version-2.2.0
standards/sbolVisual
standards/sed-ml
standards/sed-ml/level-1
standards/sed-ml/level-1/version-1
standards/sed-ml/level-1/version-2
standards/sed-ml/level-1/version-2/RC
standards/sed-ml/level-1/version-2/RC2
standards/sed-ml/level-1/version-3
standards/sed-ml/level-1/version-3/draft-1
standards/sed-ml/proposal
standards/sed-ml/proposal/
standards/sed-ml/proposal/kisao/RA/version-1
standards/sed-ml/proposal/nested-simulations
standards/sed-ml/proposal/nested-simulations/
standards/sed-ml/proposal/nested-simulations/FB/version-1
standards/sed-ml/proposal/nested-simulations/FB/version-2
standards/sed-ml/proposal/nested-simulations/FB/version-3
standards/shdml
standards/shdml/level-1/version-1
standards/specification-infrastructure
standards/specifications
standards/teddy
standards/teddy/ontology
standards/teddy/rel-2014-04-24
Supplementary_materials
test/caltech
test/lenovsandbox
tools
user_help
'''
all_ = '''/events/COMBINE_2019/abstracts
/events/COMBINE_2019/agenda
/standards/sbml/level-3/version-1/core
about
events
standards/sbml/level-3/version-1/core
standards/sbml/level-3/version-1/core/release-1
standards/sbml/level-3/version-1/core/release-2
standards/sbml/level-3/version-1/core/release-3
standards/sbml/level-3/version-1/distrib
events/COMBINE_2018'''
for l in all.split('\n'):
parts = l.strip('/').split('/')
print('- Handling %s (%s)'%(l,parts))
if len(parts)==1:
name = parts[0]
dir = '.'
else:
name = parts[-1]
if len(parts)>=2:
dir = parts[0]
if not os.path.exists(dir):
print(" Creating: %s"%dir)
os.makedirs(dir)
if len(parts)>=3:
dir = '%s/%s'%(parts[0],parts[1])
if not os.path.exists(dir):
os.makedirs(dir)
if len(parts)>=4:
dir = '%s/%s/%s'%(parts[0],parts[1],parts[2])
if not os.path.exists(dir):
os.makedirs(dir)
if len(parts)>=5:
dir = '%s/%s/%s/%s'%(parts[0],parts[1],parts[2],parts[3])
if not os.path.exists(dir):
os.makedirs(dir)
if len(parts)>=6:
dir = '%s/%s/%s/%s/%s'%(parts[0],parts[1],parts[2],parts[3],parts[4])
if not os.path.exists(dir):
os.makedirs(dir)
fname = '%s.html'%name
url = 'http://co.mbine.org/' + l
url = 'http://131.215.225.44/' + l
r = requests.get(url)
if '.pdf' in url or '.owl' in url:
fname = name
tgt = '%s/%s'%(dir, fname)
print(" Copying %s to %s" %(url, tgt))
open(tgt , 'wb').write(r.content)
else:
tgt = '%s/%s'%(dir, fname)
print(" Copying %s to %s" %(url, tgt))
cc = r.content.decode()
cc = cc.replace('http://co.mbine','http://old_co.mbine')
cc = cc.replace('?q=system/files/','/system/files/')
cc = cc.replace('href="/freelinking/', 'href="/')
cc = cc.replace('%20" cla', '" cla')
updated = str.encode(cc)
print(type(updated))
open(tgt , 'w').write(updated.decode())