汪晓康

导航

基于种子搜的番号搜索工具

#!/usr/bin/python
# coding: UTF-8
import requests
from bs4 import BeautifulSoup
import re

print("请输入番号")
fh = input("番号是:")
print(fh)
link1 = "https://www.sobt5.vip/q/"+fh+".html"
headlink = "https://www.sobt5.vip"
def GetLink(link):
	headers = {'User-Agent' : 'Mozilla/5.0 (Windows; U; Windows NT6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'}
	r = requests.get(link, headers= headers)
	r.encoding = r.apparent_encoding
	html_doc = r.text
	soup = BeautifulSoup(html_doc,"html.parser")
	pattern = re.compile(r'a href="(\S+.html)"\s+target=')
	result1 = pattern.findall(html_doc)
	return result1
def GetTorrent(link):
	headers = {'User-Agent' : 'Mozilla/5.0 (Windows; U; Windows NT6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'}
	r = requests.get(link, headers= headers)
	r.encoding = r.apparent_encoding
	html_doc = r.text
	soup = BeautifulSoup(html_doc,"html.parser")
	pattern = re.compile(r'<input  id="m_link" value="(\S+)" readonly')
	result2 = pattern.findall(html_doc)
	return result2
##
rs1 = GetLink(link1)
for each in rs1:
	link2 = headlink+each
	rs2 = GetTorrent(link2)
	for each in rs2:
		print(each)

posted on 2021-08-09 23:10  汪晓康  阅读(6193)  评论(0编辑  收藏  举报