def originalCode(): core.GetHouseByRegionlist(city, regionlist) core.GetRentByRegionlist(city, regionlist) # Init,scrapy celllist and insert database; could run only 1st time core.GetCommunityByRegionlist(city, regionlist) communitylist = get_communitylist(city) # Read celllist from database core.GetSellByCommunitylist(city, communitylist)
import core import model import settings def get_communitylist(): res = [] for community in model.Community.select(): res.append(community.title) return res if __name__ == "__main__": regionlist = settings.REGIONLIST # only pinyin support model.database_init() core.GetHouseByRegionlist(regionlist) core.GetRentByRegionlist(regionlist) core.GetCommunityByRegionlist(regionlist) # Init,scrapy celllist and insert database; could run only 1st time communitylist = get_communitylist() # Read celllist from database core.GetSellByCommunitylist(communitylist)
import core import model import settings import logging def get_communitylist(city): res = [] for community in model.Community.select(): if community.city == city: res.append(community.title) return res if __name__ == "__main__": logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO) regionlist = settings.REGIONLIST # only pinyin support city = settings.CITY model.database_init() logging.info("Scrawling House Info") core.GetHouseByRegionlist(city, regionlist) # core.GetRentByRegionlist(city, regionlist) # Init,scrapy celllist and insert database; could run only 1st time # logging.info("Scrawling Community Info") # core.GetCommunityByRegionlist(city, regionlist) # communitylist = get_communitylist(city) # Read celllist from database # core.GetSellByCommunitylist(city, communitylist)
res.append(community.title) return res def get_custom_communitylist(): res = [] res.append(u'木樨地') res.append(u'物资大院') res.append(u'三里河北街3号院') res.append(u'三里河北街5号院') res.append(u'真武庙') return res if __name__ == "__main__": pages = settings.PAGES regionlist = settings.REGIONLIST # only pinyin support model.database_init() core.GetHouseByRegionlist(regionlist, pages) core.GetRentByRegionlist(regionlist, pages) core.GetCommunityByRegionlist( regionlist ) # Init,scrapy celllist and insert database; could run only 1st time custom_l = get_custom_communitylist() core.GetCommunityByCustomlist(custom_l) communitylist = get_communitylist() # Read celllist from database core.GetHouseByCommunitylist(communitylist, pages) core.GetRentByCommunitylist(communitylist, pages) core.GetSellByCommunitylist(communitylist, pages) #woaiwojialib.GetSellByCommunitylist()