Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Rough processing of Tianya Community Forum posts

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report