File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -11,19 +11,22 @@ def get_devices():
1111 url = 'https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices'
1212 response = requests .get (url )
1313 response .raise_for_status ()
14- html = response .text .split ('<table id="goog-ws-list-table"' )[1 ].split ('</table>' )[0 ]
15- html = '<table id="goog-ws-list-table"' + html + '</table>'
14+ html = response .text .split ('<table>' )[3 ].split ('</table>' )[0 ]
15+ html = '<table>' + html + '</table>'
16+ html = html .replace ('&' , '&' )
17+ html = html .replace ('<white label>' , 'white label' )
1618 table = ET .XML (html .encode ('utf-8' ))
17- keys = [k .text for k in table [ 0 ] [0 ]]
19+ keys = [k .text . strip () for k in table [0 ]]
1820 devices = []
19- for row in table [1 ]:
21+ for row in table [1 : ]:
2022 device = {}
2123 for num , value in enumerate (row ):
2224 device [keys [num ]] = None
2325 if value .text :
2426 device [keys [num ]] = value .text .strip ()
25- elif list (value )[0 ].text :
26- device [keys [num ]] = list (value )[0 ].text .strip ()
27+ elif value .find ('a' ) is not None :
28+ if value .find ('a' ).text is not None :
29+ device [keys [num ]] = value .find ('a' ).text .strip ()
2730 devices .append (device )
2831 return devices
2932
You can’t perform that action at this time.
0 commit comments