【问题标题】:extract hashtag and mention from instagram从 instagram 中提取主题标签和提及
【发布时间】:2016-06-20 15:40:03
【问题描述】:

是否有任何 java 库或正则表达式模式可用于从 instagram 媒体标题中提取主题标签和用户提及?我知道 twitter-text api,但它无法处理没有空间标签。

【问题讨论】:

  • 你应该从这里开始https://www.instagram.com/developer。如果它仍然无法工作,请发布您的代码来证明问题。

标签: java instagram hashtag mention


【解决方案1】:

这个应该可以工作(^|\s)(#[a-z\d-]+)(从here得到它)

无论如何,如果您使用的是 Instagram API,当您调用它时,有一部分结果会为您提供所有主题标签:

  ["data"]=>
  array(14) {
    ["attribution"]=>
    NULL
    ["tags"]=>
    array(3) {
      [0]=>
      string(13) "workingermany"
      [1]=>
      string(18) "trabajarenalemania"
      [2]=>
      string(10) "radeberger"
    }

如果按照您的评论要求,您需要韩语字符,只需将它们添加到正则表达式中,如下所示:(^|\s)(#[a-z\p{Hangul}\d-]+) 您想要的字母越多,您应该添加的字符集就越多,例如 \p{Hiragana}\p{Katakana}\p{Latin}

【讨论】:

  • 它无法处理没有空格的标签和韩文、中文、日文..语言。比如“#hello#world #안녕하세요”
猜你喜欢
  • 2017-04-12
  • 2012-12-23
  • 1970-01-01
  • 2015-01-15
  • 1970-01-01
  • 2014-02-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多