-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththread.py
More file actions
19 lines (17 loc) · 729 Bytes
/
thread.py
File metadata and controls
19 lines (17 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import threading
from requests_html import HTML, HTMLSession
class thread(threading.Thread):
def __init__(self, thread_name, thread_ID):
threading.Thread.__init__(self)
self.thread_name = thread_name
self.thread_ID = thread_ID
def run(self, pageName):
session = HTMLSession()
print(str(self.thread_name) + " " + str(self.thread_ID) + " is running.")
threadURL = f"https://en.wikipedia.org/wiki/Wikipedia:Contents/{pageName}"
thread = session.get(threadURL)
threadOverview = thread.html.find("h2")
if threadOverview:
print("Items on page:")
for overview in threadOverview:
print("-", overview.text)