Changeset 1184 for Validate External Links
- Timestamp:
- May 22, 2023, 12:22:55 AM (18 months ago)
- Location:
- Validate External Links
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Validate External Links/validate_external_links.command
r1182 r1184 35 35 36 36 # Normal run with no upload 37 #bash "$VALEXTLINKS" --links "$LINKS_ONLINE" --exceptions "$EXCEPT_ONLINE" --output "$REPORT_DIR" --suggest-snapshots-ng --timeout 10 --show-https-upgrades --show-added-slashes 37 #bash "$VALEXTLINKS" --links "$LINKS_ONLINE" --exceptions "$EXCEPT_ONLINE" --output "$REPORT_DIR" --suggest-snapshots-ng --timeout 10 --show-https-upgrades --show-added-slashes --show-yt-redirects 38 38 39 39 # Normal run -
Validate External Links/validate_external_links.sh
r1183 r1184 34 34 OUTPUT_DIR="" # place reports and all other output in a folder inside this existing folder 35 35 RECORD_OK_LINKS=0 # record response code to the log even when it's a value in OK_CODES 36 ONLY_200_OK=0 # only treat code 200 as "OK" and not any other code in OK_CODES 36 37 SHOW_SLASH=0 # record issue when a slash is added to the end of a URL 37 38 SHOW_HTTPS=0 # record issue when "http" is upgraded to "https" … … 68 69 69 70 # These arrays tell the script which suffixes at the ends of URLs represent files and which are pages. 70 # This determines whether the script tries to take a screenshot of the URL or just gets its HTTP code. 71 # This determines whether the script tries to take a screenshot of the URL (when screenshots are 72 # requested). 71 73 declare -a HTTP_FILES=(3ds 7z avi BINA blend bsl cpp csv dae dll dmg doc east exe fbx first63 flv gamedata gif jpg last32 log m4a mhm mov mp3 mp4 oni ONWC pdf png psd py rar tga TRMA txt vbs wav wmv xaf xcf xlsx xml zip) 72 74 declare -a HTTP_TLDS_AND_PAGES=(abstract action ars asp aspx cfm cgi com css de do full htm html it js jsp net org pgi php php3 phtml pl ru shtml stm uk x) … … 135 137 validate_external_links.sh --help 136 138 validate_external_links.sh --links URL --output DIR [--exceptions URL] 137 [--record-ok-links] [-- show-added-slashes] [--show-https-upgrades]138 [--show- yt-redirects] [--suggest-snapshots] [--check-archive-links]139 [-- take-screenshots FILE] [--timeout NUM] [--start-urlNUM]140 [-- end-url NUM] [--upload FILE]139 [--record-ok-links] [--only-200-ok] [--show-added-slashes] 140 [--show-https-upgrades] [--show-yt-redirects] [--suggest-snapshots] 141 [--check-archive-links] [--take-screenshots FILE] [--timeout NUM] 142 [--start-url NUM] [--end-url NUM] [--upload FILE] 141 143 142 144 DESCRIPTION … … 173 175 --record-ok-links Log a link in the report even if its response 174 176 code is "OK". 177 --only-200-ok Only treat response code 200 as "OK". Normally 178 several additional codes are treated as "OK" (see 179 the array OK_CODES in script) because they are 180 typically not an indicator of a bad link. 175 181 --show-added-slashes Report on redirects that simply add a '/' to the 176 182 end of the URL. … … 226 232 --output ) OUTPUT_DIR="$2"; shift 2;; 227 233 --record-ok-links ) RECORD_OK_LINKS=1; shift;; 234 --only-200-ok ) ONLY_200_OK=1; shift;; 228 235 --show-added-slashes ) SHOW_SLASH=1; shift;; 229 236 --show-https-upgrades ) SHOW_HTTPS=1; shift;; … … 704 711 valPrint ctrhn "Show OK links: " 705 712 if [ $RECORD_OK_LINKS -eq 1 ]; then valPrint ctrh "Yes"; else valPrint ctrh "No"; fi 713 714 valPrint ctrhn "Treat these response codes as OK: " 715 if [ $ONLY_200_OK -eq 1 ]; then valPrint ctrh "200"; else valPrint ctrh "${OK_CODES[*]}"; fi 706 716 707 717 valPrint ctrhn "Take screenshots: " … … 1007 1017 if [ $STATUS == "??" ]; then 1008 1018 for CODE in "${OK_CODES[@]}"; do 1019 if [ $ONLY_200_OK -eq 1 ] && [ $CODE -ne 200 ]; then 1020 continue 1021 fi 1022 1009 1023 if [[ $CODE == $CURL_CODE ]]; then 1010 1024 STATUS="OK" … … 1143 1157 fi 1144 1158 done 1159 # Also check it against the "OK" codes besides 200 if the --only-200-ok argument was received 1160 if [ $ONLY_200_OK -eq 1 ]; then 1161 for CODE in "${OK_CODES[@]}"; do 1162 if [ $CODE -eq 200 ]; then 1163 continue 1164 fi 1165 if [[ $CODE == $CURL_CODE ]]; then 1166 STATUS="NG" 1167 let NG_LINKS+=1 1168 break 1169 fi 1170 done 1171 fi 1145 1172 fi 1146 1173
Note:
See TracChangeset
for help on using the changeset viewer.