[{"data":1,"prerenderedAt":63},["ShallowReactive",2],{"article-44":3},{"code":4,"msg":5,"data":6,"count":14},200,"查询成功",{"id":7,"title":8,"keywords":9,"description":10,"category_id":11,"content":12,"body_html":13,"thumb_up":14,"clicks":15,"sort":14,"remark":16,"status":17,"is_open":17,"is_deleted":14,"is_top":14,"is_recommend":14,"create_time":18,"update_time":19,"image_id":20,"url":13,"member_id":14,"cate_name":21,"prev":22,"next":25,"tags":28,"words":34,"read_time":35,"comments":14,"cover":36,"relevant":37},44,"模拟登陆豆瓣并爬去豆瓣主页的部分数据","爬虫,Python,模拟登陆","该文章主要使用selenium模拟登陆豆瓣，并且提取主页的部分信息，熟练使用selenium",5,"该文章主要使用selenium模拟登陆豆瓣，并且提取主页的部分信息。\n\nselenium的安装以及基本使用在前面的文章有介绍。\n\n功能要求：\n\n1、模拟登陆豆瓣\n\n2、爬去主页的部分信息并打印出来\n\n程序代码：\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python\n# -*- encoding: utf-8 -*-\n'''\n@File    :   模拟登陆豆瓣.py\n@Time    :   2019\u002F02\u002F23 16:20:11\n@Author  :   My.Yong \n@Version :   1.0\n@Contact :   raogx.vip@hotmail.com\n@License :   (C)Copyright 2017-2018, Liugroup-NLPR-CASIA\n@Desc    :   None\n'''\n\n# here put the import lib\nfrom selenium import webdriver\nfrom selenium.webdriver.common.keys import Keys\nfrom selenium.webdriver import ActionChains\nimport time,requests\nfrom bs4 import BeautifulSoup\n\ndriver = webdriver.PhantomJS(executable_path='D:\u002Fphantomjs\u002Fbin\u002Fphantomjs.exe')\ndriver.get('https:\u002F\u002Faccounts.douban.com\u002Fpassport\u002Flogin_popup?login_source=anony')\n#模拟点击切换 选择密码登陆\ntab = driver.find_element_by_xpath('\u002F\u002Fli[@class=\"account-tab-account\"]')\n#在 tab 位置单击\nActionChains(driver).move_to_element(tab).click(tab).perform()\n\n#输入账号密码\ndriver.find_element_by_id('username').send_keys('xxxxxxx')\ndriver.find_element_by_id('password').send_keys('xxxxxxxx')\n\n#模拟点击登陆\ndriver.find_element_by_xpath('\u002F\u002Fdiv[@id=\"tmpl_phone\"]\u002Fdiv[@class=\"account-form-field-submit \"]\u002Fa').click()\n\n#等待3秒\ntime.sleep(1)\n\nbase_url = 'https:\u002F\u002Fwww.douban.com\u002F'\ndriver.get(base_url)\n\nhtml = driver.page_source\nsoup = BeautifulSoup(html, 'lxml')\nnodes = soup.select('.status-wrapper')\nfor node in nodes:\n    text = node.select('.content p')\n    text = text[0].get_text() if len(text) > 0 else 0\n    print(text)\n#for item in nodes:\n#    print(item)\n#response = requests.get(another_url, headers=headers)\n#print(response.content)\n#生产登陆后快照\ndriver.save_screenshot('douban.png')\ndriver.quit()\n```\n \n",null,0,499,"",1,"2019-02-26 17:22:15","2026-04-19 10:47:04",133,"Python",{"id":23,"title":24},43,"整理一波PHP计算时间的方法",{"id":26,"title":27},45,"嘉瑞XMES2.0信息化管理系统",[29,32],{"id":30,"name":31},51,"爬虫",{"id":33,"name":21},27,1175,2,"https:\u002F\u002Ftp.myong.top\u002Fstorage\u002Farticle\u002Fbe\u002F7eb81eb8c1826e0eb5671b64818cf3.jpg",[38,43,48,53,58],{"id":39,"title":40,"create_time":41,"description":42},95,"Django启用memcache缓存","2020-10-23 11:17:27","在动态网站中,用户所有的请求,服务器都会去数据库中进行相应的增,删,查,改,渲染模板,执行业务逻辑,最后生成用户看到的页面.当一个网站的用户访问量很大的时候,每一次的的后台操作,都会消耗很多的服务端资源,所以必须使用缓存来减轻后端服务器的压力.",{"id":44,"title":45,"create_time":46,"description":47},91,"用Python实现编程语言 20 年的动态排行榜","2020-06-24 16:06:54","爬取一下，自2001年5月至今，TIOBE 编程语言排行榜上编程语言的变化情况，看一下在接近20年的时间里，编程语言的热度是如何变化的。\r\n",{"id":49,"title":50,"create_time":51,"description":52},100,"re正则表达式","2021-07-10 18:09:52","正则表达式是一个特殊的字符序列，它能帮助你方便的检查一个字符串是否与某种模式匹配，本文罗列re正则表达式中，常用的匹配符号。",{"id":54,"title":55,"create_time":56,"description":57},34,"Python基础整理之列表常见操作","2019-02-10 16:53:55","列表是最常用的Python数据类型，它可以作为一个方括号内的逗号分隔值出现。列表的数据项不需要具有相同的类型",{"id":59,"title":60,"create_time":61,"description":62},63,"Python与mysqldump的数据库备份","2019-10-14 15:35:33","mysqldump是备份MySQL数据库的一种好工具。它相对于用phpmyadmin等备份工具更加快速，又避免受php.ini等的限制，在windows系统下还可以结合计划任务实现定时远程备份数据库",1783431666115]