我如何从新闻源RSS中提取数字及其周围的信息

时间:2019-07-18 20:01:54

标签: python web-scraping etl bonobo

我想提取新闻项所包含的数字以及其周围的信息。

到目前为止,我正在测试一个名为Bonobo的etl,用它来打印从新闻提要rss获得的信息。我的想法是使用此etl提取数字和信息(目前尚不确定),但是,如果您知道更好的方法,我将为您

std::vector<int> values = {1, 3, 4, 5};
int result = std::accumulate(values.begin(), values.end(), 0, [](int acc, int val){
    return 10 * acc + val;
});
std::cout << result << std::endl; // 1345

例如:

[...]
for x in range(15):
    title = NewsFeed.entries[x].title
    desc = NewsFeed.entries[x].description
    print(title)
    print(desc)
    print("\n")

def generate_data():
    yield title
def uppercase(x: str):
    return x.upper()
def output(x: str):
    print(x)
graph = bonobo.Graph(
    generate_data,
    uppercase,
    output,
)
if __name__ == '__main__':
    bonobo.run(graph)

我希望输出为:

Giant birds, comparable in size to elephant birds and moa, have never been reported from Europe.[...] a giant bird with an estimated body mass of about 450 kg.

因为下一步是将这些信息上载到数据库表中。

0 个答案:

没有答案