Rough processing of Tianya Community Forum posts
VBA extract text from posts on Tianya Forum Sub Tianya posts simply grab () Dim cnt As Integer arr = Array ("comment", "report", "landlord", "author", "draft", "hot post", "forum", "registration", "advertisement" The word For y = 1 To 2 Set ie = CreateObject ("internetexplorer.application") With ie. Navigate "http://bbs.tianya.cn/post-free-5758447-" & y &" .shtml "'5758447-1.shtml" 5758447-2.shtml et al. '.visible = True Do Until ie.ReadyState = 4 DoEvents Loop For x = 0 To .Document.All.tags ("div"). Length-1' body is in div, div collection length ss = .Document.All.tags ("div") (x). Innertext 'body content len_ss = Len (ss)' body length If len_ss
< 100 Then '正文长度太短,直接跳到下一个div GoTo 100 Else For Each keys In arr If InStr(ss, keys) >0 Then GoTo 100' if a blocked word appears, skip to the next div Next cnt = cnt + 1 Debug.Print cnt & ":" & .Document.All.tags ("div") (x) .innertext 'output div End If 100Next x End With Next y ie.Quit Set ie = NothingEnd Sub