def fanboxGetPostsFromArtist(self, artist_id, next_url=""): ''' get all posts from the supported user from https://www.pixiv.net/ajax/fanbox/creator?userId=15521131 ''' if next_url is None or next_url == "": url = "https://www.pixiv.net/ajax/fanbox/creator?userId={0}".format( artist_id) elif next_url.startswith("https://"): url = next_url else: url = "https://www.pixiv.net" + next_url # Fix #494 PixivHelper.print_and_log('info', 'Getting posts from ' + url) referer = "https://www.pixiv.net/fanbox/creator/{0}".format(artist_id) req = mechanize.Request(url) req.add_header('Accept', 'application/json, text/plain, */*') req.add_header('Referer', referer) req.add_header('Origin', 'https://www.pixiv.net') req.add_header('User-Agent', self._config.useragent) response = self.open_with_retry(req).read() # Issue #420 _tzInfo = None if self._config.useLocalTimezone: _tzInfo = PixivHelper.LocalUTCOffsetTimezone() result = FanboxArtist(artist_id, response, tzInfo=_tzInfo) pixivArtist = PixivArtist(artist_id) self.getMemberInfoWhitecube(artist_id, pixivArtist) result.artistName = pixivArtist.artistName result.artistToken = pixivArtist.artistToken return result
def fanboxGetPostsFromArtist(self, artist_id, next_url=""): ''' get all posts from the supported user from https://www.pixiv.net/ajax/fanbox/creator?userId=15521131 ''' if next_url is None or next_url == "": url = "https://www.pixiv.net/ajax/fanbox/creator?userId={0}".format( artist_id) elif next_url.startswith("https://"): url = next_url else: url = "https://www.pixiv.net" + next_url # Fix #494 PixivHelper.print_and_log('info', 'Getting posts from ' + url) referer = "https://www.pixiv.net/fanbox/creator/{0}".format(artist_id) req = mechanize.Request(url) req.add_header('Accept', 'application/json, text/plain, */*') req.add_header('Referer', referer) req.add_header('Origin', 'https://www.pixiv.net') req.add_header('User-Agent', self._config.useragent) res = self.open_with_retry(req) response = res.read() PixivHelper.get_logger().debug(response.decode('utf8')) res.close() # Issue #420 _tzInfo = None if self._config.useLocalTimezone: _tzInfo = PixivHelper.LocalUTCOffsetTimezone() result = FanboxArtist(artist_id, response, tzInfo=_tzInfo) pixivArtist = PixivArtist(artist_id) self.getMemberInfoWhitecube(artist_id, pixivArtist) result.artistName = pixivArtist.artistName result.artistToken = pixivArtist.artistToken for post in result.posts: # https://fanbox.pixiv.net/api/post.info?postId=279561 # https://www.pixiv.net/fanbox/creator/104409/post/279561 p_url = "https://fanbox.pixiv.net/api/post.info?postId={0}".format( post.imageId) p_referer = "https://www.pixiv.net/fanbox/creator/{0}/post/{1}".format( artist_id, post.imageId) PixivHelper.get_logger().debug('Getting post detail from %s', p_url) p_req = mechanize.Request(p_url) p_req.add_header('Accept', 'application/json, text/plain, */*') p_req.add_header('Referer', p_referer) p_req.add_header('Origin', 'https://www.pixiv.net') p_req.add_header('User-Agent', self._config.useragent) p_res = self.open_with_retry(p_req) p_response = p_res.read() PixivHelper.get_logger().debug(p_response.decode('utf8')) p_res.close() js = demjson.decode(p_response) post.parsePost(js["body"]) return result
def fanboxGetPostsFromArtist(self, artist_id, next_url=""): ''' get all posts from the supported user from https://www.pixiv.net/ajax/fanbox/creator?userId=15521131 ''' if next_url is None or next_url == "": url = "https://www.pixiv.net/ajax/fanbox/creator?userId={0}".format(artist_id) else: url = "https://www.pixiv.net" + next_url PixivHelper.print_and_log('info', 'Getting posts from ' + url) response = self.open(url).read() result = FanboxArtist(artist_id, response) pixivArtist = PixivModelWhiteCube.PixivArtist(artist_id) self.getMemberInfoWhitecube(artist_id, pixivArtist) result.artistName = pixivArtist.artistName result.artistToken = pixivArtist.artistToken return result
def fanboxGetPostsFromArtist(self, artist_id, next_url=""): ''' get all posts from the supported user from https://www.pixiv.net/ajax/fanbox/creator?userId=15521131 ''' if next_url is None or next_url == "": url = "https://www.pixiv.net/ajax/fanbox/creator?userId={0}".format( artist_id) else: url = "https://www.pixiv.net" + next_url PixivHelper.print_and_log('info', 'Getting posts from ' + url) response = self.open(url).read() result = FanboxArtist(artist_id, response) pixivArtist = PixivModelWhiteCube.PixivArtist(artist_id) self.getMemberInfoWhitecube(artist_id, pixivArtist) result.artistName = pixivArtist.artistName result.artistToken = pixivArtist.artistToken return result
def fanboxGetPostsFromArtist(self, artist_id, next_url=""): ''' get all posts from the supported user from https://www.pixiv.net/ajax/fanbox/creator?userId=15521131 ''' if next_url is None or next_url == "": url = "https://www.pixiv.net/ajax/fanbox/creator?userId={0}".format(artist_id) else: url = "https://www.pixiv.net" + next_url PixivHelper.print_and_log('info', 'Getting posts from ' + url) response = self.open_with_retry(url).read() # Issue #420 _tzInfo = None if self._config.useLocalTimezone: _tzInfo = PixivHelper.LocalUTCOffsetTimezone() result = FanboxArtist(artist_id, response, tzInfo=_tzInfo) pixivArtist = PixivModelWhiteCube.PixivArtist(artist_id) self.getMemberInfoWhitecube(artist_id, pixivArtist) result.artistName = pixivArtist.artistName result.artistToken = pixivArtist.artistToken return result