示例#1
0
def test_selector():
    request = Request("https://www.baidu.com?a=1&b=2", data={}, params=None)
    response = request.get_response()
    print(response)

    print(response.xpath("//a/@href"))
    print(response.css("a::attr(href)"))
    print(response.css("a::attr(href)").extract_first())

    content = response.re("<a.*?href='(.*?)'")
    print(content)
示例#2
0
# -*- coding: utf-8 -*-
"""
Created on 2021/3/4 11:26 下午
---------
@summary:
---------
@author: Boris
@email: [email protected]
"""

from feapder import Request

request = Request("https://www.baidu.com", data={}, params=None)
response = request.get_response()
print(response)

print(response.xpath("//a/@href"))
print(response.css("a::attr(href)"))
print(response.css("a::attr(href)").extract_first())

content = response.re("<a.*?href='(.*?)'")
print(content)
示例#3
0
def debug_spider_test():
    # debug爬虫
    spider = test_spider.TestSpider.to_DebugSpider(
        redis_key="feapder:test_spider",
        request=Request("http://www.baidu.com"))
    spider.start()
示例#4
0
def request(**kwargs):
    kwargs.setdefault("proxies", None)
    response = Request(**kwargs).get_response()
    print(response)

    IPython.embed(header="now you can use response")
示例#5
0
# -*- coding: utf-8 -*-
"""
Created on 2021/3/4 11:26 下午
---------
@summary:
---------
@author: Boris
@email: [email protected]
"""

from feapder import Request

request = Request("https://www.baidu.com?a=1&b=2", data={}, params=None)
print(request.fingerprint)
request = Request("https://www.baidu.com?b=2&a=1", data={}, params=None)
print(request.fingerprint)

response = request.get_response()
print(response)

print(response.xpath("//a/@href"))
print(response.css("a::attr(href)"))
print(response.css("a::attr(href)").extract_first())

content = response.re("<a.*?href='(.*?)'")
print(content)