| 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 |
|
|
| 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 |
|
|
| 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 |