mirror of https://github.com/scrapy/scrapy.git
Trim examples
This commit is contained in:
parent
5b7394f23b
commit
e0db7f1613
|
|
@ -16,7 +16,6 @@ Consider the following Scrapy spider below:
|
|||
|
||||
class MySpider(scrapy.Spider):
|
||||
name = "myspider"
|
||||
allowed_domains = ["example.com"]
|
||||
start_urls = (
|
||||
"http://example.com/page1",
|
||||
"http://example.com/page2",
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ instance, which can be accessed and used like this:
|
|||
|
||||
class MySpider(scrapy.Spider):
|
||||
name = "myspider"
|
||||
allowed_domains = ["scrapy.org"]
|
||||
start_urls = ["https://scrapy.org"]
|
||||
|
||||
def parse(self, response):
|
||||
|
|
@ -132,7 +131,6 @@ Python logger you want. For example:
|
|||
|
||||
class MySpider(scrapy.Spider):
|
||||
name = "myspider"
|
||||
allowed_domains = ["scrapy.org"]
|
||||
start_urls = ["https://scrapy.org"]
|
||||
|
||||
def parse(self, response):
|
||||
|
|
|
|||
|
|
@ -325,7 +325,6 @@ credentials:
|
|||
|
||||
class LoginSpider(scrapy.Spider):
|
||||
name = "example.com"
|
||||
allowed_domains = ["www.example.com"]
|
||||
start_urls = ["http://www.example.com/users/login.php"]
|
||||
|
||||
def parse(self, response):
|
||||
|
|
@ -567,7 +566,6 @@ the crawl:
|
|||
|
||||
class BookSpider(Spider):
|
||||
name = "books"
|
||||
allowed_domains = ["books.toscrape.com"]
|
||||
|
||||
async def start(self):
|
||||
yield Request("https://books.toscrape.com/", callback=self.parse_home)
|
||||
|
|
@ -785,7 +783,6 @@ errors if needed:
|
|||
|
||||
class ErrbackSpider(Spider):
|
||||
name = "errback_example"
|
||||
allowed_domains = ["www.httpbin.org", "example.invalid"]
|
||||
start_urls = [
|
||||
"http://www.httpbin.org/", # HTTP 200 expected
|
||||
"http://www.httpbin.org/status/404", # Not found error
|
||||
|
|
@ -1051,7 +1048,6 @@ signals will stop the download of a given response. See the following example:
|
|||
|
||||
class StopSpider(scrapy.Spider):
|
||||
name = "stop"
|
||||
allowed_domains = ["docs.scrapy.org"]
|
||||
start_urls = ["https://docs.scrapy.org/en/latest/"]
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -217,7 +217,6 @@ In a spider, settings are available through ``self.settings``:
|
|||
|
||||
class MySpider(scrapy.Spider):
|
||||
name = "myspider"
|
||||
allowed_domains = ["example.com"]
|
||||
start_urls = ["http://example.com"]
|
||||
|
||||
def parse(self, response):
|
||||
|
|
@ -2231,7 +2230,6 @@ In order to use the reactor installed by Scrapy:
|
|||
|
||||
class QuotesSpider(scrapy.Spider):
|
||||
name = "quotes"
|
||||
allowed_domains = ["quotes.toscrape.com"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.timeout = int(kwargs.pop("timeout", "60"))
|
||||
|
|
@ -2261,7 +2259,6 @@ which raises an exception, becomes:
|
|||
|
||||
class QuotesSpider(scrapy.Spider):
|
||||
name = "quotes"
|
||||
allowed_domains = ["quotes.toscrape.com"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.timeout = int(kwargs.pop("timeout", "60"))
|
||||
|
|
|
|||
|
|
@ -262,7 +262,6 @@ Here's an example of how you would call it from your spider:
|
|||
|
||||
class MySpider(scrapy.Spider):
|
||||
name = "myspider"
|
||||
allowed_domains = ["example.com", "example.org", "example.net"]
|
||||
start_urls = [
|
||||
"http://example.com",
|
||||
"http://example.org",
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ Here is a simple example showing how you can catch signals and perform some acti
|
|||
|
||||
class DmozSpider(Spider):
|
||||
name = "dmoz"
|
||||
allowed_domains = ["dmoz.org"]
|
||||
start_urls = [
|
||||
"http://www.dmoz.org/Computers/Programming/Languages/Python/Books/",
|
||||
"http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/",
|
||||
|
|
@ -68,7 +67,6 @@ Let's take an example using :ref:`coroutines <topics-coroutines>`:
|
|||
|
||||
class SignalSpider(scrapy.Spider):
|
||||
name = "signals"
|
||||
allowed_domains = ["quotes.toscrape.com"]
|
||||
start_urls = ["https://quotes.toscrape.com/page/1/"]
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
Loading…
Reference in New Issue