代码拉取完成,页面将自动刷新
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
' seek 58 city module '
__author__ = 'Ma Cong'
import mainPage
import time
import random
class seek58(object):
def __init__(self):
linkGkq = 'http://bd.58.com/gaokaiqu/ershoufang/h1/pn{}'
linkXsq = 'http://bd.58.com/xinshiqu/ershoufang/h1/pn{}'
linkBsq = 'http://bd.58.com/beishi/ershoufang/h1/pn{}'
linkNsq = 'http://bd.58.com/nanshiqu/ershoufang/h1/pn{}'
self.listLink = [linkNsq, linkXsq, linkBsq, linkGkq]
#self.listLink = [linkNsq]
def seek(self):
shiqu = 0
for linkTmp in self.listLink:
shiqu += 1
print('换市区了:' + linkTmp)
start = 1
end = 70
urls = [linkTmp.format(i) for i in range(start, end)]
for url in urls:
mp = mainPage.page(url)
mp.save_info_from_mainpage(shiqu)
#mp.save_info_from_detailpages(shiqu)
time.sleep(2)
#time.sleep(10 + random.randint(1, 10))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。