2014年12月31日水曜日

【MIYADAI.com】からリンクをパクる

同じネタで、リンクを抜き出しましたが、1階層で我慢しとけ。(後でやっから)

# -*- coding: utf-8 -*-
from urllib import urlopen
from bs4 import BeautifulSoup

f = 'http://www.miyadai.com/index.php?itemid=1061'
s = BeautifulSoup(urlopen(f))

print s.title.string
for h in s.findAll('a'):
 t = str(h.get('href'))
 if 'http:' in t :
  print(t)
 elif 'https:' in t :
  print(t)
 else:
  pass

# EOF #

まったまた、なんかズルをしましたが、年末は何かと忙しいので、許せ。

0 件のコメント:

コメントを投稿