To summarise, how can I get an XPath to scrape the odds in my script.
An XPath that gives different values.
groups = ".//div[contains(@class, 'gl-ParticipantOddsOnlyDarker gl')]"
xp_ba3 = ".//span[contains(@class, 'gl-Participa')]"
The XPath needs for both groups and xp_ba3 needs to be the same length and different for it to behave correctly (I believe).
Desired XPath looks like:
XPath: //div[contains(@class, 'gl-Market_HasLabels')]/following-sibling::div[contains(@class, 'gl-Market_PWidth-12-3333')][1]//div[contains(@class, 'gl-ParticipantOddsOnly')]
.
This works but when I add this logic and run the script -- it does not work.
Webpage odds I am after.
My output instead of different odds looks like:
[['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87'], ['2.87']]
How can I get the odds to work?
HTML:
<div class="gl-ParticipantOddsOnlyDarker gl-ParticipantOddsOnly gl-Participant_General sl-MarketCouponAdvancedBase_LastChild " >
<span class="gl-ParticipantOddsOnly_Odds" > 2.45 </span>
</div ><span class="gl-ParticipantOddsOnly_Odds">2.45</span>
from website
See Question&Answers more detail:
os