-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumcheck.py
52 lines (31 loc) · 920 Bytes
/
numcheck.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from bs4 import BeautifulSoup as bs
import pandas as pd
pd.set_option('display.max_colwidth', 500)
import time
import requests
import random
import re
#list of numbers
test_numbers = [int(item) for item in input("Enter the phone numbers : ").split()]
t_numbers = [f'https://lookup.robokiller.com/search?q={i}' for i in test_numbers ]
# holders for name and data
names = []
data = []
#randomize request rate
rate = [i/10 for i in range(10)]
for tnum in t_numbers:
#access page
page = requests.get(tnum)
#get content
soup = bs(page.content)
#add name and data
names.extend([i.text for i in soup.find_all(class_='ts-label')])
data.extend([i.text for i in soup.find_all(class_='ts-data')])
#randomize request
time.sleep(random.choice(rate))
#create dataframe for scraped information
df = pd.DataFrame()
#store values in respective columns
df['Label'] = names
df['Value'] = data
df