コード例 #1
0
ファイル: kino_art.py プロジェクト: apophys/zitkino.cz
    def _parse_details(self, url):
        data = {}

        resp = self.session.get(url)
        html = parsers.html(resp.content, base_url=resp.url)
        content = html.cssselect_first('#content .leftcol')

        image = content.cssselect_first('img.wp-post-image')
        if image is not None:
            data['url_posters'] = [self._parse_image_link(image)]

        csfd_link = content.cssselect_first('a.csfd')
        if csfd_link is not None and csfd_link.get('href') != 'http://':
            data['url_csfd'] = csfd_link.get('href')

        imdb_link = content.cssselect_first('a.imdb')
        if imdb_link is not None and imdb_link.get('href') != 'http://':
            data['url_imdb'] = imdb_link.get('href')

        if 'trailer' in content.text_content().lower():
            for iframe in content.cssselect('iframe'):
                try:
                    url = parsers.youtube_url(iframe.get('src'))
                    data['url_trailer'] = url
                except ValueError:
                    pass

        return data
コード例 #2
0
    def _parse_details(self, url):
        data = {}

        resp = self.session.get(url)
        html = parsers.html(resp.content, base_url=url)
        html.make_links_absolute()
        content = html.cssselect_first('.content_main')

        image = content.cssselect_first('.movie_image img')
        if image is not None:
            data['url_posters'] = [image.get('src')]

        for a in content.cssselect('a'):
            try:
                url = parsers.youtube_url(a.get('href'))
                data['url_trailer'] = url
                break
            except ValueError:
                pass

            if 'csfd.cz' in a.get('href'):
                data['url_csfd'] = a.get('href')

            if 'imdb.com' in a.get('href'):
                data['url_imdb'] = a.get('href')

        return data
コード例 #3
0
    def _parse_details(self, url):
        data = {}

        resp = self.session.get(url)
        html = parsers.html(resp.content, base_url=resp.url)
        content = html.cssselect_first('#content .leftcol')

        image = content.cssselect_first('img.wp-post-image')
        if image is not None:
            data['url_posters'] = [self._parse_image_link(image)]

        csfd_link = content.cssselect_first('a.csfd')
        if csfd_link is not None and csfd_link.get('href') != 'http://':
            data['url_csfd'] = csfd_link.get('href')

        imdb_link = content.cssselect_first('a.imdb')
        if imdb_link is not None and imdb_link.get('href') != 'http://':
            data['url_imdb'] = imdb_link.get('href')

        if 'trailer' in content.text_content().lower():
            for iframe in content.cssselect('iframe'):
                try:
                    url = parsers.youtube_url(iframe.get('src'))
                    data['url_trailer'] = url
                except ValueError:
                    pass

        return data
コード例 #4
0
ファイル: kino_scala.py プロジェクト: apophys/zitkino.cz
    def _parse_details(self, url):
        data = {}

        resp = self.session.get(url)
        html = parsers.html(resp.content, base_url=url)
        html.make_links_absolute()
        content = html.cssselect_first('.content_main')

        image = content.cssselect_first('.movie_image img')
        if image is not None:
            data['url_posters'] = [image.get('src')]

        for a in content.cssselect('a'):
            try:
                url = parsers.youtube_url(a.get('href'))
                data['url_trailer'] = url
                break
            except ValueError:
                pass

            if 'csfd.cz' in a.get('href'):
                data['url_csfd'] = a.get('href')

            if 'imdb.com' in a.get('href'):
                data['url_imdb'] = a.get('href')

        return data