Open scrapy output in browser tab or ipython window

To open the response object in a specific browser

import webbrowser
from scrapy.utils.response import open_in_browser

open_in_browser(response, _openfunc=webbrowser.get('/path/to/browser/exe').open)

Yes, there is an open_in_browser() built into Scrapy utility function:

from scrapy.utils.response import open_in_browser

open_in_browser(response)

You can use Open in browser
Example from the documentation:

from scrapy.utils.response import open_in_browser

def parse_details(self, response):
    if "item name" not in response.body:
        open_in_browser(response)

For your problem it will be like:

from scrapy.utils.response import open_in_browser
open_in_browser(response)

Also, we can see a web page use scrapy shell.
For example:

scrapy shell https://stackoverflow.com/questions/37465387/open-scrapy-output-in-browser-tab-or-ipython-window

and then view the response in a browser

view(response)

Tags:

Python

Scrapy