admin 管理员组文章数量: 1184232
2024年1月6日发(作者:dz论坛辅助模板)
inputElement[0].send_keys(url) # search url in search box searchButton[0].click() # click the corresponding button browser_res = _source# print(browser_res) soup = BeautifulSoup(browser_res,"") # ,from_encoding="utf-8") link_node = ('a',href=e(r"ipv4")) # print (link_,link_node['href'],link__text()) return link__text() if link_node != None else None # get the ip of the url
def github_hosts(self, get_type=0): """ get_type: the way we use to get ip, get_type=0:request(default) | get_type=1:selenium """ success_hosts = {} failure_hosts = {}
for url in : host_url = ().split('/')[-1] host_url = host_url if host_url != '' else '' try: # print(host) ip = _req(url) if get_type==0 else _sel(host_url)
print(ip, host_url) if ip == None: failure_hosts[host_url] = ip # sometimes different host has the same ip else: success_hosts[host_url] = ip
if get_type == 1:
(0.7) () except Exception as err: failure_hosts[host_url] = None print(err) print('------------------------------------------------') print('faiure_hosts:n', failure_hosts) print('------------------------------------------------') print('success_hosts:') for k, v in success_(): print(v, k) print('------------------------------------------------')
if __name__ == '__main__':
ip_obj = GetIP() ip__hosts(get_type=0)
版权声明:本文标题:Github修改hosts文件实现国内访问加速 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1704481827a461684.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论