def write_rss(): items = [{ 'title': x.title, 'url': x.url, 'date': services.format_ts(x.updated_at), 'id': x.id, } for x in services.recent_news(AGENCY, 30)] data = { 'feed_url': config.FEED_URL, 'feed_id': config.YOMIURI_ID, 'last_updated': services.format_ts(int(time.time())), 'items': items, } logging.info('Wrote %d feeds (%s)', len(items), AGENCY) services.render_pystache_to(TEMPLATE, data, 'yomiuri.xml')
def write_rss(): articles = services.recent_news(AGENCY) items = [{ 'title': x.title, 'url': x.url, 'date': services.format_ts(x.updated_at), 'id': x.id } for x in articles] data = { 'feed_url': config.FEED_URL, 'feed_id': config.SANKEI_ID, 'last_updated': services.format_ts(int(time.time())), 'items': items, } logging.info('Writing %d feeds (%s)', len(items), AGENCY) services.render_pystache_to(TEMPLATE, data, 'sankei.xml')
def write_feed(tweets): data = { 'feed_id': config.FEED_ID, 'feed_url': config.FEED_URL, 'title': config.FEED_TITLE, 'last_updated': services.format_ts(time.time()), 'home_page_url': 'https://twitter.com/', 'items': generate_timeline(tweets), } services.render_pystache_to(FEED_TEMPLATE, data, 'feed.xml')
def write_rss(pieces: List[Piece]): items = [{ 'title': f'{p.name} ({p.size})', 'url': 'http://www.oabt007.com', 'date': services.format_ts(p.dt), 'id': hash_name(p.name), 'desc': f''' <a href='{p.url}'>{p.name}</a> ''', } for p in pieces] data = { 'feed_url': config.FEED_URL, 'feed_id': config.GENDAI_ID, 'last_updated': services.format_ts(int(time.time())), 'items': items, } logging.info('Writing %d feeds (%s)', len(items), 'oabt') services.render_pystache_to(TEMPLATE, data, 'oabt.xml')
def get_zulu_time(t): ts = timestamp_from_id(t['id']) return services.format_ts(ts)