forked from rootmelo92118/sheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MySelf2.py
35 lines (23 loc) · 1016 Bytes
/
MySelf2.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
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from bs4 import BeautifulSoup as bs
from fake_useragent import UserAgent
class mySelf:
def __init__(self, processEngine):
self.processEngine = processEngine
def AS(self):
self.processEngine.get("https://bgp.he.net/")
page=bs(self.processEngine.page_source,"html.parser")
data = page.find("a", class_="boldlink").get("href").replace("/ip/","")
return data
class mainObject:
def __init__(self, path="./phantomjs"):
useragent = UserAgent()
useragent.update()
dcap = dict(DesiredCapabilities.PHANTOMJS)
dcap['phantomjs.page.settings.userAgent'] = useragent.random
self.processEngine = webdriver.PhantomJS(executable_path=path,desired_capabilities=dcap)
#self.myself = mySelf(processEngine)
def MySelf(self, object):
myself = mySelf(self.processEngine)
return myself