Пример #1
0
    def ParseMangaImagesNew(self, page, _br):
        urls = []
        mangaSection = page.find("section", attrs={'class': 'manga'})
        links = mangaSection.findAll('a')
        # pattern /member_illust.php?mode=manga_big&illust_id=46279245&page=0
        if _br is None:
            import PixivBrowserFactory
            _br = PixivBrowserFactory.getExistingBrowser()

        total = page.find("span", attrs={'class': 'total'})
        if total is not None:
            self.imageCount = int(total.string)

        for currPage in range(0, self.imageCount):
            expected_url = '/member_illust.php?mode=manga_big&illust_id=' + str(self.imageId) + '&page=' + str(currPage)
            try:
                href = _br.fixUrl(expected_url)
                print "Fetching big image page:", href
                bigPage = _br.getPixivPage(url=href,
                                           referer="http://www.pixiv.net/member_illust.php?mode=manga&illust_id=" + str(
                                               self.imageId))

                bigImg = bigPage.find('img')
                imgUrl = bigImg["src"]
                # http://i2.pixiv.net/img-original/img/2013/12/27/01/51/37/40538869_p7.jpg
                print "Found: ", imgUrl
                urls.append(imgUrl)
                bigImg.decompose()
                bigPage.decompose()
                del bigImg
                del bigPage
            except Exception as ex:
                print ex

        return urls
Пример #2
0
    def ParseMangaImagesNew(self, page):
        urls = []
        mangaSection = page.find("section", attrs={'class':'manga'})
        links = mangaSection.findAll('a')
        ## /member_illust.php?mode=manga_big&illust_id=46279245&page=0
        import PixivBrowserFactory
        _br = PixivBrowserFactory.getExistingBrowser()

        for link in links:
            try:
                href = _br.fixUrl(link["href"])
                print "Fetching big image page:", href
                bigPage = _br.getPixivPage(url=href, referer = "http://www.pixiv.net/member_illust.php?mode=manga&illust_id=" + str(self.imageId))

                bigImg = bigPage.find('img')
                imgUrl = bigImg["src"]
                print "Found: ", imgUrl
                urls.append(imgUrl)
                bigImg.decompose()
                bigPage.decompose()
                del bigImg
                del bigPage
            except Exception as ex:
                print ex

        total = page.find("span", attrs={'class':'total'})
        if total is not None:
            self.imageCount = int(total.string)
            if self.imageCount != len(urls):
                raise PixivException("Different images count: " + str(self.imageCount) + " != " + str(len(urls)))

        return urls
Пример #3
0
    def ParseMangaImagesNew(self, page, _br):
        urls = []
        mangaSection = page.find("section", attrs={'class':'manga'})
        links = mangaSection.findAll('a')
        ## /member_illust.php?mode=manga_big&illust_id=46279245&page=0
        if _br is None:
            import PixivBrowserFactory
            _br = PixivBrowserFactory.getExistingBrowser()

        for link in links:
            try:
                href = _br.fixUrl(link["href"])
                print "Fetching big image page:", href
                bigPage = _br.getPixivPage(url=href, referer = "http://www.pixiv.net/member_illust.php?mode=manga&illust_id=" + str(self.imageId))

                bigImg = bigPage.find('img')
                imgUrl = bigImg["src"]
                print "Found: ", imgUrl
                urls.append(imgUrl)
                bigImg.decompose()
                bigPage.decompose()
                del bigImg
                del bigPage
            except Exception as ex:
                print ex

        total = page.find("span", attrs={'class':'total'})
        if total is not None:
            self.imageCount = int(total.string)
            if self.imageCount != len(urls):
                raise PixivException("Different images count: " + str(self.imageCount) + " != " + str(len(urls)))

        return urls
Пример #4
0
    def ParseMangaImagesNew(self, page, _br):
        urls = []
        # mangaSection = page.find("section", attrs={'class': 'manga'})
        # links = mangaSection.findAll('a')
        # pattern /member_illust.php?mode=manga_big&illust_id=46279245&page=0
        if _br is None:
            import PixivBrowserFactory
            _br = PixivBrowserFactory.getExistingBrowser()

        total = page.find("span", attrs={'class': 'total'})
        if total is not None:
            self.imageCount = int(total.string)

        for currPage in range(0, self.imageCount):
            expected_url = '/member_illust.php?mode=manga_big&illust_id=' + str(self.imageId) + '&page=' + str(currPage)
            try:
                href = _br.fixUrl(expected_url)
                print "Fetching big image page:", href
                bigPage = _br.getPixivPage(url=href,
                                           referer="http://www.pixiv.net/member_illust.php?mode=manga&illust_id=" + str(
                                               self.imageId))

                bigImg = bigPage.find('img')
                imgUrl = bigImg["src"]
                # http://i2.pixiv.net/img-original/img/2013/12/27/01/51/37/40538869_p7.jpg
                print "Found: ", imgUrl
                urls.append(imgUrl)
                bigImg.decompose()
                bigPage.decompose()
                del bigImg
                del bigPage
            except Exception as ex:
                print ex

        return urls
Пример #5
0
    def ParseBigImages(self, page, _br):
        self.imageCount = 1

        # Issue #224
        # work manga
        temp = page.find('a', attrs={'class': ' _work manga '})
        if temp is not None:
            if _br is None:
                import PixivBrowserFactory
                _br = PixivBrowserFactory.getExistingBrowser()

            expected_url = '/member_illust.php?mode=big&illust_id=' + str(self.imageId)
            try:
                href = _br.fixUrl(expected_url)
                print "Fetching big image page:", href
                bigPage = _br.getPixivPage(url=href,
                                           referer="https://www.pixiv.net/member_illust.php?mode=medium&illust_id=" + str(self.imageId))
                bigImg = bigPage.find('img')
                imgUrl = bigImg["src"]
                # http://i2.pixiv.net/img-original/img/2013/12/27/01/51/37/40538869_p7.jpg
                print "Found: ", imgUrl
                bigImg.decompose()
                bigPage.decompose()
                del bigImg
                del bigPage
                return imgUrl
            except Exception as ex:
                print ex

        # new layout for big 20141216
        temp = page.find('img', attrs={'class': 'original-image'})
        if temp is not None:
            return str(temp['data-src'])

        # new layout for big 20141212
        temp = page.find('img', attrs={'class': 'big'})
        if temp is not None:
            return str(temp['data-src'])

        # old layout
        temp = page.find('img')['src']
        return str(temp)
Пример #6
0
    def ParseBigImages(self, page, _br):
        self.imageCount = 1

        # Issue #224
        # work manga
        temp = page.find('a', attrs={'class': ' _work manga '})
        if temp is not None:
            if _br is None:
                import PixivBrowserFactory
                _br = PixivBrowserFactory.getExistingBrowser()

            expected_url = '/member_illust.php?mode=big&illust_id=' + str(self.imageId)
            try:
                href = _br.fixUrl(expected_url)
                print "Fetching big image page:", href
                bigPage = _br.getPixivPage(url=href,
                                           referer="https://www.pixiv.net/member_illust.php?mode=medium&illust_id=" + str(self.imageId))
                bigImg = bigPage.find('img')
                imgUrl = bigImg["src"]
                # http://i2.pixiv.net/img-original/img/2013/12/27/01/51/37/40538869_p7.jpg
                print "Found: ", imgUrl
                bigImg.decompose()
                bigPage.decompose()
                del bigImg
                del bigPage
                return imgUrl
            except Exception as ex:
                print ex

        # new layout for big 20141216
        temp = page.find('img', attrs={'class': 'original-image'})
        if temp is not None:
            return str(temp['data-src'])

        # new layout for big 20141212
        temp = page.find('img', attrs={'class': 'big'})
        if temp is not None:
            return str(temp['data-src'])

        # old layout
        temp = page.find('img')['src']
        return str(temp)