scrapyjiji.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:scrapyjiji 作者: sbourdelin 项目源码 文件源码
def spider_closed(self, spider):
        """Handle the spider_closed event to save the map"""

        # create the special marker for all the ads without geocode
        print "found %d items without geocode" % (len(self.no_geocode))
        if len(self.no_geocode) > 0:
            html = ""
            for x in self.no_geocode:
                html += "<a href=%s target=_blank>%s</a> : %s<br>" % (x["url"], x["title"], x["price"])
            iframe  = folium.element.IFrame(html=html, width=500, height=100)
            popup   = folium.Popup(iframe, max_width=500)
            folium.Marker(MAP_LATLNG,
                          popup=popup,
                          icon=folium.Icon()).add_to(self.m_map)

        print "found %d new items" % (self.new_items)
        pickle.dump(self.m_list, open(DATABASE, 'wb'))
        self.m_map.save('map.html')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号