<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Scrapy%3AHello_World</id>
	<title>Scrapy:Hello World - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Scrapy%3AHello_World"/>
	<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Scrapy:Hello_World&amp;action=history"/>
	<updated>2026-06-02T21:11:55Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Scrapy:Hello_World&amp;diff=2035&amp;oldid=prev</id>
		<title>imported&gt;Soleverlee：​/* 运行 */</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Scrapy:Hello_World&amp;diff=2035&amp;oldid=prev"/>
		<updated>2017-01-11T06:39:54Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;运行&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2017年1月11日 (三) 06:39的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l42&quot;&gt;第42行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第42行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;cd riguz&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;cd riguz&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;scrapy crawl helloworld&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;scrapy crawl helloworld &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-s LOG_FILE=scrapy.log  &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;运行结果为两个下载的页面:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;运行结果为两个下载的页面:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Soleverlee</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Scrapy:Hello_World&amp;diff=2034&amp;oldid=prev</id>
		<title>imported&gt;Soleverlee：​以“=创建项目= &lt;source lang=&quot;bash&quot;&gt; scrapy startproject riguz &lt;/source&gt; 生成的项目如下： &lt;pre&gt; E:. │  scrapy.cfg │ └─riguz     │  items.py     │...”为内容创建页面</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Scrapy:Hello_World&amp;diff=2034&amp;oldid=prev"/>
		<updated>2017-01-10T09:40:07Z</updated>

		<summary type="html">&lt;p&gt;以“=创建项目= &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt; scrapy startproject riguz &amp;lt;/source&amp;gt; 生成的项目如下： &amp;lt;pre&amp;gt; E:. │  scrapy.cfg │ └─riguz     │  items.py     │...”为内容创建页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=创建项目=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
scrapy startproject riguz&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
生成的项目如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
E:.&lt;br /&gt;
│  scrapy.cfg&lt;br /&gt;
│&lt;br /&gt;
└─riguz&lt;br /&gt;
    │  items.py&lt;br /&gt;
    │  middlewares.py&lt;br /&gt;
    │  pipelines.py&lt;br /&gt;
    │  settings.py&lt;br /&gt;
    │  __init__.py&lt;br /&gt;
    │&lt;br /&gt;
    └─spiders&lt;br /&gt;
            __init__.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=创建爬虫=&lt;br /&gt;
在spiders文件夹下面新建一个文件，例如hello_spider.py:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import scrapy&lt;br /&gt;
class QuotesSpider(scrapy.Spider):&lt;br /&gt;
    name = &amp;quot;helloworld&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    def start_requests(self):&lt;br /&gt;
        urls = [&lt;br /&gt;
            &amp;#039;https://quotes.toscrape.com/page/1/&amp;#039;,&lt;br /&gt;
            &amp;#039;http://quotes.toscrape.com/page/2/&amp;#039;,&lt;br /&gt;
        ]&lt;br /&gt;
        for url in urls:&lt;br /&gt;
            yield scrapy.Request(url=url, callback=self.parse)&lt;br /&gt;
    def parse(self, response):&lt;br /&gt;
        page = response.url.split(&amp;quot;/&amp;quot;)[-2]&lt;br /&gt;
        filename = &amp;#039;quotes-%s.html&amp;#039; % page&lt;br /&gt;
        with open(filename, &amp;#039;wb&amp;#039;) as f:&lt;br /&gt;
            f.write(response.body)&lt;br /&gt;
        self.log(&amp;#039;Saved file %s&amp;#039; % filename)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
=运行=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd riguz&lt;br /&gt;
scrapy crawl helloworld&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
运行结果为两个下载的页面:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
│  quotes-1.html&lt;br /&gt;
│  quotes-2.html&lt;br /&gt;
│  scrapy.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[Category:Programe]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programe]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Soleverlee</name></author>
	</entry>
</feed>