mirror of
https://github.com/bellingcat/snscrape.git
synced 2026-06-12 20:38:29 +03:00
Merge pull request #410 from AccentuSoft/master
Fix Vkontakte-user module crash on users with millions of followers
This commit is contained in:
@@ -347,9 +347,15 @@ class VKontakteUserScraper(snscrape.base.Scraper):
|
|||||||
if websites:
|
if websites:
|
||||||
kwargs['websites'] = websites
|
kwargs['websites'] = websites
|
||||||
|
|
||||||
def parse_num(s):
|
def parse_num(s: str) -> typing.Tuple[int, int]:
|
||||||
if s.endswith('K'):
|
if s.endswith('K'):
|
||||||
return int(s[:-1]) * 1000, 1000
|
return int(s[:-1]) * 1000, 1000
|
||||||
|
elif s.endswith('M'):
|
||||||
|
baseNum = s[:-1]
|
||||||
|
precision = 1000000
|
||||||
|
if '.' in s:
|
||||||
|
precision //= (10 ** len(baseNum.split('.')[1]))
|
||||||
|
return int(float(baseNum) * 1000000), precision
|
||||||
else:
|
else:
|
||||||
return int(s.replace(',', '')), 1
|
return int(s.replace(',', '')), 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user