NIST now scrapes the symbol table for later use
This commit is contained in:
parent
0cec4bd2d8
commit
930eb6cad5
@ -13,8 +13,17 @@ class NIST(Source):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
Source.__init__(self)
|
Source.__init__(self)
|
||||||
|
|
||||||
def parse(self, reponse):
|
def parse(self, response):
|
||||||
pass
|
sel = Selector(response)
|
||||||
|
|
||||||
|
symbol_table = {}
|
||||||
|
tds = sel.xpath('//table[@class="symbol_table"]/tr/td')
|
||||||
|
for (symbol_td, name_td) in zip(tds[::2], tds[1::2]):
|
||||||
|
symbol = ''.join(symbol_td.xpath('node()').extract())
|
||||||
|
name = name_td.xpath('text()').extract()[0]
|
||||||
|
symbol_table[symbol] = name
|
||||||
|
log.msg('NIST symbol: |%s|, name: |%s|' % (symbol, name),
|
||||||
|
level=log.DEBUG)
|
||||||
|
|
||||||
def new_compound_request(self, compound):
|
def new_compound_request(self, compound):
|
||||||
return Request(url=self.website[:-1] + self.search % compound,
|
return Request(url=self.website[:-1] + self.search % compound,
|
||||||
|
Reference in New Issue
Block a user