马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
from requests import get
from bs4 import BeautifulSoup as bs
def find_data(res):
soup = bs(res.text, "html.parser")
content = soup.find_all("ul", class_="pf_l")
return content
def main(uid):
res = get(f"https://fishc.com.cn/space-uid-{uid}.html", headers={"User-Agent" : "Mozilla/5.0"})
content = find_data(res)
return content
if __name__ == "__main__":
while True:
uid = input("请输入 UID:")
content = main(uid)
for i in content:
if hasattr(i, "strings"):
print(" ".join(i.strings))
else:
print(i.text)
|