<p style="margin-top:16px;color:rgb(34,34,34);font-family:'PingFang SC','Hiragino Sans GB','Microsoft YaHei','WenQuanYi Micro Hei','Helvetica Neue',Arial,sans-serif;background-color:rgb(255,255,255);">  <p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">Requests 库爬取「我主良缘」网站<p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);">今天的程序就是利用 requests 库进行「我主良缘」网站的爬取。我的代码是利用 requests 库进行网站的抓取,在利用 mongo 数据库进行数据的保存。大家可以对着两个版本的代码进行学习。<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">程序抓取结果<p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);">运行程序会把网站上,对应的交友信息抓取下来,保存到 mongodb 数据库中。并单独把图片保存到本地的 images2 文件夹中。<p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">程序结构<p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);">数据请求<p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);"><span style="font-weight:700;">字段提取<p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);">完整代码已上传到 Github 上,<p style="margin-top:16px;color:rgb(34,255);">在写完代码以后,我还去搜索下帝都的男生。搜索条件是:身高 180,年龄 25,月薪 1.5W。然后就得到这样的结果。<p style="margin-top:16px;color:rgb(34,255);"> <p style="margin-top:16px;color:rgb(34,255);">果然男生相对来说打扮比较普通,还是妹子的好看些。更多有趣的内容,可以自己运行代码,看看你的心仪的对象都会有哪些。<p style="margin-top:16px;color:rgb(34,255);">转载于:痴海<p style="margin-top:16px;color:rgb(34,255);">欢迎大家关注我的博客或者公众号:https://home.cnblogs.com/u/Python1234/<p style="margin-top:16px;color:rgb(34,255);">Python学习交流 (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|