2015-01-10 3 views
0

나는 Scrapy 예제를 살펴 보았지만 의미가 있지만, 뉴스 피드에서 시도하자마자 제목뿐 아니라 진행 방법도 모른다.뉴스 피드를 긁는 방법?

scrapy shell http://feeds.bbci.co.uk/news/rss.xml 

나는이에서 얻을 수있는 모든

<Selector xpath='//title' data=u'<title xmlns:media="http://search.yahoo.'>] 

이 어떻게 가능한 내부의 태그를 찾을 수 있습니다 출력

response.xpath('//title') 

입니까?

response.xpath('//div') 

는 null를 돌려 :

나는이 때. Chome으로부터 컨텐츠를 검사하기 위해 Inspect 요소를 시도했지만, 어떤 식 으로든 시체를 테스트 해 볼 수는 없습니다. 감사합니다

+0

찾을 수 있습니까? –

답변

2

rss은 문서가 아니므로 xml 문서입니다. rss에 대한 정보는 http://www.w3schools.com/xml/xml_rss.asp입니다. 그래서에는 div 태그가없는

<?xml version="1.0" encoding="UTF-8" ?> 
<rss version="2.0"> 

<channel> 
    <title>W3Schools Home Page</title> 
    <link>http://www.w3schools.com</link> 
    <description>Free web building tutorials</description> 
    <item> 
    <title>RSS Tutorial</title> 
    <link>http://www.w3schools.com/rss</link> 
    <description>New RSS tutorial on W3Schools</description> 
    </item> 
    <item> 
    <title>XML Tutorial</title> 
    <link>http://www.w3schools.com/xml</link> 
    <description>New XML tutorial on W3Schools</description> 
    </item> 
</channel> 

</rss> 

: rss 문서 같은 모양. 각 게시물/뉴스의 설명이 response.xpath('//description/text()')

Scrapy 워드 프로세서를 사용할 수 얻으려면 당신은 "태그"로 무엇을 의미합니까 여기 http://doc.scrapy.org/en/latest/intro/tutorial.html

관련 문제