虽然没有被屏蔽但抓取但没有内容

问题描述 投票:0回答:1

我已经抓取了nhatot.com网站的内容,但没有可用的内容。我认为我的计算机被阻止了,但事实并非如此。我可以正常访问网站(nhatot.com) 这是我的Python代码

page = 1

header = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"}
payload = {
    'render_js' :'true'
}
proxies = {
   'http': 'http://eiQqeQQ5:[email protected]:63362/' 
   # 'https': 'https://eiQqeQQ5:[email protected]:63362/',
}

base_url = "https://www.nhatot.com"

list_house_url=[]
for i in range(1,10):
    url = "https://www.nhatot.com/mua-ban-bat-dong-san?page="+str(i)
    print(url)
    request =requests_a.get(url,headers=header,proxies=proxies ,params=payload,verify=False)
    soup= BeautifulSoup(request.content,'html.parser')
    soup1= BeautifulSoup(soup.prettify(),'html.parser')

    page_content =  soup1.find_all('a',class_='AdItem_adItem__gDDQT')
    print(page_content)
    for a in page_content:
        list_house_url.append(base_url+a['href'])

print(list_house_url)

这是结果

https://www.nhatot.com/mua-ban-bat-dong-san?page=1
[]
https://www.nhatot.com/mua-ban-bat-dong-san?page=2
[]

我尝试过使用代理,但它仍然有效。

python web-scraping python-requests web-crawler
1个回答
0
投票

我刚刚尝试使用浏览器访问此网址,第一个响应是人性证明页面。这可能是您的抓取工具无法工作但您的浏览器(之前已经登录)可以工作的原因。尝试打印或转储原始请求的结果,它会给你答案。enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.