一、爬取
(ML) mrc@mrc-Precision-3660:request$ cat request_intein.py
import requests
from bs4 import BeautifulSoup
# 基础URL
base_url = "https://inbase.ligsciss.com/iwai/InBase/tools.neb.com/inbase/"
# 目标页面
url = base_url + "list_prop.html"
# 获取网页内容
response = requests.get(url)
response.encoding = 'utf-8' # 设置编码
soup = BeautifulSoup(response.text, 'html.parser')
# 获取所有Intein链接
intein_links = soup.find_all('a')
# 存储Intein名称和对应的序列
intein_sequences = {}
for link in intein_links:
# 检查<a>标签是否有href属性
if 'href' in link.attrs:
intein_name = link.text.strip()
intein_url = base_url + link['href']
# 获取Intein详细信息页面内容
intein_response = requests.get(intein_url)
i