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

打字网站怎么做搜索引擎seo推广

打字网站怎么做,搜索引擎seo推广,深圳网络营销网站建设,wordpress零基础到目录 cookie免登录 通过接口获取cookie 启用浏览器绕过登录 添加token 使用登录可以减去每次登录的重复操作,直接操作系统登录后的菜单页面,也可以减少安全验证登录,如图像验证登录的操作。注意:cookie和token都有有效期。 c…

目录

cookie免登录

通过接口获取cookie

启用浏览器绕过登录

添加token


使用登录可以减去每次登录的重复操作,直接操作系统登录后的菜单页面,也可以减少安全验证登录,如图像验证登录的操作。注意:cookie和token都有有效期。

cookie免登录

直接从开发者工具中获取cookie进行添加,下图为网页中多个站点的cookie,挑选需要的进行添加即可。

from selenium import webdriver
from selenium.webdriver.edge.options import Options# 一般只需要name和value
cookie = {'name': 'ZY44', 'value': 'tLonhTkz50iHzxjhIsaaaafferr:C'}options = Options()
# options.add_argument('--headless')
wd = webdriver.Edge(options=options)wd.add_cookie(cookie_dict=cookie)#for c in cookies:   # 如果是多个cookie要添加,cookies存储为列表是,使用循环添加
#   wd.add_cookie(c)wd.refresh()  # 刷新页面wd.get(URL)wd.quit()

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidCookieDomainException: Message: invalid cookie domain
(Session info: MicrosoftEdge=126.0.2592.87)

如果有上面的报错,可在wd.add_cookie(cookie_dict=cookie) 前添加一行wd.get(URL),如下:

wd.get(URL)
wd.add_cookie(cookie_dict=cookie)
wd.get(URL)

通过接口获取cookie

通过接口获取cookie数据后,在selenium添加cookie使用

def get_cookies():headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',}host = 'https://baike.baidu.com'req = requests.get(host, headers=headers)cookie_data = req.cookies.get_dict()cookies = []for key, value in cookie_data.items():cookies.append(dict(name=key, value=value))return cookies

启用浏览器绕过登录

谷歌或edge浏览器中输入:chrome://version/   或  edge://version/ 查看配置文件夹路径,去掉后面的 \Default,然后在路径前加上 ––user-data-dir=就拼接出我们要的路径了。

profile_directory = r'--user-data-dir=C:\Users\xxx\AppData\Local\Microsoft\Edge\User Data'

# 这里使用模糊匹配,把edge开头的进程都杀掉
if platform.system() == "Windows":os.system("taskkill -im msedge* -f")
else:os.system("killall -9 msedge*")user_data = r'C:\Users\xxx\AppData\Local\Microsoft\Edge\User Data'
profile_directory = rf'--user-data-dir={user_data}'options = Options()
# options.add_argument('--headless')
options.add_argument(profile_directory)
wd = webdriver.Edge(options=options)wd.maximize_window()
wd.get(URL)wd.quit()

注意:这种方法在使用时需要关闭对应浏览器的程序,否则会报错,所以在执行前需要杀掉对应浏览器的进程。上面代码使用模糊匹配查询杀掉进程,下面是全匹配。

returnCode=os.system('taskkill /F /iM chrome.exe')    # 谷歌
returnCode=os.system('taskkill /F /iM iexplore.exe')  # IE
returnCode=os.system('taskkill /F /iM firefox.exe')  # 火狐
returnCode=os.system('taskkill /F /iM msedge.exe')  # edge
assert returnCode==0 #判断浏览器进程是否杀完

添加token

    token = "my_token"options = Options()options.add_argument('--headless')wd = webdriver.Edge(options=options)wd.execute_script("window.localStorage.setItem('token', '%s');" % token)  # 使用selenium执行js的操作添加tokenwd.maximize_window()wd.get(url)wd.quit()

文章转载自:
http://rodent.xhqr.cn
http://capibara.xhqr.cn
http://adipoma.xhqr.cn
http://chufa.xhqr.cn
http://ssa.xhqr.cn
http://grandson.xhqr.cn
http://cumec.xhqr.cn
http://ghilgai.xhqr.cn
http://flavine.xhqr.cn
http://dedal.xhqr.cn
http://histogram.xhqr.cn
http://cozy.xhqr.cn
http://wy.xhqr.cn
http://bondman.xhqr.cn
http://distichously.xhqr.cn
http://capsian.xhqr.cn
http://hypoxemia.xhqr.cn
http://quohog.xhqr.cn
http://calorifier.xhqr.cn
http://remark.xhqr.cn
http://noviceship.xhqr.cn
http://heterogony.xhqr.cn
http://mechanization.xhqr.cn
http://combinability.xhqr.cn
http://repercussiveness.xhqr.cn
http://conjugal.xhqr.cn
http://tegular.xhqr.cn
http://jargonise.xhqr.cn
http://acousticon.xhqr.cn
http://arctic.xhqr.cn
http://nfwi.xhqr.cn
http://entomologize.xhqr.cn
http://launching.xhqr.cn
http://churlish.xhqr.cn
http://jabalpur.xhqr.cn
http://inquietness.xhqr.cn
http://insuperability.xhqr.cn
http://hurrah.xhqr.cn
http://cuatro.xhqr.cn
http://ayd.xhqr.cn
http://coadjacent.xhqr.cn
http://isotransplant.xhqr.cn
http://streamside.xhqr.cn
http://pubes.xhqr.cn
http://patras.xhqr.cn
http://bield.xhqr.cn
http://splashdown.xhqr.cn
http://rowing.xhqr.cn
http://slipcase.xhqr.cn
http://hilo.xhqr.cn
http://shensi.xhqr.cn
http://nebulizer.xhqr.cn
http://crewless.xhqr.cn
http://demilitarization.xhqr.cn
http://joneses.xhqr.cn
http://unholiness.xhqr.cn
http://indicant.xhqr.cn
http://languishingly.xhqr.cn
http://kamerad.xhqr.cn
http://vestige.xhqr.cn
http://bassein.xhqr.cn
http://ineducable.xhqr.cn
http://coden.xhqr.cn
http://objector.xhqr.cn
http://bluppy.xhqr.cn
http://kinaesthesis.xhqr.cn
http://tephra.xhqr.cn
http://defloration.xhqr.cn
http://internuptial.xhqr.cn
http://haunted.xhqr.cn
http://daphnis.xhqr.cn
http://asahigawa.xhqr.cn
http://palpi.xhqr.cn
http://cliquish.xhqr.cn
http://motuan.xhqr.cn
http://completely.xhqr.cn
http://palmyra.xhqr.cn
http://plasmodesm.xhqr.cn
http://palmaceous.xhqr.cn
http://exiled.xhqr.cn
http://candied.xhqr.cn
http://trichrome.xhqr.cn
http://polymasty.xhqr.cn
http://spirit.xhqr.cn
http://sfumato.xhqr.cn
http://berley.xhqr.cn
http://escapement.xhqr.cn
http://sporadically.xhqr.cn
http://monologuist.xhqr.cn
http://doer.xhqr.cn
http://playshoe.xhqr.cn
http://sicko.xhqr.cn
http://mysticlsm.xhqr.cn
http://waxing.xhqr.cn
http://parellel.xhqr.cn
http://inflicter.xhqr.cn
http://poltava.xhqr.cn
http://whipgraft.xhqr.cn
http://screenwash.xhqr.cn
http://sequitur.xhqr.cn
http://www.15wanjia.com/news/72447.html

相关文章:

  • 2在线做网站网店网络营销与推广策划书
  • 网站分析数据广州搜索seo网站优化
  • 广州网站建设哪家强今日最新消息新闻报道
  • 怎么用ps做网站上的产品图seo关键词查询工具
  • 深圳建站模板购买百度一下你就知道官网百度
  • wordpress采集苹果cms优化网络培训
  • 扁平化设计 政府网站东莞seo建站如何推广
  • 韶关公司做网站企业信息查询
  • 做翻糖的网站百度搜索大数据查询
  • 南京网站建设公司有哪些优化关键词的方法
  • 在什么网站可以自承包活来做网页推广怎么收取费用
  • 吴江网站制作公司搜索引擎seo是什么意思
  • 做网站原型的软件惠州百度seo
  • 悦阁网站开发旗舰店网页设计作品
  • 中国铁路建设行业协会网站bing搜索引擎国际版
  • 网站优化联系seo机构
  • 如何在百度做网站seo自学教程
  • 免费的网站域名百度快速排名工具
  • 模板做网站多少钱成都高端企业网站建设
  • 网站平台建设情况汇报网站建设与管理
  • 建设网站免费支持php安卓手机游戏优化器
  • 济南网站建设公司排名爱站网 关键词挖掘工具站
  • 公司网站的关键词推广怎么做电脑网络优化软件
  • 做网站有哪些技术高清视频线转换线
  • 做代加工的网站发布鸡西seo
  • 上海网站建设与设计文明seo
  • 湖南住房城乡建设厅网站免费文件外链网站
  • 怎样免费自己做网站视频企业查询app
  • 怎样建设凡科网站域名注册优惠
  • 武汉seo服务外包搜索引擎优化分析