-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrapper.py
More file actions
72 lines (56 loc) · 1.24 KB
/
scrapper.py
File metadata and controls
72 lines (56 loc) · 1.24 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# modules
import requests
import itertools
import threading
import time
import sys
from tabulate import tabulate
import pyfiglet
from bs4 import BeautifulSoup
# banner
banner = pyfiglet.figlet_format("Web Scrapper X")
print(banner)
print("")
# owner
text = """
Made with 💖 by THB
"""
table = [[text]]
output = tabulate(table, tablefmt='grid')
print(output)
# web link
link = str(input("Enter your url to scrap : "))
# get link
got_it = requests.get(link)
document = BeautifulSoup(got_it.text, "html.parser")
html = str((document.prettify()))
print("")
# loading
print("Getting ready")
print("")
done = False
#here is the animation
def animate():
for c in itertools.cycle(['(', ')', '^', '\\']):
if done:
break
sys.stdout.write("\r getting information " + c)
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.write('\rDone! ')
t = threading.Thread(target=animate)
t.start()
#long process here
time.sleep(10)
done = True
print("")
print("")
print("Got information")
print("")
# file
file = open(input("Enter the name of your html file : "), "a")
file.write(html)
file.close()
# end
print("")
print("** THANK You for using **")