cdroad / btsow_crawler Goto Github PK
View Code? Open in Web Editor NEW因为原BTSOW广告太多,使用Python对BTSOW磁力站点内容进行抓取。
License: MIT License
因为原BTSOW广告太多,使用Python对BTSOW磁力站点内容进行抓取。
License: MIT License
1、把btsow的镜像改为.bar了
2、现在输出5页(这个页码数可以在cycles变量后面改)
3、输出到一个xls文件(其实是txt文件),每一个链接的元素用制表符分隔
#!/usr/bin/python3
from json.tool import main
from telnetlib import DO
import requests;
from bs4 import BeautifulSoup
urls=[]
text=''
key='siterip'
cycles=5
hash_head = 'magnet:?xt=urn:btih:'
output_path = key + '(' + str(cycles) + 'pages).xls'
#提取出所有list里的href值
def tiqu():
for n in text:
urls.append(n['href'])
#拿到大小日期
b = n.find_all('div',class_='col-xs-12 size-date visible-xs-block')
c = b[0].get_text()
#拿到标题
title = n['title']
#切片提取hash
l_hash = str(n['href'])
tiqu_hash = l_hash[32:]
jiehe_hash = hash_head + tiqu_hash
#print(title + '\n' + l_hash[32:n] + '\n' + c)
with open(output_path,'a',encoding='utf-8') as file1:
print(title + '\t' + c + '\t' + jiehe_hash,file=file1)
for i in range(cycles):
url = 'https://btsow.bar/search/' + key + '/page/' + str(i+1)
#对内容进行编码
html = requests.get(url);
html.encoding = html.apparent_encoding
content = html.text
soup = BeautifulSoup(content, 'html.parser');
data_div = soup.find_all("div","data-list")
if(len(data_div) == 0):
print("没有"+str(cycles)+'页!')
break
else:
for n in data_div:
text = n.find_all('a')
tiqu()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.