token functionality

This commit is contained in:
msramalho
2022-06-21 14:23:54 +02:00
parent 90b72b6d22
commit 80b43f7c95
6 changed files with 24 additions and 35 deletions

View File

@@ -29,6 +29,14 @@ def get_argument_parser():
required=True,
help="password for the valid vk.com account",
)
parser.add_argument(
"-t",
"--token",
action="store",
dest="token",
required=False,
help="optional token, when passed authentication will not be performed - good to avoid captcha issues",
)
parser.add_argument(
"-d",
"--download",
@@ -50,7 +58,7 @@ def get_argument_parser():
def main():
parser = get_argument_parser()
args = parser.parse_args()
vks = VkScraper(args.username, args.password)
vks = VkScraper(args.username, args.password, args.token)
text = " ".join(args.urls)
res = vks.scrape(text)
res_json = json.dumps(res, ensure_ascii=False, indent=4, cls=DateTimeEncoder)