首页 > 编程语言 >postman 出现Enable JavaScript and cookies to continue 如何反爬(js反爬)

postman 出现Enable JavaScript and cookies to continue 如何反爬(js反爬)

时间:2023-11-23 19:23:59浏览次数:31  
标签:cookies Enable 网页 get 反爬 js cookie

网页无法F12,禁止调试出现debug怎么办

直接F8禁用,ctrl+F8开启调试断点
网站禁止ip访问,并且关闭了icmp回包,调试最好禁用缓存,以便实时更新
image

image
用postman单独访问首页的index的首页也是无法获取网页内容
image
考虑网页使用js进行跳转
实例:

比如使用postman请求https://www.phind.com/
image

简单来说,就是html文件中包含cookie设置和动态跳转网址的js代码,访问这个网页时js会设置cookie然后重定向到另一个网页,所以只是get这个url是不行的。
同理,如果清除cookie,在浏览器中f12,然后按f1禁用js,也会出现postman请求放回的内容

网页检查禁用 JavaScript

若要关闭 JavaScript,请:

若要打开 DevTools,请右键单击网页,然后选择“ 检查”。 或者,按 Ctrl+Shift+I (Windows、Linux) 或 Command+Option+I (macOS) 。 DevTools 随即打开。

按 Ctrl+Shift+P (Windows、Linux) 或 Command+Shift+P (macOS) 打开 命令菜单。
image
image
js格式化工具
https://coding.tools/cn/javascript-beautifier

实现抓取的过程如下:

先get之前能得到的带有js的html。

将其中的js代码正则提取出来。

将里面的atob替换为window["atob"],增加window对象,函数getURL()返回window["location"],即跳转的链接尾缀。

将这个修改后js代码执行,得到尾缀,与原URL链接,得到重定向的URL。

还有就是cookie问题,直接用requests的session处理就好。(会话保持,保持cookie)
image

补充:

cookie转换成字典

def convert_cookies_to_dict(cookies):
    cookies = dict([l.split("=", 1) for l in cookies.split("; ")])
    return cookies
## get网页
## 方式一
import requests
requests.get(url="",headers=dict_header,cookies=dict_cookie)
## 方式二
requests.request(mehod="get/post")

使用help方法可以查看函数的用法和参数类型
image

从浏览器f12获取get的cookie
image
使用函数抓换
image
这里的网站使用了cloudflare的反爬
image
解决办法。使用一个docker去处理绕过cloudflare验证

docker run -d \
  --name=flaresolverr \
  -p 8191:8191 \
  -e LOG_LEVEL=info \
  --restart unless-stopped \
  ghcr.io/flaresolverr/flaresolverr:latest

把请求转发给8191端口,然后等待放回
python代码
image
结果,返回成功
image

参考链接

js反爬
https://zhuanlan.zhihu.com/p/60627685

标签:cookies,Enable,网页,get,反爬,js,cookie
From: https://www.cnblogs.com/codedingzhen/p/17851527.html

相关文章

  • 缓存使用(@EnableCaching、@Cacheable、@CachePut、@CacheEvict、@Caching、@CacheConf
    Spring成神之路第四十篇:缓存使用(@EnableCaching、@Cacheable、@CachePut、@CacheEvict、@Caching、@CacheConfig)本文主要详解spring中缓存的使用。背景缓存大家都有了解过吧,主要用来提升系统查询速度。比如电商中商品详情信息,这些信息通常不会经常变动但是会高频访问,我们可......
  • Animator.Enable一帧内两次设置之间的动画控制属性变更失效
    1)Animator.Enable一帧内两次设置之间的动画控制属性变更失效2)移动端Shader的Varying插值后是否会写回主存3)UnityAvatar在大型MMO中使用情况如何4)UnityWebRequest加载外部图片,尺寸是否必须是4的倍数这是第360篇UWA技术知识分享的推送,精选了UWA社区的热门话题,涵盖了UWA问答、社区......
  • 无GPU环境中运行出错解决方法:AssertionError: Torch not compiled with CUDA enabled
    在執行pytorch代碼的時候,突然看到報錯AssertionError:TorchnotcompiledwithCUDAenabled這說明了1.你pytoch确实安装了2.你安装的是cpu版本作为验证,你可以在python编辑器输入下列代码如果要在无GPU环境中运行,需要进行一些修改。1. 情况一:将出现‘gpu:0’的地方......
  • goldengate add trandata显示最小附加日志already enable,但是info trandata显示disabl
    问题描述:数据库版本11.2.0.4,操作系统版本:windowsserver2012,goldengate版本12.1.2.1.0在给ogg同步表添加trandata的时候,提示supplementalredologdataisalreadyenabled。但是使用infotrandata查看的时候,却显示supplementalredologdataisdisabled。  这时通过......
  • Torch not compiled with Cuda enabled 解决办法
    确保下方指令运行有效:nvcc--version进入指定虚拟环境下运行下方指令:condainstallpytorch==1.11.0torchvision==0.12.0torchaudio==0.11.0cudatoolkit=11.3-cpytorch作者:艾孜尔江......
  • ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule
    1、错误场景和现象Linux开启或重启防火墙后,使用默认驱动程序创建网络“docker-compose_default”报错如下:Creatingnetwork"docker-compose_default"withthedefaultdriverERROR:FailedtoSetupIPtables:UnabletoenableSKIPDNATrule:(iptablesfailed:iptab......
  • 212-c# url下载pdf,url请求,有参数,且携带cookies
    usingSystem;usingSystem.Net;usingSystem.Net.Http;usingSystem.Net.Http.Headers;usingSystem.Threading.Tasks;classProgram{staticvoidMain(){//设置要下载的PDF文件的URLstringpdfUrl="https://example.com/path/to/your/pdf......
  • selenium 反爬
    本地浏览器执行importtimefromseleniumimportwebdriverchrome_option=webdriver.ChromeOptions()chrome_option.add_experimental_option('excludeSwitches',['enable-automation'])#不显示开发者模式chrome_option.add_argument('--disable-blink-f......
  • selenium保存cookies并使用
    importimportjsonimporttimefromseleniumimportwebdriver保存browser=webdriver.Firefox(executable_path=r"C:\MyProgrames\geckodriver.exe")#根据实际修改,启动自己的webdriverdeflogin_for_cookies(url):browser.get(url)input("登陆成功后回车以......
  • Not creating XLA devices, tf_xla_enable_xla_devices not set TypeError: 'mod
     2021-02-2622:54:13.146272:Itensorflow/core/common_runtime/gpu/gpu_device.cc:1406]CreatedTensorFlowdevice(/job:localhost/replica:0/task:0/device:GPU:0with2989MBmemory)->physicalGPU(device:0,name:GeForceGTX1050,pcibusid:0000:01:0......