-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrq.py
More file actions
36 lines (28 loc) · 1.09 KB
/
rq.py
File metadata and controls
36 lines (28 loc) · 1.09 KB
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
import requests
import sys
from bs4 import BeautifulSoup
filename = sys.argv[1]
programs_file = open(filename)
programs = programs_file.readlines()
programs_file.close()
programs = [program.rstrip('\n') for program in programs]
should_remove = []
not_found = []
more_than_one_program = []
for program in programs:
result = requests.get("http://www.shouldiremoveit.com/programs.aspx?q=%s" % program)
soup = BeautifulSoup(result.content)
program_found = soup.find_all(name="span", class_="programbartxt_remove")
if program_found:
if len(program_found) > 1:
more_than_one_program.append(program)
else:
for found in program_found:
percentage = found.text.split("% remove")
if float(percentage) > 80:
should_remove.append(program)
else:
not_found.append(program)
print "you should remove: %s" % str(should_remove).strip("[]")
print "These programs were not found: %s" % str(not_found).strip("[]")
print "These names match with more than one program: %s" % str(more_than_one_program).strip("[]")