Пример #1
0
    def get_episode_link(self,episode_info):
        page = util.get(episode_info['link'])
        soup = BeautifulSoup(page,'lxml')
        script = soup.find('script',{'type':'text/javascript'}).text.replace('return p','console.log(p)')
        self.script_tool = ScriptTool()
        result = self.script_tool.run_script(script.encode('UTF-8').strip().split('\n')[2])
        urls = result.replace('var pages=pages=\'','').replace('"}\';','"}').replace("]';",'').replace('["','"').replace('"','').replace('\/','/').split(',')
        for i in range(0,len(urls)):
            urls[i] = 'http://images.dmzj.com/' + urls[i]

        return urls
Пример #2
0
    def __init__(self,url,choose_mode = False):

        #init credential
        self.get_credential(url)
        self.url = self.build_index_url()
        self.choose_mode = choose_mode

        respon = util.get(self.url)
        if respon:
            self.page = respon
            self.bs = BeautifulSoup(self.page,'lxml')
        else:
            raise CommunicationInterruptions(self.url)

        self.host = util.get_domain(self.url)
Пример #3
0
 def get_cover(self):
     element = self.bs.findAll('img',{'id':'cover_pic'})[0]
     return util.get(element['src'],header = {'Referer':self.url})
Пример #4
0
 def get_picture(self,url):
     return util.get(url,header={
                                 'Referer':'http://www.dmzj.com/',
                                 'User-Agent':'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36'
                                     }
                         )