Skip to content

Commit

Permalink
Change useragent to something that doesn't get blocked (#1332)
Browse files Browse the repository at this point in the history
* Change useragent to something that doesn't get blocked 

Looks like #1239 is still the case, with pixiv now blocking the current user agent, too. Switching it to the recommended value from 1239, however, works.

* Remove "dead" code

This also removes the code that got commented off in #1239, because either it's no longer need (so it doesn't need to be in the code at all) or it may be needed "sometimes" in which case it should probably live uncommented inside an `if` block.

* Link to the relevant README.md section

Added a link so people can easily get the information they need to fix the problem.

* (missing newline)
  • Loading branch information
Pomax authored Aug 1, 2024
1 parent 13fe016 commit 92e7275
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions PixivConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ class PixivConfig():
__items = [
ConfigItem("Network", "useProxy", False),
ConfigItem("Network", "proxyAddress", ""),
ConfigItem("Network", "useragent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0"),
ConfigItem("Network", "useragent", "Mozilla/5.0"),
ConfigItem("Network", "useRobots", True),
ConfigItem("Network", "timeout", 60),
ConfigItem("Network", "retry", 3),
Expand Down
12 changes: 4 additions & 8 deletions PixivUtil2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1724,15 +1724,11 @@ def main():
Fore.CYAN + Style.BRIGHT + "https://github.com/Nandaka/PixivUtil2?tab=readme-ov-file#a-usage" + Style.RESET_ALL)

username = __config__.username
# if username == '':
# username = input('Username ? ').rstrip("\r")
# else:
# msg = f'Using Username: {username}'
# PixivHelper.print_and_log('info', msg)

password = __config__.password
# if password == '':
# password = getpass.getpass('Password ? ')
if not username or not password:
print(Fore.RED + Style.BRIGHT + "No username and/or password found in config.ini" + Style.RESET_ALL)
print(Fore.YELLOW + Style.BRIGHT + "See " + Style.RESET_ALL + Fore.CYAN + Style.BRIGHT +
"https://github.com/Nandaka/PixivUtil2?tab=readme-ov-file#authentication" + Style.RESET_ALL)

if np_is_valid and options.number_of_pages != 0: # Yavos: overwrite config-data
PixivHelper.print_and_log("info", f'Limit up to: {options.number_of_pages} page(s). (set via commandline)')
Expand Down

0 comments on commit 92e7275

Please sign in to comment.