Y를 긁어 내려고! 그룹과 나는 한 페이지에서 데이터를 얻을 수 있지만 그게 전부입니다. 나는 몇 가지 기본 규칙을 가지고 있지만 분명히 옳지 않다. 누구든지 이걸 이미 해결 했어?치료 야후 그룹 거미
class YgroupSpider(CrawlSpider):
name = "yahoo.com"
allowed_domains = ["launch.groups.yahoo.com"]
start_urls = [
"http://launch.groups.yahoo.com/group/random_public_ygroup/post"
]
rules = (
Rule(SgmlLinkExtractor(allow=('message','messages'), deny=('mygroups',))),
Rule(SgmlLinkExtractor(), callback='parse_item'),
)
def parse_item(self, response):
hxs = HtmlXPathSelector(response)
sites = hxs.select('/html')
item = Item()
for site in sites:
item = YgroupItem()
item['title'] = site.select('//title').extract()
item['pubDate'] = site.select('//abbr[@class="updated"]/text()').extract()
item['desc'] = site.select("//div[contains(concat(' ',normalize-space(@class),' '),' entry-content ')]/text()").extract()
return item
참 고맙습니다. 아마 내가 말했듯이, 나는 groupname/message/1, groupname/message/2 (/ post의 별칭이 필요하다.) id = averylongidstringthatcouldbeanythingthing not justamessage1or2 – linkingarts