def crawTradeActivityDataCenter(link): currentList = [] startContext = TradeActivityDataNetSpiderUtils.returnStartContext(link,'<div id="divTradeActivity" style="display:;">') startContext = TradeActivityDataNetSpiderUtils.filterContextByTarget(startContext,'<tbody>','</tbody>') startContext = TradeActivityDataNetSpiderUtils.filterAfterContext(startContext,'</tr>') len = TradeActivityDataNetSpiderUtils.findAllTarget(startContext,'<tr') for i in range(len): targetContext = TradeActivityDataNetSpiderUtils.divisionTarget(startContext,'<tr','</tr>') startContext = targetContext['nextContext'] currentContext = targetContext['targetContext'] startDate = TradeActivityDataNetSpiderUtils.filterContextByTarget(currentContext,'(',')') endDate = startDate[11:] startDate = startDate[:10] currentContext = TradeActivityDataNetSpiderUtils.filterAfterContext(currentContext,'</td>') currentValue = TradeActivityDataNetSpiderUtils.filterContextByTarget(currentContext,'<td>','</td>') currentList.append([startDate,endDate,currentValue]) return currentList
def crawTradeActivityDataCenter(link): currentList = [] startContext = TradeActivityDataNetSpiderUtils.returnStartContext( link, '<div id="divTradeActivity" style="display:;">') startContext = TradeActivityDataNetSpiderUtils.filterContextByTarget( startContext, '<tbody>', '</tbody>') startContext = TradeActivityDataNetSpiderUtils.filterAfterContext( startContext, '</tr>') len = TradeActivityDataNetSpiderUtils.findAllTarget(startContext, '<tr') for i in range(len): targetContext = TradeActivityDataNetSpiderUtils.divisionTarget( startContext, '<tr', '</tr>') startContext = targetContext['nextContext'] currentContext = targetContext['targetContext'] startDate = TradeActivityDataNetSpiderUtils.filterContextByTarget( currentContext, '(', ')') endDate = startDate[11:] startDate = startDate[:10] currentContext = TradeActivityDataNetSpiderUtils.filterAfterContext( currentContext, '</td>') currentValue = TradeActivityDataNetSpiderUtils.filterContextByTarget( currentContext, '<td>', '</td>') currentList.append([startDate, endDate, currentValue]) return currentList