Scrape from webpages without table and classes

Bruzio

Board Regular
Joined
Aug 20, 2020
Messages
85
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Hi to everyone, surfing I found this website BsportsFan It has some interesting data.
The landing pages haven't tables or classes so I wasn't able to get that data. A few months ago @smozgur who I greet, made a vba code for me, I'm still using that sheet, maybe also using this website.
Inspecting the site I found this info:


home.jpg


The destination url is https://app.bsportsfan.com/events/inplay, by clicking on an event i found:

odds.jpg


The destination url is https://app.bsportsfan.com/event/odds?id=3225440.
By changing the id I can find all the data for each event.

My goal is to have this data in a sheet.
I would like to know what tools I need to use.
I apologize if mine are trivial requests.

Thank you for your attention and have a nice day
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I'm saying about column A, rows 5, 6, 7 etc are blanks but the are values duplicates 3.05, 3.25, 2.08 etc.
 
Upvote 0
Sorry, I don't know and I don't see how it relates to the few lines of code you posted. Best to step through in the Debugger.
 
Upvote 0
I'm using this code:

VBA Code:
    i = 1
    
    For r = 1 To 20 'lastrow  '.Cells(.Rows.Count, "A").End(xlUp).Row  'test on id rows 4-10
    
    id = .Cells(r, "A").Value
    
            For Each item In json("olist")
                If json("eb_v") = True Then
                    If item("t") = 0 Then
                    .Cells(i, 11).Value = Trim(item("fu")) '1X2 OPEN
                    .Cells(i, 12).Value = Trim(item("fg"))
                    .Cells(i, 13).Value = Trim(item("fd"))
                    .Cells(i, 23).Value = Trim(item("u")) '1X2 CLOS
                    .Cells(i, 24).Value = Trim(item("g"))
                    .Cells(i, 25).Value = Trim(item("d"))
                    End If
                    
                    If item("t") = 1 Then
                    .Cells(i, 14).Value = Trim(item("fu") + 1)
                    .Cells(i, 15).Value = Trim(item("fg"))
                    .Cells(i, 16).Value = Trim(item("fd") + 1)
                    .Cells(i, 26).Value = Trim(item("u") + 1)
                    .Cells(i, 27).Value = Trim(item("g"))
                    .Cells(i, 28).Value = Trim(item("d") + 1)
                    End If

                    If item("t") = 2 Then
                    .Cells(i, 17).Value = Trim(item("fu") + 1)
                    .Cells(i, 18).Value = Trim(item("fg"))
                    .Cells(i, 19).Value = Trim(item("fd") + 1)
                    .Cells(i, 29).Value = Trim(item("u") + 1) 
                    .Cells(i, 30).Value = Trim(item("g"))
                    .Cells(i, 31).Value = Trim(item("d") + 1)
                    End If
                End If
            Next
            i = i + 1
        Next
 
Upvote 0
1903230Israel Leumit LigaHapoel Umm al-FahmHapoel Petah Tikva00492.582.712.7501.75
2.582.712.7501.75
2.582.712.7501.75
2.582.712.7501.75
2.582.712.7501.75
2.582.712.7501.75
2.582.712.7501.75

with
Code:
    For r = 1 To 20
   
    id = .Cells(r, "A").Value
The loop continues even if column A is empty and the values from 2.58 to 1.75 of the last row not blank are duplicated.
I can't fix this loop.
 
Upvote 0
Should I change variable?

I'm trying with i, so

VBA Code:
    For i = 1 To 20
  
    id = .Cells(i, "A").Value

The partial result is:

Germany Landespokal1860 MunichTurkgucu Munchen003
1996734​
Brazil Campeonato BrasilienseReal FCSE Santa Maria006
1937295​
Northern Ireland PremierColeraineLarne0072.010.251.751.962.751.80
1887607​
Scotland ChampionshipRaithDunfermline2130
Belgium Super League WomenCharleroi WomenOH Leuven Women02452.010.251.751.962.751.80
1751742​
Asia - World Cup QualifyingSaudi ArabiaPalestine2047
1915030​
Spain SegundaMalagaAlmeria02492.812.922.622.0201.881.9521.95
Netherlands Eredivisie WomenPSV WomenFC Twente Women0049
1994058​
Lithuania 1 LygaBFA VilniusFK Kauno Zalgiris II4259
1915027​
Spain SegundaAlcorconOviedo1079

Rows incomplete and duplicates and values on rows where isn't ID.

Or maybe I didn't understand?
 
Upvote 0
Ok, I understand, I deleted i = i + 1, it's working
 
Upvote 0
I was deluded, it doesn't work, I used

VBA Code:
lastrow = .Cells(.Rows.Count, "A").End(xlUp).row
For i = 7 To lastrow

1814992​
Africa Cup of Nations QualificationMoroccoBurundi00261.284.508.501.991.51.852.032.51.79
1996745​
Brazil Campeonato Sul-MatogrossenseUniao ABCChapadao10291.880.251.921.852.51.95
1970084​
European U21 ChampionshipItaly U21Slovenia U2130291.563.805.802.0411.882.112.51.80
1815003​
Africa Cup of Nations QualificationCameroonRwanda00291.573.505.001.790.752.051.7822.04
1970083​
European U21 ChampionshipSpain U21Czech Rep U2100301.544.105.402.0011.922.022.51.88
1815004​
Africa Cup of Nations QualificationMozambiqueCape Verde Islands00302.302.882.962.090.251.751.9921.83
1915032​
Spain SegundaPonferradinaUD Logrones01302.182.993.501.870.252.032.1121.80
1887828​
Scotland League TwoAlbionQueen's Park02436.605.001.301.95-1.51.892.053.251.77
1887831​
Scotland League TwoStirlingStenhousemuir00432.233.152.811.950.251.892.072.751.75
1887713​
Scotland League OneCove RangersAirdrieonians00432.033.303.052.040.51.801.942.51.88
1887714​
Scotland League OneFalkirkDumbarton00431.275.207.201.881.51.961.872.751.95
1887717​
Scotland League OnePeterheadClyde00432.243.302.711.970.251.871.872.51.95
1937293​
Northern Ireland PremierBallymena UtdCarrick Rangers10441.8111.952.012.751.75
1887829​
Scotland League TwoBrechinElgin10446.005.001.321.90-1.51.942.023.251.80
1887830​
Scotland League TwoCowdenbeathEdinburgh City12443.903.551.721.90-0.751.941.982.751.84
1887715​
Scotland League OneMontroseEast Fife20442.343.452.492.070.251.771.872.751.95
1937298​
Northern Ireland PremierPortadownCrusaders00441.80-1.251.961.812.751.95
1988773​
Europe - World Cup QualifyingGibraltarNetherlands01441.88-4.51.962.0651.76
1887716​
Scotland League OnePartickForfar12441.304.807.002.001.51.842.022.751.80
1988803​
Europe - World Cup QualifyingCroatiaMalta00441.086.0036.002.022.751.821.843.251.98
1.086.0036.002.022.751.821.843.251.98
1.086.0036.002.022.751.821.843.251.98
1.086.0036.002.022.751.821.843.251.98
1.086.0036.002.022.751.821.843.251.98
1.086.0036.002.022.751.821.843.251.98
1.086.0036.002.022.751.821.843.251.98
1.086.0036.002.022.751.821.843.251.98
1.086.0036.002.022.751.821.843.251.98

Column A (ID) is a formula
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top