Skip to content

Commit

Permalink
Merge branch 'TIM952597205-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris committed Apr 3, 2021
2 parents 70f383e + 3f9078a commit 25ab707
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion feapder/network/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import time
from urllib.parse import urlparse, urlunparse, urljoin

from bs4 import UnicodeDammit
from bs4 import UnicodeDammit, BeautifulSoup
from requests.cookies import RequestsCookieJar
from requests.models import Response as res
from w3lib.encoding import http_content_type_encoding, html_body_declared_encoding
Expand Down Expand Up @@ -275,6 +275,11 @@ def selector(self):
self._cached_selector = Selector(self.text)
return self._cached_selector

@property
def bs4(self):
soup = BeautifulSoup(self.text, "html.parser")
return soup

def extract(self):
return self.selector.get()

Expand Down
1 change: 1 addition & 0 deletions tests/air-spider/test_air_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def download_midware(self, request):
return request

def parse(self, request, response):
print(response.bs4.title)
print(response.xpath("//title").extract_first())


Expand Down

0 comments on commit 25ab707

Please sign in to comment.