Skip to content

Commit

Permalink
Configurable vk app id, update default. vanyasem#11
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui Balau committed Sep 26, 2023
1 parent 7af7fbf commit cceaf56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vk_scraper/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(self, **kwargs):
self.login_pass = None
self.login_user = None
self.offset = None
self.app_id = None

default_attr = dict(username='', usernames=[], filename=None,
login_user=None, login_pass=None,
Expand All @@ -58,7 +59,8 @@ def __init__(self, **kwargs):
latest=False,
media_types=['image'],
verbose=0,
offset=0
offset=0,
app_id=0
)

allowed_attr = list(default_attr.keys())
Expand All @@ -85,6 +87,7 @@ def login(self):
self.login_user, self.login_pass,
auth_handler=self.two_factor_handler,
captcha_handler=self.captcha_handler,
app_id=self.app_id,
api_version='5.101',
)

Expand Down Expand Up @@ -445,6 +448,7 @@ def main():
parser.add_argument('--latest', action='store_true', default=False, help='Scrape new media since the last scrape')
parser.add_argument('--verbose', '-v', type=int, default=0, help='Logging verbosity level')
parser.add_argument('--offset', '-o', type=int, default=0, help='Media offset')
parser.add_argument('--app-id', '-a', type=int, default=2685278, help='Use a specific VK app id on requests')

args = parser.parse_args()

Expand Down Expand Up @@ -474,3 +478,4 @@ def main():

if __name__ == '__main__':
main()

0 comments on commit cceaf56

Please sign in to comment.