attributeerror:“nonetype”对象没有“find\u next”属性

yfjy0ee7  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(224)

嗨,请帮助我,当我想刮数据时,我得到了错误类型。请帮帮我!我已经试过很多次了。。。。。。。。。我从jobstreet网站上搜集数据。请帮忙?

alls = []
    for job in jobs:

        link = job.find('a',{'class':'DvvsL_0 _1p9OP'}).get('href')
        job_response = requests.get('https://www.jobstreet.com.my'+link)
        job_data = job_response.text
        job_soup = BeautifulSoup(job_data,'html.parser')
        add= job_soup.find('div',{'class': 'FYwKg d7v3r _3BZ6E_0'}).find_next('div').find_next('div')

        Years_of_Experience = add.find('span',{'class': 'FYwKg _2Bz3E C6ZIU_0 _6ufcS_0 _2DNlq_0 _29m7__0 _2WTa0_0'}).find_next('span').find_next('span').find_next('span').find_next('span').text.strip()
        Job_Type = add.find('span',{'class': 'FYwKg _2Bz3E C6ZIU_0 _6ufcS_0 _2DNlq_0 _29m7__0 _2WTa0_0'}).find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').text.strip()
        Specific_Location = add.find('span',{'class': 'FYwKg _2Bz3E C6ZIU_0 _6ufcS_0 _2DNlq_0 _29m7__0 _2WTa0_0'}).find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').find_next('span').text

        all1=[]

        if Years_of_Experience is not None:
              all1.append(Years_of_Experience)

        else:
              all1.append(Years_of_Experience ='0')

        if Job_Type is not None:
              all1.append(Job_Type)

        else:
              all1.append(Job_Type ='0')

        if Specific_Location is not None:
              all1.append(Specific_Location)

        else:
              all1.append(Specific_Location ='0')
        alls.append(all1)    
    return alls

错误,我该怎么办?

<ipython-input-9-af27fded9228> in get_data(pageNo)
     33         job_data = job_response.text
     34         job_soup = BeautifulSoup(job_data,'html.parser')
---> 35         add= job_soup.find('div',{'class': 'FYwKg d7v3r _3BZ6E_0'}).find_next('div').find_next('div')
     36 
     37 

AttributeError: 'NoneType' object has no attribute 'find_next'

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题