shri
Member
I have a requirement to parse a post for BbCode and have access to the threadid and post id.
The goal is to extract some meta data from the text and links in the message using a text / link extraction service to figure out what the post is about (sentiment analysis / tag extraction).
Extracted tags / keywords / location information would then added to the XenForo thread tags.
Sentiments will be stored and perhaps used for user / message highlighting (most angry user - negative post / positive post etc).
The best place I've figured this could be done is in XenForo_DataWriter_DiscussionMessage_Post
I have this code which gives me the postid / threadid and the post message in $post['message']
Before I go further can someone help me identify if I'm on the right track.
1) Am I on the right track where this might be the best place to extract the meta data from the post?
2) How do I parse the bbcode
cleanly to give me the urls in that post? I can use a regex, but want to make sure there isnt a clean XenForo way of doing this.
Thanks!
The goal is to extract some meta data from the text and links in the message using a text / link extraction service to figure out what the post is about (sentiment analysis / tag extraction).
Extracted tags / keywords / location information would then added to the XenForo thread tags.
Sentiments will be stored and perhaps used for user / message highlighting (most angry user - negative post / positive post etc).
The best place I've figured this could be done is in XenForo_DataWriter_DiscussionMessage_Post
I have this code which gives me the postid / threadid and the post message in $post['message']
Code:
protected function _postSaveAfterTransaction() {
parent::_postSaveAfterTransaction();
$postid = $this->get('post_id');
$threadid = $this->get('thread_id');
$post = $this->getMergedData();
XenForo_Error::debug("postSaveAfterTransaction: postid = $postid , threadid = $threadid");
XenForo_Error::debug("Post Data: " . print_r($post, TRUE));
}
Before I go further can someone help me identify if I'm on the right track.
1) Am I on the right track where this might be the best place to extract the meta data from the post?
2) How do I parse the bbcode
Code:
[URL="http://whatever.com"]
Thanks!