有多少种类型的网址?

时间:2015-10-04 01:50:15

标签: url twitter4j

我正在开展一个项目,我需要过滤包含网址的推文。现在,我正在使用以下文字。

  boolean tweetContainsURL= 
   tweetText.contains("http://") 
|| tweetText.contains("https://") 
|| tweetText.contains("t.co")
|| tweetText.contains("bit.ly") 
|| tweetText.contains("</a>");

实际有多少种类型的网址? (就在最近我发现了fb.me网址)

1 个答案:

答案 0 :(得分:0)

不确定如何将此特定应用于Twitter4J,但Twitter API包含Tweet中各种“实体”的列表。 One of the kinds of entities it keeps track of is URLs。因此,您可以枚举这些URL并使用String.replace删除每个URL。

相关问题