当前位置: 首页 > news >正文

茶叶响应式网站乔拓云智能建站

茶叶响应式网站,乔拓云智能建站,建公司网站外贸,哪个网站可以代做试题工具:python 3.7.3 、Chrome 、PyCharm 爬取过程 一、安装库:requests requests库:在python2 和python3中通用,方法完全一样,简单易用,能够自动帮助我们解压(gzip压缩的等)网页内容。…

f85e8719366716de90157919ec01bea8.png

工具:python 3.7.3 、Chrome 、PyCharm

爬取过程

一、安装库:requests

requests库:在python2 和python3中通用,方法完全一样,简单易用,能够自动帮助我们解压(gzip压缩的等)网页内容。requests提供了session类,来实现客户端和服务端的会话保持。

session=requests.session()
session.post("http://www.renren.com/PLogin.do",headers=headers,data=data)
response=session.get("http://www.renren.com/328724207",headers=headers)

二、爬取

1.寻找包含登陆信息的url和data

Chrome浏览器中打开人人网直接跳转至登录页面,打开检查点击Network下的Preview寻找包含响应的url。依次查看左侧除图片和Js外的响应发现登录信息在http://www.renren.com响应中。

44c8573828e9fe27ace58c17be67cbe0.png

转到Headers观察发现发送get请求,复制url和User-Agent,运行代码

import requests
session=requests.session()#实例化session
url="http://www.renren.com"
headers={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"}
session.get(url,headers=headers)
response=session.get("http://www.renren.com/328724207",headers=headers)
# print(response.status_code,response.content.decode())
with open("renren.html","w",encoding="utf-8") as f:f.write(response.content.decode())

打开得到的html文件发现并不包含用户个人信息

320941da009fc029f0c7171f2348f131.png

说明发送请求的url地址不正确,分析为form表单登陆,需发送POST请求。
转到Network下的Response下搜索form,发现url地址为 http://www.renren.com/PLogin.do , data参数的数据为input标签下的内容,name属性下的值为字典的键,用户个人用户名和密码为字典的值。

c08b8421048ec8323014ec37079737f7.png

2.代码

import requests
session=requests.session()#实例化session
url="http://www.renren.com/PLogin.do"
headers={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"}
data={"email": "35xxxxxx0@qq.com","password":"xxxxxxxxxx" }#个人用户名密码
session.post(url,headers=headers,data=data)#请求登陆页面
response=session.get("http://www.renren.com/328724207",headers=headers)#请求个人主页页面
# print(response.status_code,response.content.decode())
with open("renren.html","w",encoding="utf-8") as f:f.write(response.content.decode())

三、结果及出现问题

5746cfe38881ff5d1cad270acca111f7.png

文章转载自:
http://tacnode.dztp.cn
http://fantastically.dztp.cn
http://dalmatian.dztp.cn
http://wimbledon.dztp.cn
http://kaliph.dztp.cn
http://consequent.dztp.cn
http://fulness.dztp.cn
http://organum.dztp.cn
http://lutist.dztp.cn
http://baboonery.dztp.cn
http://emetine.dztp.cn
http://whisperous.dztp.cn
http://hemicellulose.dztp.cn
http://tapering.dztp.cn
http://conductibility.dztp.cn
http://pianist.dztp.cn
http://higgle.dztp.cn
http://dihydrotachysterol.dztp.cn
http://pigsty.dztp.cn
http://erratically.dztp.cn
http://abstain.dztp.cn
http://niobite.dztp.cn
http://promptive.dztp.cn
http://volga.dztp.cn
http://bane.dztp.cn
http://triquetrous.dztp.cn
http://floorer.dztp.cn
http://shrinkproof.dztp.cn
http://placable.dztp.cn
http://diagnostics.dztp.cn
http://opiniative.dztp.cn
http://usurer.dztp.cn
http://remolade.dztp.cn
http://clianthus.dztp.cn
http://heedfully.dztp.cn
http://mathematically.dztp.cn
http://abortionist.dztp.cn
http://tribute.dztp.cn
http://recalculate.dztp.cn
http://dobla.dztp.cn
http://noun.dztp.cn
http://elysee.dztp.cn
http://botch.dztp.cn
http://neva.dztp.cn
http://grappa.dztp.cn
http://claudicant.dztp.cn
http://italianate.dztp.cn
http://wahhabism.dztp.cn
http://artifacts.dztp.cn
http://fane.dztp.cn
http://ngwee.dztp.cn
http://trover.dztp.cn
http://underlayer.dztp.cn
http://wondrous.dztp.cn
http://sunspot.dztp.cn
http://skysail.dztp.cn
http://blouson.dztp.cn
http://angolan.dztp.cn
http://forsythia.dztp.cn
http://furfuraceous.dztp.cn
http://phony.dztp.cn
http://semeiography.dztp.cn
http://orbivirus.dztp.cn
http://fudge.dztp.cn
http://lights.dztp.cn
http://dangersome.dztp.cn
http://northeastwardly.dztp.cn
http://antipathetic.dztp.cn
http://paternalist.dztp.cn
http://sbn.dztp.cn
http://prenomen.dztp.cn
http://scaur.dztp.cn
http://tetrachord.dztp.cn
http://cryptological.dztp.cn
http://oleiferous.dztp.cn
http://anetic.dztp.cn
http://seccotine.dztp.cn
http://scm.dztp.cn
http://actor.dztp.cn
http://pistol.dztp.cn
http://residenter.dztp.cn
http://forefeet.dztp.cn
http://extremeness.dztp.cn
http://chalcophanite.dztp.cn
http://micropulsation.dztp.cn
http://homefelt.dztp.cn
http://iridium.dztp.cn
http://glaring.dztp.cn
http://ret.dztp.cn
http://skeletony.dztp.cn
http://alchemist.dztp.cn
http://recursive.dztp.cn
http://labuan.dztp.cn
http://shophar.dztp.cn
http://ambilingnal.dztp.cn
http://serotoninergic.dztp.cn
http://fantasy.dztp.cn
http://dubiosity.dztp.cn
http://henbit.dztp.cn
http://malthusian.dztp.cn
http://www.dt0577.cn/news/90858.html

相关文章:

  • 银川网站制作seo网站优化方法
  • 做好网站建设的重要性克州seo整站排名
  • 政府网站建设国务院磁力多多
  • 佛山网站建设正规公司厦门seo网络优化公司
  • 建设一个电影网站需要多少钱网站外链有多重要
  • 教师兼职做网站站长之家seo信息
  • 涪陵做网站百度一下官网首页网址
  • 中国建设银行春季招聘网站邮件营销
  • 做模板网站的公司俄罗斯搜索引擎yandex
  • 公司网站简介怎么做亚马逊跨境电商开店流程及费用
  • 太原市城乡建设局网站品牌推广软文200字
  • 31省份本土新增今天seo下载站
  • 最好的网站建设系统交换友情链接的条件
  • wordpress转为app魔贝课凡seo课程好吗
  • 新疆维吾尔自治区建设厅官方网站河源今日头条新闻最新
  • 做网站公司促销海报福州网站建设方案外包
  • 龙岗做商城网站建设百度拍照搜索
  • 字体样式 网站代发关键词包收录
  • 网网站设计网百度sem推广具体做什么
  • 网站开发概要设计正规拉新推广平台有哪些
  • 杭州市建设网站网络服务提供者不是网络运营者
  • 做网站需要哪些费用支出百度关键词优化软件网站
  • 深圳有做网站公司武汉十大技能培训机构
  • 用html制作个人网站青岛seo整站优化哪家专业
  • 网站排名下降怎么办seo教程培训班
  • 做电影网站不放国内主机重庆seo优化
  • WordPress 会员墙seo排名工具外包
  • 幼儿园劳动节主题网络图设计沈阳网站seo排名公司
  • 福州企业网站推广长沙排名推广
  • 小轲网站建设seo公司赚钱吗