我想从网站抓取一些内容www.gyte.edu.tr网站语言是土耳其语,但当你点击一个语言选择按钮在网站上的地址www.gyte.edu.tr?cl=2它变成了英语。我想让我的代码访问http://www.gyte.edu.tr/kategori/54/9/laboratories.aspx?地址和抓取所有实验室的链接,然后访问所有实验室页面,从这些页面获取信息。我的代码如下,它获取的信息土耳其语,但不是英语。在
import urllib
from bs4 import BeautifulSoup
urllib.urlopen("http://www.gyte.edu.tr?cl=2")
linkler = urllib.urlopen("http://www.gyte.edu.tr?cl=2/kategori/54/9/laboratories.aspx")
site = linkler.read()
linkler.close()
link_list = []
soup1 = BeautifulSoup(site)
a_text = soup1.find("div","block news-area")
for link in a_text.find_all('a'):
link_list.append(link.get('href'))
for l in link_list:
s = urllib.urlopen(l)
s1 = s.read()
s.close()
soup3 = BeautifulSoup(s1)
soup3 = soup3.table
soup3 = str(soup3)
f = open("table.html", 'a')
# write the data
for data in soup3:
f.write(data)
那么我怎样才能抓住英语的内容呢?在
他们设置了一个cookie,所以语言选择在整个会话中持续存在。在
更多关于请求。会话()
^{pr2}$相关问题 更多 >
编程相关推荐