当我尝试使用python程序打开Web页面时,缺少HTML页面的跨度类名称和div类信息。我曾尝试使用urllib.request.urlopen(),requests.get(),wget,robobrowser和其他一些软件包来保存带有类名数据的网页,但没有成功。
url = 'https://www.google.com/maps/dir/Navallur,+Tamil+Nadu+600130/Vijayawada,+Andhra+Pradesh/@14.6711659,78.0012123,7z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x3a525a51439fd9f3:0x5fdacd19ed90126c!2m2!1d80.225463!2d12.8447728!1m5!1m1!1s0x3a35eff9482d944b:0x939b7e84ab4a0265!2m2!1d80.6480153!2d16.5061743'
page = urllib.request.urlopen(url).read()
page1 = requests.get(url).content
html = open('some1.html','wb')
html.write(page)
html.close()
答案 0 :(得分:0)
Python中的硒包允许您执行Naga:-)
任务from selenium import webdriver
ff = webdriver.Firefox()
ff.get(URL)
html = ff.page_sources