-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcdn
executable file
·77 lines (71 loc) · 2.49 KB
/
cdn
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
#!/bin/bash
# +---------------------------------------------------------------------------+
# ! Website-CDN-Parser !
# ! **************************************************************************+
# ! Dieses Skript nimmt eine Startseite für eine Website ,
# ! im Format z.B. https://www.mysite.de/Startseite,
# ! und den Rumpfnamen für eine Webarchiv-Datei,
# ! im Format z.B. WEB-www.mysite.de-20191219 .
# ! Das Skript durchsucht die Starseite nach inkludierten Style-
# ! Skriptdateien. Das macht das Python-Skript "cdnparse", welches
# ! als Voraussetzung für dieses Skript installiert sein muss !
# ! Das Skript sammelt gefundene URLs in der Datei cdn.txt .
# ! Diese Datei wird im aktuellen Verzeichnis ($PWD) angelegt.
# ! Anschließend werden mit wpull alle gefundenen Skripte und Styles
# ! aus dem Internet heruntergeladen und in einem Webarchiv archiviert.
# +---------------------------------------------------------------------------+
# ! Autor | Datum | Grund !
# +---------------------------------------------------------------------------+
# ! Ingolf Kuss | 19.12.2019 | Neuanlage !
# +---------------------------------------------------------------------------+
# SITE=https://www.alumnat-sankt-michael-boppard.de/
SITE=$1
WARCNAME=$2
USERAGENT=$3
COOKIE=""
if [ $# -gt 3 ]; then
COOKIE=$4
fi
echo "Starting CDN-Gathering"
echo "SITE=$SITE"
echo "WARCNAME=$WARCNAME"
CDNPARSE=/opt/toscience/python3/bin/cdnparse
WPULL=/opt/toscience/python3/bin/wpull
# cdns="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
$CDNPARSE -a $SITE > cdn.txt
if [ -f ../site_parser.pl ]; then
perl ../site_parser.pl
fi
sleep 5
cmd="$WPULL --warc-file $WARCNAME \
--no-check-certificate \
--no-robots \
--delete-after \
--tries=5 \
--waitretry=20 \
--random-wait \
--strip-session-id \
--user-agent=\"$USERAGENT\""
if [ ! -z "$COOKIE" ]; then
cmd="$cmd \
--header=\"Cookie: $COOKIE\""
fi
cmd="$cmd \
--warc-append \
--database $WARCNAME-cdn.db \
--input-file=cdn.txt"
echo "executing command $cmd"
#$cmd
$WPULL --warc-file $WARCNAME \
--no-check-certificate \
--no-robots \
--delete-after \
--tries=5 \
--waitretry=20 \
--random-wait \
--strip-session-id \
--user-agent="$USERAGENT" \
--header="Cookie: $COOKIE" \
--warc-append \
--database $WARCNAME-cdn.db \
--input-file=cdn.txt