Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
azizkpln
GitHub Repository: azizkpln/moriarty-project
Path: blob/master/Investigation/getComments2.py
193 views
1
import requests
2
from bs4 import BeautifulSoup
3
def printAll():
4
return comment
5
def _getComments2_(phone_number):
6
global comment
7
comment=[]
8
headers = {
9
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0",
10
}
11
phone_number=phone_number.split("+")[1]
12
reqToServer = requests.get(f"https://spamcalls.net/en/number/{phone_number}", headers=headers)
13
source = BeautifulSoup(reqToServer.content,"lxml")
14
comment_=source.select(f'p[lang="en"]')
15
for i in comment_:
16
comment.append(i.text)
17
if comment==[]:
18
comment.append("No comment for this number")
19
print(comment_)
20