Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { private static final String[] REDIRECT_HOSTS = { "t.co", "youtu.be", "bit.ly", "menea.me", "kcy.me", "goo.gl", "ow.ly", "j.mp", "redes.li", "dlvr.it", "tinyurl.com", "tmblr.co", "reut.rs", "sns.mx", "wp.me", "4sq.com", "ed.cl", "huff.to", "mun.do", "cos.as", "flip.it", "amzn.to", "cort.as", "on.cnn.com", "fb.me", "shar.es", "spr.ly", "v.ht", "v0v.in", "redd.it", "bitly.com", "tl.gd", "wh.gov", "hukd.mydealz.de", "untp.i", "kck.st", "engt.co", "nyti.ms", "cnnmon.ie", "vrge.co", "is.gd", "cnn.it", "spon.de", "affiliation.appgratuites-network.com", "t.cn", "url.cn" }; /** * Return true if the host is a known URL shortener */ public static boolean isRedirect(String host) { for (String REDIRECT_HOST : REDIRECT_HOSTS) { if (host.endsWith(REDIRECT_HOST)) return true; } return false; } }