chetlo
chetlo

Reputation: 3

python callback syntax error in Scapy

I've got the following code which i'm trying to run. I'm getting a python invalid syntax error. I'm using Mac with python 2.7.10. Is there anything wrong? I'm relatively new to python

SyntaxError: invalid syntax callback='parse_item',

full code:

# -*- coding: utf-8 -*-
import scrapy

from scrapy.spiders import CrawlSpider
from scrapy.spiders import Rule
from scrapy.linkextractors import Linkextractors

class MpuDivsSpider(CrawlSpider):
    name = 'mpu_divs'
    allowed_domains = ['www.capitalfm.com']
    start_urls = ['http://www.capitalfm.com/']

#http://www.capitalfm.com/music-news/kylie-jenner-outcast-not-made-for-fame/
#http://www.capitalfm.com/artists/adele/news/grenfell-kids-cinema/
#http://www.capitalfm.com/music-news/week-photos/7-august-2017/justin-bieber/
#http://www.capitalfm.com/music-news/week-photos/7-august-2017/leigh-anne-pinnock/
    rules = [

        Rule(LinkExtractor(allow=[r'/7-august-2017/\w*'])
        callback='parse_item',
        follow = True)
    ]

    def parse_item(self, response):
        print response.url

Upvotes: 0

Views: 591

Answers (1)

Ali Momen Sani
Ali Momen Sani

Reputation: 842

You forgot a , at the end of line 19:

        Rule(LinkExtractor(allow=[r'/7-august-2017/\w*']),

Upvotes: 2

Related Questions