爬取广西壮族自治区博物馆
import requests
# from bs4 import BeautifulSoup
import urllib
from lxml import etree
import time
import re
url = 'http://www.gxmuseum.cn/plus/guestbook.php?gotopagerank=&totalresult=188&pageno='
def get_info(url, data=None):
headers = {"User_Agent": "Mozilla/5.0(compatible; MSIE 5.5; Windows 10)"}
data =requests.get(url,headers).text
#print(data)
content = etree.HTML(data)
titles = content.xpath('//*[@class="timetd"]/strong/text()')
questions = content.xpath('///*[@class="msgtd"]/div/text()')
replys = content.xpath('///*[@class="msgtd"]//span/text()')
times = content.xpath('///*[@class="timetd"]/text()')
primary_class = '广西壮族自治区博物馆'
times = times[1:2]
#time = re.findall('\d+', times)
print(times)