为了账号安全,请及时绑定邮箱和手机立即绑定

我想使用 beautifulsoup 从 python 中的链接获取内容

我想使用 beautifulsoup 从 python 中的链接获取内容

牛魔王的故事 2023-02-22 15:39:40
我正在尝试从https://www.indeed.ae/jobs?q=&l=dubai中删除数据我想获取内容(点击上面链接上的每个职位即可获得)我正在使用 python、requests 和 bs4它的内容来自链接中的链接,我想获取每份工作的所有内容import requestsfrom bs4 import BeautifulSoupimport lxmlimport urllib.requesturl = 'https://www.indeed.ae/jobs?q=&l=dubai'response = requests.get(url)soup = BeautifulSoup(response.text, 'lxml')links = soup.find_all('a', {'class': 'jobtitle turnstileLink'})for correct_url in (soup.find_all('a', {'class': 'jobtitle turnstileLink'})):    correct_url = ("https://indeed.ae" + (links.get('href')))    print(correct_url)
查看完整描述

1 回答

?
梦里花落0921

TA贡献1772条经验 获得超6个赞

此脚本将打印所有作业的描述(页面通过 JavaScipt 加载此信息,但您可以使用requests模块来加载此信息):


import requests

from bs4 import BeautifulSoup



url = 'https://www.indeed.ae/jobs?q=&l=dubai'

jobdesc_url = 'https://www.indeed.ae/rpc/jobdescs'

soup = BeautifulSoup(requests.get(url).content, 'html.parser')

jks = ','.join(jk['data-jk'] for jk in soup.select('[data-jk]'))


descriptions = requests.get(jobdesc_url, params={'jks': jks}).json()


for jk in soup.select('[data-jk]'):

    print(jk.h2.get_text(strip=True))

    print()

    print(jk.find_next('span', class_='company').get_text(strip=True))

    print('---')

    print(BeautifulSoup(descriptions[jk['data-jk']], 'html.parser').get_text())

    print('-' * 80)

印刷:


RETAIL SALES ASSOCIATE


Al Ghazi

---

Hiring a Retail Sales Associate for Dubai.


Key Responsibilities:

Attend to walk in customers, phone calls and provide customer service.

Maintain a conducive environment in the outlet through house keeping.

Promote products and ensure high levels of customer satisfaction through customer journey mapping.

Recommend and display items that match customers’ needs and preferences.


Key Requirements:

High school Diploma.

One to two years experience as a Retail sales Associate.

Presentable and well-groomed

Observe strict punctuality.

Able to work well in a team.

Able to multi-task.

--------------------------------------------------------------------------------

Human Resource Officer


Raban Al-Safina

---

The Role

We are looking for a HR Officer with 3 to 4 years UAE work experience.Candidate must be available currently in UAE and ready to join immediately. Candidates on Husband / Father Sponsor visas will be given more preference. Job Responsibilities: • Working closely with various departments, increasingly in a consultancy role, assisting line managers to understand and implement policies and procedures • Administering payroll and maintaining employee records • Interpreting and advising on employment law • Advising on pay and other remuneration issues, including promotion and benefits • Developing and implementing policies on issues like working conditions, performance management, equal opportunities, • Disciplinary procedures and absence management • Recruiting staff, which involves developing job descriptions and person specifications, preparing job adverts, checking application forms, shortlisting, interviewing and selecting candidates


Requirements


As a Human Resources (HR) officer you'll develop, advise on and implement policies relating to the effective use of staff in an organisation. • In the role your aim is to ensure that the organisation you work for employs the right balance of staff in terms of skill and experience, and that training and development opportunities are available to colleagues to enhance their performance and achieve the company's business aims. • HR officers are involved in a range of activities whatever the size or type of business. These cover areas such as: • Conditions of employment • Equality and diversity • Negotiation with external work-related agencies • Pay roll management • Recruitment • Working practices.


About the company

Raban Al-Safina Group of Companies stands as one of the most prominent industrial organizations in Iraq work in different fields in power industry, oil & gas, systems technology, and many others.

--------------------------------------------------------------------------------


...and so on.


查看完整回答
反对 回复 2023-02-22
  • 1 回答
  • 0 关注
  • 108 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信