clike.py 428 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import scrapy


class ClikeSpider(scrapy.Spider):
    name = 'clike'
    allowed_domains = ['csdn.net']
    like_url = 'https://blog.csdn.net/phoenix/web/v1/article/like'

    def start_requests(self):
        data = {
            "articleId": "120845464",
        }
        yield scrapy.FormRequest(url=self.like_url, formdata=data, meta={'cookiejar': 'firefox'})

    def parse(self, response):
        print(response.json())