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 |
#!/usr/bin/env python # coding=utf-8 from bs4 import BeautifulSoup import urllib2 import socket response=urllib2.urlopen('http://www.503error.com',timeout=10) html_data=response.read() print html_data soup=BeautifulSoup(html_data) print soup.prettify() print 'start to analayse---------------' #for tag in soup.find_all(rel="bookmark"): # print tag #print 'entry-title-----------------------' #for tag in soup.find_all(class_="entry-title"): # print tag title_soup=soup.find_all(class_='entry-title') #print 'firt-article----------------' #print title_soup[0] tag_a = title_soup[0].a.contents print '网站http://www.503error.com最新的文章为:',tag_a[0] |
Latest posts by Zhiming Zhang (see all)
- aws eks node 自动化扩展工具 Karpenter - 8月 10, 2022
- ReplicationController and ReplicaSet in Kubernetes - 12月 20, 2021
- public key fingerprint - 5月 27, 2021