[Python] 根据博客园用户名抓取其所有文章的标题及其链接

根据博客园用户名抓取其所有文章的标题及其链接

下载地址: https://github.com/YouXianMing/cnblogsTitleGetter

-使用前须知-

(1) 网络库使用的是 requests (https://github.com/kennethreitz/requests),没有安装的用 pip install requests 安装

(2) 项目基于Python3.60版本,其他版本未做验证

效果

以下是使用步骤:

1. 获取名字

2. 粘贴如下代码并执行

from tittle_getter import *

# http://www.cnblogs.com/YouXianMing/

# 博客园url上的个人名字
title_getter = TittleGetter("YouXianMing")

# 如果存在这个人,则继续
if title_getter.user_exist:

    # 开始分析以及遍历数据
    for item in title_getter.start_analyse.title_object_list:

        print("%s %s" % (item.title_name, item.url))

3. 以下是打印结果

原文地址:https://www.cnblogs.com/YouXianMing/p/6531793.html