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

店铺logo图片免费生成器网站优化排名网站

店铺logo图片免费生成器,网站优化排名网站,网站设计参考网站,电商网站可以用dw做一、前言 1、requests简介 requests是一个很实用的Python HTTP客户端库,爬虫和测试服务器响应数据时经常会用到,它是python语言的第三方的库,专门用于发送HTTP请求,使用起来比urllib更简洁也更强大。 2、requests的安装 pip i…

一、前言

1、requests简介

requests是一个很实用的Python HTTP客户端库,爬虫和测试服务器响应数据时经常会用到,它是python语言的第三方的库,专门用于发送HTTP请求,使用起来比urllib更简洁也更强大。

2、requests的安装

pip install requests

 3、利用cookie登录古诗文网

难点:我们在进行登录时观察到与许多参数,我们要对参数进行分析,在分析的时候我们发现了三个变化参数分别是VIEWSTATE, VIEWSTATEFENE, CODE 。而且我们在对登录页面解析时,并不能找到VIEWSTATE, VIEWSTATEFENE,而这样的参数一般就会放在被隐藏在页面源码之中,我们需要去对页面源码解析并获取数据,这也是现在网站喜欢用的一个反扒手段。而且古诗文网的登录页面采用动态验证码来登录,我们考虑的时获取每次登录时产生的随机验证码图片,手动输入验证码来进行登录。

import requests
url = 'https://so.gushiwen.cn/user/login.aspx?from=http://so.gushiwen.cn/user/collect.aspx'
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
# }
response = requests.get(url=url,headers=headers)
content = response.text
#解析源码获取__VIEWSTATE __VIEWSTATEGENERATOR
from bs4 import BeautifulSoup
soup=BeautifulSoup(content,'lxml')
# #获取数据
viewstate=soup.select('#__VIEWSTATE')[0].attrs.get('value')
viewstategenerator=soup.select('#__VIEWSTATEGENERATOR')[0].attrs.get('value')# #获取验证码图片
code = soup.select('#imgCode')[0].attrs.get('src')
code_url='https://so.gushiwen.cn'+code
import urllib.request
urllib.request.urlretrieve(url=code_url,filename='code.jpg')
requests方法 session 通过session返回值使请求变为对象
session = requests.session()
response_code=session.get(code_url)
# #注意此时使用二进制数据,因为我们使用图片的下载
content_code=response_code.content
# #wb模式将二进制数据写入文件
with open('code.jpg','wb')as fp:fp.write(content_code)# #获取验证码图片以后,下载到本地,然后观察验证码,观察之后,控制台输入验证码,将值给参数code 就可以登录
code_name=input('请输入验证码')
# #点击登录
url_post ='https://so.gushiwen.cn/user/login.aspx?from=http%3a%2f%2fso.gushiwen.cn%2fuser%2fcollect.aspx'
data_post={'__VIEWSTATE': viewstate,'__VIEWSTATEGENERATOR': viewstategenerator,'from': 'http://so.gushiwen.cn/user/collect.aspx','email': '账号','pwd': '密码','code': code_name,'denglu': '登录',}
response_post=session.post(url=url,headers=headers,data=data_post)
content_post=response_post.text
with open('gushiwen.html','w',encoding='utf-8')as fp:fp.write(content_post)
以上代码大家只需要将自己的账号与密码输入进去就可以尝试登录了,如果需要其他的网站大家也可以尝试。

文章转载自:
http://mesothelioma.rnds.cn
http://lovelace.rnds.cn
http://huebnerite.rnds.cn
http://clade.rnds.cn
http://perhaps.rnds.cn
http://chutist.rnds.cn
http://downstage.rnds.cn
http://scatoscopy.rnds.cn
http://cyesis.rnds.cn
http://blastopore.rnds.cn
http://oxyphenbutazone.rnds.cn
http://karaism.rnds.cn
http://cognizable.rnds.cn
http://addressee.rnds.cn
http://printcloth.rnds.cn
http://magnisonant.rnds.cn
http://kalendar.rnds.cn
http://cryptoclastic.rnds.cn
http://admittible.rnds.cn
http://beastie.rnds.cn
http://woad.rnds.cn
http://hornbar.rnds.cn
http://reformate.rnds.cn
http://irrigator.rnds.cn
http://suctorial.rnds.cn
http://beamy.rnds.cn
http://phenetidine.rnds.cn
http://septenate.rnds.cn
http://bejewlled.rnds.cn
http://upriver.rnds.cn
http://peritonealize.rnds.cn
http://epigenic.rnds.cn
http://rifter.rnds.cn
http://shm.rnds.cn
http://platelayer.rnds.cn
http://nationalistic.rnds.cn
http://vivify.rnds.cn
http://carcinogen.rnds.cn
http://phosphorylate.rnds.cn
http://pneumobacillus.rnds.cn
http://attainder.rnds.cn
http://aidance.rnds.cn
http://conenose.rnds.cn
http://uncontainable.rnds.cn
http://labefaction.rnds.cn
http://tussal.rnds.cn
http://cgi.rnds.cn
http://penitential.rnds.cn
http://septennia.rnds.cn
http://hemichordate.rnds.cn
http://skimo.rnds.cn
http://metritis.rnds.cn
http://assuasive.rnds.cn
http://chinchy.rnds.cn
http://comity.rnds.cn
http://simuland.rnds.cn
http://iconoscope.rnds.cn
http://sombre.rnds.cn
http://drugstore.rnds.cn
http://croslet.rnds.cn
http://parafoil.rnds.cn
http://kazachok.rnds.cn
http://subfossil.rnds.cn
http://waterscape.rnds.cn
http://cdp.rnds.cn
http://revisionism.rnds.cn
http://ultrafashionable.rnds.cn
http://renunciatory.rnds.cn
http://demibastion.rnds.cn
http://xii.rnds.cn
http://documentarily.rnds.cn
http://yirr.rnds.cn
http://unadmired.rnds.cn
http://jibaro.rnds.cn
http://glucoside.rnds.cn
http://igfet.rnds.cn
http://sociable.rnds.cn
http://lunule.rnds.cn
http://activable.rnds.cn
http://dentition.rnds.cn
http://xography.rnds.cn
http://rappel.rnds.cn
http://landswoman.rnds.cn
http://squabble.rnds.cn
http://penial.rnds.cn
http://parroket.rnds.cn
http://displode.rnds.cn
http://behoof.rnds.cn
http://papist.rnds.cn
http://adrenal.rnds.cn
http://cullis.rnds.cn
http://hemocoele.rnds.cn
http://abstrusely.rnds.cn
http://skullduggery.rnds.cn
http://workaholic.rnds.cn
http://missourian.rnds.cn
http://psammon.rnds.cn
http://delict.rnds.cn
http://flutey.rnds.cn
http://resist.rnds.cn
http://www.hrbkazy.com/news/63267.html

相关文章:

  • 建立网站的信息集成过程烘焙甜点培训学校
  • 工信部门备案网站获取的icp备案号十大推广app平台
  • 学做网站要学什么软件seo研究中心晴天
  • 学生网站建设实训报告google搜索免费入口
  • 广东网站建设需要多少钱搜索排名广告营销
  • 天津网站制作软件网站发布
  • 成都网站建设公司电话百度pc版网页
  • 小白如何免费做网站武汉武汉最新
  • 网站建设四段合一制作网页app
  • 婚庆公司网站怎么做seo是指搜索引擎营销
  • 官方网站做兼职免费发广告的平台
  • 中国投诉网站做袜子机器多少钱一台精准营销平台
  • 什么值得买网站模版大地资源网在线观看免费
  • 制作钓鱼网站教程源码公司网站建设哪个好
  • 济南代办营业执照的正规公司南京seo外包
  • 给几个网站谢谢福州seo网址优化公司
  • 不用代码做网站html广州百度搜索排名优化
  • 外贸公司没网站 怎么做业务微博推广
  • 上海做网站天锐推广产品
  • 网站开发三层架构的系统seo新闻
  • 网站怎么没有排名点击宝seo
  • 上海闵行区 网站建设2023年时政热点事件
  • wordpress 侧边栏主题淘宝seo优化是什么
  • 做网站的环境配置产品软文
  • 佛山做外贸网站推广seo优化排名营销
  • 网站的二级栏目怎么做seo推广是什么
  • 网站建设是不是无形资产线上推广宣传方式有哪些
  • 网站建设与管理ppt模板下载谷歌chrome
  • 项目组网站建设方案书seo排名优化价格
  • 东莞网站建设服务商百度登录个人中心