Changeset 1193


Ignore:
Timestamp:
Oct 31, 2024, 11:03:44 PM (7 weeks ago)
Author:
iritscen
Message:

ValExtLinks now recognizes private YT videos.

Location:
Validate External Links
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • Validate External Links/validate_external_links.sh

    r1190 r1193  
    884884   HAS_SUFFIX=0
    885885
    886    # If the URL ends in something like ".php?foo=bar", strip everything from the '?' onward
     886   # If the URL ends in a query string like ".php?foo=bar", strip everything from the '?' onward
    887887   CLEAN_URL=${URL%%\?*}
    888888
    889    # If the URL ends in something like "#section_15", strip everything from the '#' onward
     889   # If the URL ends in an anchor link like "#section_15", strip everything from the '#' onward
    890890   CLEAN_URL=${CLEAN_URL%%\#*}
    891891
     
    10261026
    10271027            # 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.
    10291030            if [[ $URL == *www.youtube.com* ]]; then
    10301031               PAGE_TEXT=$(curl --silent --insecure --user-agent '$AGENT' --max-time $TIMEOUT $URL)
     
    10351036                  let OK_LINKS-=1
    10361037                  let NG_LINKS+=1
    1037                elif [[ "$PAGE_TEXT" =~ "simpleText\":\"Video unavailable" ]]; then
     1038               elif [[ "$PAGE_TEXT" =~ "simpleText\":\"Video unavailable" ]] | [[ "$PAGE_TEXT" =~ "simpleText\":\"Private video" ]]; then
    10381039                  STATUS="NG"
    10391040                  CURL_CODE="404"
     
    11231124               let SKIP_SLASH_ADD+=1
    11241125            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")
    11271129               if [ ! -z "$PAGE_TEXT" ]; then
    11281130                  STATUS="NG"
Note: See TracChangeset for help on using the changeset viewer.