있다 웹 페이지에 추가 페이지가있을 때 스크래퍼를 작동시킬 수 있습니까?
from twill.commands import *
from bs4 import BeautifulSoup
from urllib import urlopen
import urllib2
with open('urls.txt') as inf:
urls = (line.strip() for line in inf)
for url in urls:
try:
urllib2.urlopen(url)
except urllib2.HTTPError, e:
print e
site = urlopen(url)
soup = BeautifulSoup(site)
for td in soup.find_all('td', {'class': 'subjectCell'}):
print td.find('a').text
& 페이지 = X 여기
i '를 해당 페이지는 m 소리 :
http://www.last.fm/user/TheBladeRunner_/library/tags?tag=long+track http://www.last.fm/user/TheBladeRunner_/library/tags?tag=long+track & 페이지 = 7
질문을 요청 무엇 분명하지 않다 :이 같은 수 있습니다. 네가하려고하는 것이 정확히 무엇인가? 구체적인 예를 들어 줄 수 있습니까? –
글쎄, 나는 포스트를 편집했다. 기본적으로 나는 그 주소가 가진 모든 다음 페이지를 얻으려고한다. – muchacho