Пример #1
0
 def get_url(self):
     hu = huxiu()
     tmt = tmtpost()
     zao = zaodu()
     chan = chanpin()
     pmt = pmtoo()
     woshi = woshipm()
     url_list = hu.get_url() + tmt.get_url() + zao.get_url() \
     + chan.get_url() + pmt.get_url() + woshi.get_url()
     # print(url_list)
     return url_list
Пример #2
0
    def get_news(self, url):
        """
        :param url: 需要抓取内容的URL地址
        :url[12]: 判断对应的url,h, m, 3, l分别对应:huxiu, tmtpost, 36kr, leiphone
        :return: news
        """
        if url:
            if url[11] == 'c':
                chan = chanpin()
                return chan.get_news(url)

            elif url[12] == 'h':
                hu = huxiu()
                return hu.get_news(url)

            elif url[11] == 'p':
                pmt = pmtoo()
                return pmt.get_news(url)

            elif url[12] == 'm':
                tmt = tmtpost()
                return tmt.get_news(url)

            elif url[12] == 'z':
                zao = zaodu()
                return zao.get_news(url)

            elif url[12] == 'o':
                woshi = woshipm()
                return woshi.get_news(url)

            else:
                print(self.time_now(), '\tAppear error url=', url, '\n')
                return None
        else:
            print(self.time_now(), '\tAppear error url= None\n')
            return None