Giter VIP home page Giter VIP logo

btsow_crawler's People

Contributors

cdroad avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

btsow_crawler's Issues

修改了一下你的源代码

1、把btsow的镜像改为.bar了
2、现在输出5页(这个页码数可以在cycles变量后面改)
3、输出到一个xls文件(其实是txt文件),每一个链接的元素用制表符分隔

#!/usr/bin/python3

-- coding: utf-8 --

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()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.