Answer the question
In order to leave comments, you need to log in
How to parse code within a script tag in Python?
I am writing a website parser and ran into a problem. It is necessary to parse the data that is generated by javascript. I came to the conclusion that selenium is used for this, but I can’t figure out how.
Here is an example code from where you need to get info:
<script id="bettingGameTpl" type="text/x-jsrender">
<div class="events__cell js-coef {{if B()}}blockSob{{/if}}"
data-id="{{:newID()}}"
u="{{:_idd}}"
data-gameid="{{:gameId}}"
data-evid="{{:sobID()}}"
data-group="{{:groupID()}}"
data-param="{{:P()}}"
data-evplname="{{:Pl()^Name}}"
data-player="{{:Pl()^Id}}"
data-type="{{:T()}}"
data-coef="{{:C()}}"
data-cv="{{:CV()}}"
id="{{:newID()}}"
data-block="{{:B()}}"
dopName="{{:_dopName}}"
mainGame="{{:_mainGame}}">
<div class="events__text">{{:betName()}}</div>
<div class="coef coef_single">
<a href="javascript:void(0)" class="{{:classLight()}} coef__item coef__num {{if activeCoef() == 1}}active{{/if}}">{{:CV()}}</a>
</div>
</div>
</script>
Answer the question
In order to leave comments, you need to log in
Found the answer on this site using the find_elements_by_xpath() function
https://stackoverflow.com/questions/23924008/get-t...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question