mirror of
https://github.com/netzbegruenung/social-spider.git
synced 2024-05-04 19:53:40 +02:00
add facebook like count scraper
This commit is contained in:
parent
3c12e67b97
commit
100d78040d
21
facebook.py
Normal file
21
facebook.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import requests
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def scrape(username):
|
||||
url = "https://www.facebook.com/" + username
|
||||
r = requests.get(url)
|
||||
|
||||
s = str(r.content)
|
||||
|
||||
pattern = "Gefällt ([\d\.]+) Mal"
|
||||
result = re.search(pattern, s)
|
||||
if result:
|
||||
return int(result[1].replace(".", ""))
|
||||
else:
|
||||
print("No data found", file=sys.stderr)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(scrape("GrueneStgt"))
|
Loading…
Reference in a new issue