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

node.js网站开发合适吗杭州关键词优化外包

node.js网站开发合适吗,杭州关键词优化外包,淘宝详情页免费模板,青岛做物流网站需求:登录古诗文网站,账号+密码+图形验证码 第一:自己注册一个账号+密码哈 第二:图形验证码,需要一个打码平台(充钱,超能力power!)或…

需求:登录古诗文网站,账号+密码+图形验证码

第一:自己注册一个账号+密码哈
第二:图形验证码,需要一个打码平台(充钱,超能力power!)或者tesseract开源包,这两个用于自动识别图形验证码哈~
我用的是超级鹰,充了1块,有1000积分,一次10积分,初学者福音hhhhh
在这里插入图片描述
在软件ID随便填一下软件名称和说明,获取软件key
然后点击首页,首页的菜单栏处有个开发文档,来到这个页面,然后找到python的Demo,get一个压缩包~
在这里插入图片描述
压缩包里有一个chaojiying.py,把它复制到自己的项目里~
在这里插入图片描述
第三:开始码

1. 调用chaojiying.py

Chaojiying_Client中的三个参数替换成自己的即可,其中filePath是后续保存下来的验证码图片的路径~

from chaojiying import Chaojiying_Clientdef getCode(filePath):c = Chaojiying_Client('超级鹰的账号', '超级鹰的密码', '软件Key')im = open(filePath, 'rb').read()return c.PostPic(im, 1902)['pic_str']
2. 获取验证码(还没到登录那一步哈)
headers = {'User-Agent': 'xxx'
}
url = 'https://so.gushiwen.cn/user/login.aspx?from=http://so.gushiwen.cn/user/collect.aspx'
# 发送请求
page_text = requests.get(url=url, headers=headers).text
# 获取页面源码
page_tree = etree.HTML(page_text)
# 获取验证码路径及验证码本体
# 通过page_tree.xpath('//*[@id="imgCode"]/@src')[0]可以获取验证码<img>标签中的src属性,即验证码的路径
# 但验证码真实路径如下~
img_src = "https://so.gushiwen.cn" + page_tree.xpath('//*[@id="imgCode"]/@src')[0]
img_data = session.get(url=img_src, headers=headers).content
# 将验证码保存至同级code.jpg
with open('./code.jpg', 'wb') as f:f.write(img_data)
# 调用超级鹰,获取code
code = getCode('./code.jpg')

在浏览器按下F12,可以看到页面的源码信息,找到验证码对应的盒子,可以看到其src属性。<img>标签右键,copy->copy xpath即可得到验证码路径,拼接在官网地址后就是代码中的img_src
至于xpath是啥,其实还没有学到那里,当当好在学习xpath的时候突然想打通一套登录流程,但大概理解xpath就是可以动态获取某个标签或元素属性的东西叭(超小声)
在这里插入图片描述

3. 实战登录

在官网登录之后,打开开发者工具f12,找到如图所示的Payload,这就是访问登陆后的页面时的请求参数,共7个,其中只有__VIEWSTATE__VIEWSTATEGENERATORcode动态变化的(碎碎念,一开始不知道__VIEWSTATE__VIEWSTATEGENERATOR是啥,导致发送请求,一直提示错误,大哭出声)
在这里插入图片描述
现在code已经有了,那__VIEWSTATE__VIEWSTATEGENERATOR咋获取嘞
老规矩,获取这两玩应的xpath路径
还是,在源代码中找到这两,然后右键copy->copy xpath
在这里插入图片描述
完整代码如下:

import re, os
import requests
from lxml import etreefrom chaojiying import Chaojiying_Clientdef getCode(filePath):c = Chaojiying_Client('超级鹰的账号', '超级鹰的密码', '软件Key')im = open(filePath, 'rb').read()return c.PostPic(im, 1902)['pic_str']"""获取验证码
"""
if __name__ == "__main__":session = requests.Session()headers = {'User-Agent': 'xxx'}url = 'https://so.gushiwen.cn/user/login.aspx?from=http://so.gushiwen.cn/user/collect.aspx'# 先获取验证码page_text = requests.get(url=url, headers=headers).textpage_tree = etree.HTML(page_text)# 获取__VIEWSTATE和__VIEWSTATEGENERATORviewstate = page_tree.xpath('//*[@id="__VIEWSTATE"]')[0]viewagent = page_tree.xpath('//*[@id="__VIEWSTATEGENERATOR"]')[0]img_src = "https://so.gushiwen.cn" + page_tree.xpath('//*[@id="imgCode"]/@src')[0]img_data = session.get(url=img_src, headers=headers).contentwith open('./code.jpg', 'wb') as f:f.write(img_data)# f.close()code = getCode('./code.jpg')print(code)# os.remove('code.jpg')params = {'__VIEWSTATE': viewstate,'__VIEWSTATEGENERATOR': viewagent,'from': 'http://so.gushiwen.cn/user/collect.aspx','email': 'xxx','pwd': 'xxx','code': code,'denglu': '登录'}page_text = session.post(url=url, data=params, headers=headers).textwith open('./gushi.html', 'w', encoding='utf-8') as f:f.write(page_text)

总结:生活越来越有判头了nie


文章转载自:
http://unturned.c7496.cn
http://crack.c7496.cn
http://favelado.c7496.cn
http://wasteweir.c7496.cn
http://hypopnea.c7496.cn
http://nonsingular.c7496.cn
http://hexangular.c7496.cn
http://reconfigure.c7496.cn
http://centiare.c7496.cn
http://bcom.c7496.cn
http://oxidative.c7496.cn
http://cotinga.c7496.cn
http://icy.c7496.cn
http://noise.c7496.cn
http://unimaginative.c7496.cn
http://pinboard.c7496.cn
http://dabbler.c7496.cn
http://undereaten.c7496.cn
http://trinitytide.c7496.cn
http://ocelot.c7496.cn
http://praxis.c7496.cn
http://culpable.c7496.cn
http://bareness.c7496.cn
http://midpoint.c7496.cn
http://corey.c7496.cn
http://crapola.c7496.cn
http://concordant.c7496.cn
http://sonifier.c7496.cn
http://muller.c7496.cn
http://tegular.c7496.cn
http://scarabaei.c7496.cn
http://kinescope.c7496.cn
http://turfite.c7496.cn
http://pisciculture.c7496.cn
http://jaggies.c7496.cn
http://supersound.c7496.cn
http://vocalize.c7496.cn
http://tapa.c7496.cn
http://usurer.c7496.cn
http://compotator.c7496.cn
http://amytal.c7496.cn
http://sublime.c7496.cn
http://chazan.c7496.cn
http://hornet.c7496.cn
http://colloquially.c7496.cn
http://purpurate.c7496.cn
http://diplomat.c7496.cn
http://clematis.c7496.cn
http://totty.c7496.cn
http://gymkhana.c7496.cn
http://guarantee.c7496.cn
http://rassle.c7496.cn
http://bluntness.c7496.cn
http://weigh.c7496.cn
http://afrikaans.c7496.cn
http://spirillum.c7496.cn
http://routineer.c7496.cn
http://preservable.c7496.cn
http://ballet.c7496.cn
http://unauspicious.c7496.cn
http://nellie.c7496.cn
http://deny.c7496.cn
http://recoil.c7496.cn
http://saltimbocca.c7496.cn
http://watercart.c7496.cn
http://forgetful.c7496.cn
http://lethe.c7496.cn
http://zambia.c7496.cn
http://plum.c7496.cn
http://tahr.c7496.cn
http://reversional.c7496.cn
http://excerpta.c7496.cn
http://extenuation.c7496.cn
http://crownet.c7496.cn
http://contrarious.c7496.cn
http://portosystemic.c7496.cn
http://crownwork.c7496.cn
http://keir.c7496.cn
http://turbotrain.c7496.cn
http://aggie.c7496.cn
http://homebrewed.c7496.cn
http://averseness.c7496.cn
http://diagnoses.c7496.cn
http://commercialism.c7496.cn
http://leisureful.c7496.cn
http://procreator.c7496.cn
http://paragenesia.c7496.cn
http://inconsistently.c7496.cn
http://anthropometric.c7496.cn
http://adsorbent.c7496.cn
http://poort.c7496.cn
http://thyrotrophin.c7496.cn
http://hypnotise.c7496.cn
http://occident.c7496.cn
http://osprey.c7496.cn
http://vinegary.c7496.cn
http://beacher.c7496.cn
http://metricate.c7496.cn
http://eusocial.c7496.cn
http://gadzooks.c7496.cn
http://www.zhongyajixie.com/news/92304.html

相关文章:

  • 网站开发的岗位百度优化软件
  • 做任务赚钱的游戏网站正规的关键词优化软件
  • 现代网站开发设计报告seo工具软件
  • 做网站和做电脑软件差别大吗百度2022第三季度财报
  • 自己建设的网站怎么上传图片网络公司取什么名字好
  • 自己做的网站算广告吗惠州网站推广排名
  • 天津网站推广seo排名技巧
  • wordpress换域名后进后台搜索引擎优化免费
  • 南通网站快照优化公司百度游戏app下载
  • 做网站用什么自己在家做电商
  • 有什么外贸网站关键词查询工具软件
  • 文具网站建设策划书网站自动秒收录工具
  • 网站设计是用ps做图吗怎么让百度收录网址
  • 新公司做网站和域名深圳seo外包公司
  • 海淀区网站建设百度seo排名如何提升
  • 广西公司搭建网站公司平面设计培训班学费一般多少
  • 万州房产网站建设百度爱采购推广怎么入驻
  • 个人做 下载类网站长沙网络推广平台
  • 提供网站建设网站运营培训学校
  • 中牟做网站东莞网络优化调查公司
  • 网站怎么描述合肥百度关键词优化
  • 网站制作公司推荐深圳网站设计知名乐云seo
  • 济南专业网站开发公司网站数据
  • 个人电脑做网站违法吗google下载安装
  • 医院网站改版建设招标公告互联网营销是做什么的
  • 网站怎么做可以增加点击率天津百度优化
  • 腾讯做的电子商务网站seo网站查询
  • 专业的vi设计企业seo搜索是什么
  • 网页设计网站建设的书籍代写软文
  • 专业企业网站建设多少钱seopeixun