jlhoover3
Board Regular
- Joined
- Nov 9, 2015
- Messages
- 60
- Office Version
- 365
- Platform
- Windows
Hello all,
I am trying to pull information (scrape) that will bring the teams and score to an excel sheet from each week. Below is code I have used from another user's thread that worked until Yahoo changed their website.
However, this doesn't work now. The URL it was using at the time was
<tbody>
</tbody>
I am trying to pull information (scrape) that will bring the teams and score to an excel sheet from each week. Below is code I have used from another user's thread that worked until Yahoo changed their website.
Code:
Sub GetResults()
Dim WeekNum As Variant
Dim html As HTMLDocument
WeekNum = Sheets("Setup").Range("f4").Value
Sheets("Setup").Range("H:I").ClearContents
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set IE = New InternetExplorer
IE.Visible = False
Application.StatusBar = "Getting Scores. Please Wait"
IE.Navigate WeekNum
Do While IE.Busy: DoEvents: Loop
Do While IE.ReadyState <> 4: DoEvents: Loop
Dim ele As Object
i = 1
j = 1
k = 1
l = 1
'For Each ele In IE.Document.getElementsByClassName("team winner ")
' Sheets("Setup").Range("H" & i).Value = ele.innerText
' i = i + 1
'Next
'
'For Each ele In IE.Document.getElementsByClassName("team ")
' Sheets("Setup").Range("I" & j).Value = ele.innerText
' j = j + 1
'Next
For Each ele In IE.Document.getElementsByClassName("away ")
Sheets("Setup").Range("H" & k).Value = ele.innerText
k = k + 1
Next
For Each ele In IE.Document.getElementsByClassName("home ")
Sheets("Setup").Range("I" & l).Value = ele.innerText
l = l + 1
Next
Application.StatusBar = ""
'Sheets("Scrape").Range("A1").Select
IE.Quit
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Cells.EntireColumn.AutoFit
Columns("E:I").Select
Selection.EntireColumn.Hidden = True
MsgBox "Done!"
'FindAndTerminate
End Sub
Sub FindAndTerminate(ByVal strProcName As String)
Dim objWMIService, objProcess, colProcess
Dim strComputer, strList
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcName & "'")
If colProcess.Count > 0 Then
For Each objProcess In colProcess
objProcess.Terminate
Next objProcess
End If
End Sub
However, this doesn't work now. The URL it was using at the time was
http://sports.yahoo.com/college-football/scoreboard/?week=8&conf= Anybody have any ideas how to pull this information now, or maybe from another website. Any news is good news! I appreciate the time!!!! |
<tbody>
</tbody>