ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Validate External Links/validate_external_links.sh
(Generate patch)

Comparing Validate External Links/validate_external_links.sh (file contents):
Revision 1149 by iritscen, Sun Feb 7 22:36:56 2021 UTC vs.
Revision 1157 by iritscen, Sun May 9 21:53:48 2021 UTC

# Line 86 | Line 86 | ILLEGAL_CHARS="{ }"
86   MIN_URL_LENGTH=11
87  
88   # These are parallel arrays giving the prefixes that can be used in place of normal external links to
89 < # some wikis and other sites
89 > # some wikis and other sites; based on https://wiki.oni2.net/Special:Interwiki
90   declare -a INTERWIKI_PREFIXES=(commons metawikimedia mw wikibooks wikidata wikimedia wikinews wikiquote wikisource wikispecies wikiversity wikivoyage wikt wp)
91   declare -a INTERWIKI_DOMAINS=(commons.wikimedia.org meta.wikimedia.org mediawiki.org wikibooks.org wikidata.org wikimediafoundation.org wikinews.org wikiquote.org wikisource.org species.wikimedia.org wikiversity.org wikivoyage.org wiktionary.org wikipedia.org)
92  
# Line 233 | Line 233 | while (( "$#" )); do
233        --start-url )            URL_START=$2;                       shift 2;;
234        --end-url )              URL_LIMIT=$2;                       shift 2;;
235        --upload )               UPLOAD_INFO=$2;                     shift 2;;
236 <      * )                      echo "Invalid argument $1 detected. Aborting."; exit 1;;
236 >      * )                      echo "Invalid argument '$1' detected. Aborting."; exit 1;;
237    esac
238   done
239  
# Line 959 | Line 959 | for LINE in `cat "$LINKS_FILE"`; do
959              let OK_LINKS+=1
960  
961              # If this is a YouTube link, we have to look at the actual page source to know if the video
962 <            # is good or not
962 >            # is good or not; override the link's info if it's actually NG
963              if [[ $URL == *www.youtube.com* ]]; then
964                 PAGE_TEXT=$(curl --silent --insecure --user-agent '$AGENT' --max-time $TIMEOUT $URL | grep "\"simpleText\":\"Video unavailable\"")
965                 if [ ! -z "$PAGE_TEXT" ]; then
966                    STATUS="NG"
967 +                  CURL_RESULT=404
968                    let OK_LINKS-=1
969                    let NG_LINKS+=1
970                 fi

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)