1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| >>> import feedparser >>> leetao_feed = feedparser.parse('https://www.leetao94.cn/feeds') >>> leetao_feed.feed {'title': "Peach Blog's Feeds", 'title_detail': {'type': 'text/plain', 'language': None, 'base': 'https://www.leetao94.cn/feeds', 'value': "Peach Blog's Feeds"}, 'id': 'https://www.leetao94.cn/feeds', 'guidislink': True, 'link': 'https://www.leetao94.cn/', 'updated': '2020-09-25T19:53:35Z', 'updated_parsed': time.struct_time(tm_year=2020, tm_mon=9, tm_mday=25, tm_hour=19, tm_min=53, tm_sec=35, tm_wday=4, tm_yday=269, tm_isdst=0), 'links': [{'href': 'https://www.leetao94.cn/', 'rel': 'alternate', 'type': 'text/html'}, {'href': 'https://www.leetao94.cn/feeds', 'rel': 'self', 'type': 'application/atom+xml'}], 'generator_detail': {'name': 'Werkzeug'}, 'generator': 'Werkzeug'} >>> type(leetao_feed.entries) <class 'list'> >>> len(leetao_feed.entries) 10 >>> leetao_feed.entries[0] # 单个文章的内容 {'title': 'Mybatis中特殊符号#{}和${}', 'title_detail': {'type': 'text/plain', 'language': None, 'base': 'https://www.leetao94.cn/feeds', 'value': 'Mybatis中特殊符号#{}和${}'}, 'id': 'https://www.leetao94.cn/post/Mybatis中特殊符号#{}和${}', 'guidislink': True, 'link': 'https://www.leetao94.cn/post/Mybatis中特殊符号#{}和${}', 'updated': '2020-09-25T19:53:35Z', 'updated_parsed': time.struct_time(tm_year=2020, tm_mon=9, tm_mday=25, tm_hour=19, tm_min=53, tm_sec=35, tm_wday=4, tm_yday=269, tm_isdst=0), 'published': '2020-09-25T19:53:35Z', 'published_parsed': time.struct_time(tm_year=2020, tm_mon=9, tm_mday=25, tm_hour=19, tm_min=53, tm_sec=35, tm_wday=4, tm_yday=269, tm_isdst=0), 'links': [{'href': 'https://www.leetao94.cn/post/Mybatis中特殊符号#{}和${}', 'rel': 'alternate', 'type': 'text/html'}], 'authors': [{'name': 'Leetao'}], 'author_detail': {'name': 'Leetao'}, 'author': 'Leetao', 'content': [{'type': 'text/html', 'language': None, 'base': 'https://www.leetao94.cn/feeds', 'value': '...'}
|