Skip to content

Commit

Permalink
update version and lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Nandaka committed Feb 21, 2021
1 parent 6475f63 commit 83cb509
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion PixivConstant.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

PIXIVUTIL_VERSION = '20210215-beta1'
PIXIVUTIL_VERSION = '20210221-beta2'
PIXIVUTIL_LINK = 'https://github.com/Nandaka/PixivUtil2/releases'
PIXIVUTIL_DONATE = 'https://bit.ly/PixivUtilDonation'

Expand Down
9 changes: 5 additions & 4 deletions PixivOAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# monkey patch cloudscraper.User_Agent.loadUserAgent function
# this is to allow to bundle browser.json in the package
# based on cloudscraper==1.2.48
# based on cloudscraper==1.2.56
def loadUserAgent(self, *args, **kwargs):
self.browser = kwargs.pop('browser', None)

Expand All @@ -46,6 +46,7 @@ def loadUserAgent(self, *args, **kwargs):
# resolve browser.json path if frozen
default_browser_json = os.path.dirname(sys.executable) + os.sep + 'browsers.json'
PixivHelper.get_logger().debug(f"browser.json location = {default_browser_json}")
# end changes

with open(default_browser_json, 'r') as fp:
user_agents = json.load(
Expand All @@ -69,14 +70,14 @@ def loadUserAgent(self, *args, **kwargs):
else:
if self.browser and self.browser not in self.browsers:
sys.tracebacklimit = 0
raise RuntimeError('Sorry "{}" browser is not valid, valid browsers are [{}].'.format(self.browser, ', '.join(self.browsers)))
raise RuntimeError(f'Sorry "{self.browser}" browser is not valid, valid browsers are [{", ".join(self.browsers)}].')

if not self.platform:
self.platform = random.SystemRandom().choice(self.platforms)

if self.platform not in self.platforms:
sys.tracebacklimit = 0
raise RuntimeError('Sorry the platform "{}" is not valid, valid platforms are [{}]'.format(self.platform, ', '.join(self.platforms)))
raise RuntimeError(f'Sorry the platform "{self.platform}" is not valid, valid platforms are [{", ".join(self.platforms)}]')

filteredAgents = self.filterAgents(user_agents['user_agents'])

Expand All @@ -87,7 +88,7 @@ def loadUserAgent(self, *args, **kwargs):

if not filteredAgents[self.browser]:
sys.tracebacklimit = 0
raise RuntimeError('Sorry "{}" browser was not found with a platform of "{}".'.format(self.browser, self.platform))
raise RuntimeError(f'Sorry "{self.browser}" browser was not found with a platform of "{self.platform}".')

self.cipherSuite = user_agents['cipherSuite'][self.browser]
self.headers = user_agents['headers'][self.browser]
Expand Down
5 changes: 3 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
20210215-beta1
- Start implement #706: add novel support.
20210221-beta2
- Implement #706: add novel support.
- Merge Update PixivDBManager.py (#910) by amatuerCoder.
- Merge Update PixivBrowserFactory.py (#908) by amatuerCoder.
- Merge Fix #889 #899 (#903) by amatuerCoder.
- Update test script for PixivBrowserFactory.

20210128
- Fix Issue #878: update search by tag parser to handle missing 'isAdContainer'.
Expand Down

0 comments on commit 83cb509

Please sign in to comment.