You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
import requests
|
|
from bs4 import BeautifulSoup
|
|
|
|
def l():
|
|
url = "https://www.ncrczpw.com/index.php?m=jobfair&c=index&a=index"
|
|
head = {
|
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0"
|
|
}
|
|
r = requests.get(url,headers=head)
|
|
r.encoding = 'utf-8'
|
|
bea = BeautifulSoup(r.text,'lxml')
|
|
text = bea.select("div.td2 a")
|
|
arr = []
|
|
for i in text:
|
|
arr.append(i.get("href"))
|
|
arr.pop()
|
|
return arr
|
|
|
|
def text(url):
|
|
head = {
|
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0'
|
|
}
|
|
r = requests.get(url, headers=head)
|
|
r.encoding = 'utf-8'
|
|
ms = BeautifulSoup(r.text, 'lxml')
|
|
s = ""
|
|
text = ms.select("div.jobfairshow div.txt")
|
|
for t in text:
|
|
s = s + t.get_text(strip=True) + ","
|
|
text = ms.select("div a strong")
|
|
for t in text:
|
|
s = s + t.get_text(strip=True) + ","
|
|
print(s)
|
|
arr = l()
|
|
print(arr)
|
|
for t in range(0,8):
|
|
text(arr[t])
|
|
|
|
|
|
|