Twitter链接分析器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Twitter链接分析器相关的知识,希望对你有一定的参考价值。
public static const homeLink:String = "http://twitter.com"; public static const timelineURIPattern:String = homeLink + "/statuses/user_timeline/{userName}.xml?count={count}&page={page}"; public static const userHomeURIPattern:String = homeLink + "/{userName}"; public static const linkPattern:RegExp = /https?://([-w.]+)+(/([w/_.]*(?S+)?(#S+)?)?)?/g; public static const linkReplace:String = "<a href='$&' target='_blank'>$&</a>"; public static const userPattern:RegExp = /@(w+)/g; public static const userReplace:String = "@<a href='"+ homeLink + "/$1' target='_blank'>$1</a>"; public static const tagLink:String = "http://search.twitter.com/search?q=%23"; public static const tagPattern:RegExp = /(s+)#(w+)/g; public static const tagReplace:String = "$1<a href='"+tagLink+"$2' target='_blank'>#$2</a>"; public static const tagPattern2:RegExp = /^#(w+)/; public static const tagReplace2:String = "<a href='"+tagLink+"$1' target='_blank'>#$1</a>"; public static function replaceAll(text:String):String { text = text.replace(linkPattern,linkReplace); text = text.replace(userPattern,userReplace); text = text.replace(tagPattern,tagReplace); text = text.replace(tagPattern2,tagReplace2); return text; }
以上是关于Twitter链接分析器的主要内容,如果未能解决你的问题,请参考以下文章
使用文本挖掘技术分析Twitter用户对电影Rangoon的评价
Storm入门Twitter Storm源代码分析之CoordinatedBolt