台灣最大程式設計社群網站
線上人數
904
 
會員總數:246046
討論主題:189631
歡迎您免費加入會員
討論區列表 >> 專欄文章 >> 將kimo的新聞擷取下來
[]  
[我要回覆]
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
將kimo的新聞擷取下來
價值 : 0 QP  點閱數:1498 回應數:0
樓主

站務人員 站長
門外漢
0 1580
542 9
發送站內信

捐贈 VP 給 站務人員
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form newsCapture
Caption = "新聞自動擷取程式"
ClientHeight = 5175
ClientLeft = 60
ClientTop = 345
ClientWidth = 7200
Icon = "newsCapture.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5175
ScaleWidth = 7200
StartUpPosition = 3 '系統預設值
Begin VB.CommandButton Command1
Caption = "停止自動擷取"
Height = 252
Left = 2520
TabIndex = 10
Top = 4800
Width = 2175
End
Begin VB.Timer Timer1
Interval = 2000
Left = 6840
Top = 0
End
Begin VB.CommandButton cmdClearDatabase
Caption = "清除資料庫"
Height = 252
Left = 105
TabIndex = 8
Top = 4800
Width = 2175
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "newsCapture.frx":058A
Height = 1215
Left = 75
TabIndex = 3
Top = 3480
Width = 6975
_ExtentX = 12303
_ExtentY = 2143
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "新細明體"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "新細明體"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 1028
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 1028
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.ComboBox Combo1
Height = 300
Left = 5460
TabIndex = 7
Text = "科技"
Top = 150
Width = 1212
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 90
Top = 3510
Visible = 0 'False
Width = 6975
_ExtentX = 12303
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=news.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=news.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "news"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "新細明體"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin RichTextLib.RichTextBox rtbHTMLcode2
Height = 735
Left = 4695
TabIndex = 6
Top = 1290
Width = 2175
_ExtentX = 3836
_ExtentY = 1296
_Version = 393217
Enabled = -1 'True
ScrollBars = 3
TextRTF = $"newsCapture.frx":059F
End
Begin VB.CommandButton cmdPage
Caption = "網頁分析"
Height = 252
Left = 4920
TabIndex = 5
Top = 4800
Width = 2175
End
Begin RichTextLib.RichTextBox rtbHTMLCode
Height = 735
Left = 4695
TabIndex = 4
Top = 570
Width = 2175
_ExtentX = 3836
_ExtentY = 1296
_Version = 393217
ScrollBars = 3
TextRTF = $"newsCapture.frx":0637
End
Begin RichTextLib.RichTextBox rtbTxt
Height = 855
Left = 4695
TabIndex = 2
Top = 2010
Width = 2175
_ExtentX = 3836
_ExtentY = 1508
_Version = 393217
TextRTF = $"newsCapture.frx":06CF
End
Begin SHDocVwCtl.WebBrowser WebBrowser1
Height = 2730
Left = 120
TabIndex = 1
Top = 600
Width = 4455
ExtentX = 7858
ExtentY = 4815
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
NoClientEdge = 0 'False
AlignLeft = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = "res://C:\WINNT\system32\shdoclc.dll/dnserror.htm#http:///"
End
Begin InetCtlsObjects.Inet Inet1
Left = -120
Top = -120
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
Protocol = 4
RemoteHost = "localhost"
URL = "http://localhost/yanzhi"
Document = "/yanzhi"
End
Begin VB.Label labURL
Caption = "http://tw.news.yahoo.com"
Height = 315
Left = 1560
TabIndex = 11
Top = 150
Width = 2175
End
Begin VB.Label Label1
Caption = "類別"
Height = 255
Left = 4740
TabIndex = 9
Top = 225
Width = 615
End
Begin VB.Label labURLTXT
Caption = "擷取新聞網路位置:"
Height = 255
Left = 0
TabIndex = 0
Top = 180
Width = 1455
End
Begin VB.Line Line1
X1 = 90
X2 = 7050
Y1 = 3420
Y2 = 3420
End
End
Attribute VB_Name = "newsCapture"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim template
Dim temptext
Dim fininsh
Dim j

Private Sub cmdClearDatabase_Click()
Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Loop
End Sub

Private Sub cmdPage_Click()
rtbHTMLCode.Text = Inet1.OpenURL(labURL.Caption)
htmlcode = rtbHTMLCode.Text

Combo = Combo1.Text + ":"
rtbHTMLCode.Text = Trim(rtbHTMLCode.Text)
Where = InStr(rtbHTMLCode.Text, Combo)
stopsearch = InStr(rtbHTMLCode.Text, "<!--===== 雜誌 start ======-->")
lenword = stopsearch - Where
rtbHTMLCode.SelStart = Where - 1
rtbHTMLCode.SelLength = lenword
rtbHTMLcode2.Text = rtbHTMLCode.SelText
rtbHTMLCode.Text = ""
rtbHTMLcode2.Text = Trim(rtbHTMLcode2.Text)
For i = 1 To 3
txtProcess
j = 4
W = ""
URL = ""
words = ""
Source = ""

Do Until W = ">"
j = j + 1
W = Mid(temptext, j, 1)
URL = URL + W
Loop
URL = Mid(URL, 10, Len(URL) - 11)
rtbTxt.Text = rtbTxt.Text + URL
j = 15 + Len(URL)

Do Until W = "<"
j = j + 1
W = Mid(temptext, j, 1)
words = words + W
Loop
lenword = Len(words)
words = Mid(words, 1, lenword - 1)
words = LTrim(words)
words = Replace(words, Chr(13), "")
rtbTxt.Text = rtbTxt.Text + words
j = 15 + Len(URL) + Len(words) + 47

Do Until W = ")"
j = j + 1
W = Mid(temptext, j, 1)
Source = Source + W
Loop
Source = Mid(Source, 3, Len(Source) - 3)
rtbTxt.Text = rtbTxt.Text + Source
If Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
If Adodc1.Recordset("超連結") = URL Then
writetodb = True
End If
Adodc1.Recordset.MoveNext
Loop
If Not writetodb = True Then
Adodc1.Recordset.AddNew
Adodc1.Recordset("標題") = words
Adodc1.Recordset("超連結") = URL
Adodc1.Recordset("來源") = Source
Adodc1.Recordset("類別") = Combo1.Text
Adodc1.Recordset.Update
End If
Next
End Sub
Private Sub cmdView_Click()
WebBrowser1.Navigate (labURL.Caption)
End Sub

Private Sub txtProcess()
ahref = InStr(rtbHTMLcode2.Text, "<p>")
ahrefend = InStr(rtbHTMLcode2.Text, "</p>")
lenahref = Abs(ahrefend - ahref)
rtbHTMLcode2.SelStart = ahref - 1
rtbHTMLcode2.SelLength = lenahref
rtbHTMLCode.Text = rtbHTMLCode.Text + rtbHTMLcode2.SelText
temptext = rtbHTMLcode2.SelText
template = Val(rtbHTMLcode2.SelStart) + Val(rtbHTMLcode2.SelLength)
rtbHTMLcode2.SelStart = template
rtbHTMLcode2.SelLength = Len(rtbHTMLcode2.Text)
rtbHTMLcode2.Text = rtbHTMLcode2.SelText
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
cmdView_Click
End Sub

Private Sub Timer1_Timer()
cmdPage_Click
End
End Sub



61.30.47.4

修改回應 刪除回應

回應 4 回應者: 李宗翰 發表日期: 2002/2/24 下午 03:30:02
完整一點
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form newsCapture
Caption = "新聞自動擷取程式"
ClientHeight = 5175
ClientLeft = 60
ClientTop = 345
ClientWidth = 7200
Icon = "newsCapture.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5175
ScaleWidth = 7200
StartUpPosition = 3 '系統預設值
Begin VB.CommandButton Command1
Caption = "停止自動擷取"
Height = 252
Left = 2520
TabIndex = 10
Top = 4800
Width = 2175
End
Begin VB.Timer Timer1
Interval = 2000
Left = 6840
Top = 0
End
Begin VB.CommandButton cmdClearDatabase
Caption = "清除資料庫"
Height = 252
Left = 105
TabIndex = 8
Top = 4800
Width = 2175
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "newsCapture.frx":058A
Height = 1215
Left = 75
TabIndex = 3
Top = 3480
Width = 6975
_ExtentX = 12303
_ExtentY = 2143
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "新細明體"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "新細明體"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 1028
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 1028
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.ComboBox Combo1
Height = 300
Left = 5460
TabIndex = 7
Text = "科技"
Top = 150
Width = 1212
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 90
Top = 3510
Visible = 0 'False
Width = 6975
_ExtentX = 12303
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=news.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=news.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "news"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "新細明體"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin RichTextLib.RichTextBox rtbHTMLcode2
Height = 735
Left = 4695
TabIndex = 6
Top = 1290
Width = 2175
_ExtentX = 3836
_ExtentY = 1296
_Version = 393217
Enabled = -1 'True
ScrollBars = 3
TextRTF = $"newsCapture.frx":059F
End
Begin VB.CommandButton cmdPage
Caption = "網頁分析"
Height = 252
Left = 4920
TabIndex = 5
Top = 4800
Width = 2175
End
Begin RichTextLib.RichTextBox rtbHTMLCode
Height = 735
Left = 4695
TabIndex = 4
Top = 570
Width = 2175
_ExtentX = 3836
_ExtentY = 1296
_Version = 393217
ScrollBars = 3
TextRTF = $"newsCapture.frx":0637
End
Begin RichTextLib.RichTextBox rtbTxt
Height = 855
Left = 4695
TabIndex = 2
Top = 2010
Width = 2175
_ExtentX = 3836
_ExtentY = 1508
_Version = 393217
TextRTF = $"newsCapture.frx":06CF
End
Begin SHDocVwCtl.WebBrowser WebBrowser1
Height = 2730
Left = 120
TabIndex = 1
Top = 600
Width = 4455
ExtentX = 7858
ExtentY = 4815
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
NoClientEdge = 0 'False
AlignLeft = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = "res://C:\WINNT\system32\shdoclc.dll/dnserror.htm#http:///"
End
Begin InetCtlsObjects.Inet Inet1
Left = -120
Top = -120
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
Protocol = 4
RemoteHost = "localhost"
URL = "http://localhost/yanzhi"
Document = "/yanzhi"
End
Begin VB.Label labURL
Caption = "http://tw.news.yahoo.com"
Height = 315
Left = 1560
TabIndex = 11
Top = 150
Width = 2175
End
Begin VB.Label Label1
Caption = "類別"
Height = 255
Left = 4740
TabIndex = 9
Top = 225
Width = 615
End
Begin VB.Label labURLTXT
Caption = "擷取新聞網路位置:"
Height = 255
Left = 0
TabIndex = 0
Top = 180
Width = 1455
End
Begin VB.Line Line1
X1 = 90
X2 = 7050
Y1 = 3420
Y2 = 3420
End
End
Attribute VB_Name = "newsCapture"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim template
Dim temptext
Dim fininsh
Dim j

Private Sub cmdClearDatabase_Click()
Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Loop
End Sub

Private Sub cmdPage_Click()
rtbHTMLCode.Text = Inet1.OpenURL(labURL.Caption)
htmlcode = rtbHTMLCode.Text

Combo = Combo1.Text + ":"
rtbHTMLCode.Text = Trim(rtbHTMLCode.Text)
Where = InStr(rtbHTMLCode.Text, Combo)
stopsearch = InStr(rtbHTMLCode.Text, "<!--===== 雜誌 start ======-->")
lenword = stopsearch - Where
rtbHTMLCode.SelStart = Where - 1
rtbHTMLCode.SelLength = lenword
rtbHTMLcode2.Text = rtbHTMLCode.SelText
rtbHTMLCode.Text = ""
rtbHTMLcode2.Text = Trim(rtbHTMLcode2.Text)
For i = 1 To 3
txtProcess
j = 4
W = ""
URL = ""
words = ""
Source = ""

Do Until W = ">"
j = j + 1
W = Mid(temptext, j, 1)
URL = URL + W
Loop
URL = Mid(URL, 10, Len(URL) - 11)
rtbTxt.Text = rtbTxt.Text + URL
j = 15 + Len(URL)

Do Until W = "<"
j = j + 1
W = Mid(temptext, j, 1)
words = words + W
Loop
lenword = Len(words)
words = Mid(words, 1, lenword - 1)
words = LTrim(words)
words = Replace(words, Chr(13), "")
rtbTxt.Text = rtbTxt.Text + words
j = 15 + Len(URL) + Len(words) + 47

Do Until W = ")"
j = j + 1
W = Mid(temptext, j, 1)
Source = Source + W
Loop
Source = Mid(Source, 3, Len(Source) - 3)
rtbTxt.Text = rtbTxt.Text + Source
If Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
If Adodc1.Recordset("超連結") = URL Then
writetodb = True
End If
Adodc1.Recordset.MoveNext
Loop
If Not writetodb = True Then
Adodc1.Recordset.AddNew
Adodc1.Recordset("標題") = words
Adodc1.Recordset("超連結") = URL
Adodc1.Recordset("來源") = Source
Adodc1.Recordset("類別") = Combo1.Text
Adodc1.Recordset.Update
End If
Next
End Sub
Private Sub cmdView_Click()
WebBrowser1.Navigate (labURL.Caption)
End Sub

Private Sub txtProcess()
ahref = InStr(rtbHTMLcode2.Text, "<p>")
ahrefend = InStr(rtbHTMLcode2.Text, "</p>")
lenahref = Abs(ahrefend - ahref)
rtbHTMLcode2.SelStart = ahref - 1
rtbHTMLcode2.SelLength = lenahref
rtbHTMLCode.Text = rtbHTMLCode.Text + rtbHTMLcode2.SelText
temptext = rtbHTMLcode2.SelText
template = Val(rtbHTMLcode2.SelStart) + Val(rtbHTMLcode2.SelLength)
rtbHTMLcode2.SelStart = template
rtbHTMLcode2.SelLength = Len(rtbHTMLcode2.Text)
rtbHTMLcode2.Text = rtbHTMLcode2.SelText
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
cmdView_Click
End Sub

Private Sub Timer1_Timer()
cmdPage_Click
End
End Sub

本篇文章發表於2002-02-24 00:00
目前尚無任何回覆
   

回覆
如要回應,請先登入.