示例#1
0
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')
示例#2
0
文件: sankei.py 项目: yaroot/scripts
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')
示例#3
0
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')
示例#4
0
文件: oabt.py 项目: yaroot/scripts
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')
示例#5
0
def get_zulu_time(t):
    ts = timestamp_from_id(t['id'])
    return services.format_ts(ts)