Possibly a timeout
which will be set to, for example, 120 seconds will solve this. If the site detects that requests are made by a bot it can hang forever until throws an error.
The additional thing is you were using a very old user-agent. Have a look what's your new, current user-agent which you pass to request, and the website checks user-agent version and if it's old, it's most likely a bot that sends a request.
To collect the information you need, it is not reliable to use a product variable check that looks only for listings, because even on the last empty page where there are no more results, this selector will still be present, so the loop will be endless.
To get around this we need to use a selector that will disappear when no more listings are left, which is a .pagination_next
selector in this case. It disappears when there are no more listings present so this is the signal to exit the while loop.
Look at these screenshots for better understanding:

Check code in online IDE.
from bs4 import BeautifulSoup
import requests, lxml, json
# https://requests.readthedocs.io/en/latest/user/quickstart/#custom-headers
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36",
}
data = []
page_num = 1
search_term = 'gtx+1050ti'
while True:
page = requests.get(f'https://www.ebay.com/sch/i.html?_nkw={search_term}&_fcid=164&_sop=15&_pgn={page_num}', headers=headers, timeout=30)
soup = BeautifulSoup(page.text, 'lxml')
print(f"Extracting page: {page_num}")
print("-" * 10)
for products in soup.select(".s-item__info"):
title = products.select_one(".s-item__title span").text
price = products.select_one(".s-item__price").text
data.append({
"title" : title,
"price" : price
})
if soup.select_one(".pagination__next"):
page_num += 1
else:
break
print(json.dumps(data, indent=2, ensure_ascii=False))
Example output
Extracting page: 1
----------
[
{
"title": "FAN & SCREWS FOR EVGA GeForce GTX 1050 TI SC Gaming Graphics Card 04G-P4-6253-KR",
"price": "$15.00"
},
{
"title": "GTX1050TI Desktop Video Card Stable Output DDR5 High Performance Gaming Graphics",
"price": "$68.25"
},
{
"title": "GTX1050TI Graphics Card 4GB Low Noise Sturdy Reliable for Computer",
"price": "$69.04"
},
{
"title": "GTX1050TI Gaming Graphics Card Powerful Low Noise High Clarity Discrete Gaming",
"price": "$71.84"
},
{
"title": "GTX1050TI Gaming Graphics Card Powerful Low Noise High Clarity Discrete Gaming",
"price": "$71.84"
},
# ...
]