Changeset 1193 for Validate External Links
- Timestamp:
- Oct 31, 2024, 11:03:44 PM (5 weeks ago)
- Location:
- Validate External Links
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Validate External Links/validate_external_links.sh
r1190 r1193 884 884 HAS_SUFFIX=0 885 885 886 # If the URL ends in something like ".php?foo=bar", strip everything from the '?' onward886 # If the URL ends in a query string like ".php?foo=bar", strip everything from the '?' onward 887 887 CLEAN_URL=${URL%%\?*} 888 888 889 # If the URL ends in somethinglike "#section_15", strip everything from the '#' onward889 # If the URL ends in an anchor link like "#section_15", strip everything from the '#' onward 890 890 CLEAN_URL=${CLEAN_URL%%\#*} 891 891 … … 1026 1026 1027 1027 # If this is a YouTube link, we have to look at the actual page source to know if the video 1028 # is good or not; override the link's info if it's actually NG 1028 # is good or not; override the link's info if it's actually NG. Also see RD_CODES section 1029 # below for duplicative code. 1029 1030 if [[ $URL == *www.youtube.com* ]]; then 1030 1031 PAGE_TEXT=$(curl --silent --insecure --user-agent '$AGENT' --max-time $TIMEOUT $URL) … … 1035 1036 let OK_LINKS-=1 1036 1037 let NG_LINKS+=1 1037 elif [[ "$PAGE_TEXT" =~ "simpleText\":\"Video unavailable" ]] ; then1038 elif [[ "$PAGE_TEXT" =~ "simpleText\":\"Video unavailable" ]] | [[ "$PAGE_TEXT" =~ "simpleText\":\"Private video" ]]; then 1038 1039 STATUS="NG" 1039 1040 CURL_CODE="404" … … 1123 1124 let SKIP_SLASH_ADD+=1 1124 1125 elif [ $YOUTU_BE -eq 1 ]; then 1125 # We have to look at the actual page source to know if a YouTube video is good or not 1126 PAGE_TEXT=$(curl --silent --insecure --user-agent '$AGENT' --max-time $TIMEOUT $NEW_URL | grep "\"simpleText\":\"Video unavailable\"") 1126 # We have to look at the actual page source to know if a YouTube video is good or not. 1127 # Also see OK_CODES section above for duplicative code. 1128 PAGE_TEXT=$(curl --silent --insecure --user-agent '$AGENT' --max-time $TIMEOUT $NEW_URL | grep -e "simpleText\":\"Video unavailable" -e "simpleText\":\"Private video") 1127 1129 if [ ! -z "$PAGE_TEXT" ]; then 1128 1130 STATUS="NG"
Note:
See TracChangeset
for help on using the changeset viewer.