'how to scrap phobos website using open url

I'm trying to scrap phobos website using bs4 and getting 418 teapot error Here is my code ....I am getting error when i am using build_opener.open


    from urllib.request import urlopen, Request, build_opener
from sockshandler import SocksiPyHandler
import socks
import pandas as pd
import urllib

from bs4 import BeautifulSoup
phobos = "http://phobosxilamwcg75xt22id7aywkzol6q6rfl2flipcqoc4e4ahima5id.onion/search?query=data"
def clear(toclear):
    str = toclear.replace("\n", " ")
    return (' '.join(str.split()))
#headers = {'User-Agent': 'M',}
req = build_opener(SocksiPyHandler(socks.SOCKS5, "127.0.0.1", 9050, True))
res = req.open(phobos).read()
soup = BeautifulSoup(res, 'lxml')
print(soup)
        
        
        
        
#main

HTTPError: HTTP Error 418: I'm a teapot

Actually, it is an onion site which you can access only with TOR Browser and not with normal browsers like chrome.

I want to scrap its results but it is giving me 418 teapot error

If you want to know any other information just comment here, I will try to answer it



Solution 1:[1]

As a tidbit / Internet curiosity, the error you got is

The HTTP 418 I'm a teapot client error response code indicates that the server refuses to brew coffee because it is, permanently, a teapot. A combined coffee/tea pot that is temporarily out of coffee should instead return 503. This error is a reference to Hyper Text Coffee Pot Control Protocol defined in April Fools' jokes in 1998 and 2014.

The bottom line is Some websites use this response for requests they do not wish to handle, such as automated queries.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 baduker