def get_date_time(self, news_row): date_str = news_row.xpath( 'string((.//table//table//tr)[1]/td)').extract_first().strip() date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo, date_formats=['%d/%m/%Y']) return date_time
def get_date_time(self, news_row): news_col_list = news_row.xpath('./td') date_str = news_col_list[0].xpath('string()').extract_first().strip() date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo, date_formats=['%d/%m/%y']) return date_time
def get_date_time(self, news_row): date_str = news_row.xpath('string((./td)[2]/span)').extract_first( ).strip().strip('[').strip(']') if date_str: date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo) return date_time else: raise Exception('Error: Date parsing error')
def get_date_time(self, news_row): date_str = news_row.xpath( 'string(.//span[contains(@class, "date-display-single")])' ).extract_first().strip() if date_str: date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo) return date_time else: raise Exception('Error: Date parsing error')
def __init__(self): super().__init__() self.exchange = ExchangeParser() # parameters self.mkt_id = du.get_mkt_id(self.exchange.uptick_name) self.pdfs_dir = utils.PDF_DIR + self.exchange.uptick_name + '/' utils.create_pdf_dir(self.pdfs_dir) # private self.latest_date = utils.create_date_time_tzinfo( '30 DEC 2017', self.exchange.tzinfo)
def get_date_time(self, news_row): date_str = news_row.xpath('string(./a/span)').extract_first() date_str_list = utils.filter_spaces(date_str) date_str = '' for s in date_str_list: s = s.strip() date_str += s + ' ' if date_str: date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo) return date_time else: raise Exception('Error: Date parsing error')
def get_date_time(self, news_row): date_str = news_row.xpath( 'string(.//span[contains(@class, "meta-item published-date")])' ).extract_first().strip() if date_str: import re date_str = re.compile('[0-9/]+').findall(date_str)[0] date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo, ['%d/%m/%Y']) return date_time else: raise Exception('Error: Date parsing error')
def get_date_time(self, news_row): date_str = news_row.xpath('string(.//div[contains(@class, "article-date")])' ).extract_first().strip() if date_str: date_str = utils.filter_spaces(date_str)[0] date_time = utils.create_date_time_tzinfo( date_str, self.tzinfo, ) return date_time else: raise Exception('Error: Date parsing error')
def __init__(self): super().__init__() self.exchange = ExchangeParser() # parameters self.mkt_id = du.get_mkt_id(self.exchange.uptick_name) # todo: change uptick_name to col_name self.pdfs_dir = utils.PDF_DIR + self.exchange.col_name + '/' utils.create_pdf_dir(self.pdfs_dir) # private # if self.exchange.is_multi_source_exchange: self.latest_date = utils.create_date_time_tzinfo( '30 DEC 2017', self.exchange.tzinfo)
def get_date_time(self, news_row): date_str = news_row.xpath( 'string((./td)[1]/a)').extract_first().strip() if date_str: date_str_list = date_str.split('-') if len(date_str_list) >= 4: date_str = date_str_list[2].strip() else: date_str = date_str_list[-1].strip() date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo, ['%d%m%Y']) return date_time else: raise Exception('Error: Date parsing error')
def get_date_time(self, news_row): date_str = news_row.xpath( 'string(./div[contains(@class, "date")])').extract_first() date_str_list = utils.filter_spaces(date_str) date_str = '' for s in date_str_list: s = s.strip() if s.lower() != 'date': date_str += s if date_str: date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo) return date_time else: raise Exception('Error: Date parsing error')
def get_date_time(self, news_row): date_str = news_row.xpath( 'string(div[contains(@class,"news-releases__section--date")])').extract( )[0] date_time = utils.create_date_time_tzinfo(date_str, self.tzinfo) return date_time