|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
Python 查询移动电话信息
- from requests import get
- from bs4 import BeautifulSoup as BS
- def open_url(url):
- headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'}
- return get(url)
- def get_sjInfo(res):
- soup = BS(res.text, "html.parser")
- target = soup("td", bgcolor="#FFFFFF", align="center", style="font-size:16px;")
- print("电话号码: ", target[0].text)
- print("归属地: ", target[1].text)
- print("卡类型: ", target[2].text)
- def main():
- phone = input("请输入手机号码: ")
- url = "https://shouji.51240.com/%s__shouji/" % phone
- get_sjInfo(open_url(url))
- if __name__ == "__main__":
- main()
复制代码
|
|