I'm trying to fetch some numbers from a webpage using requests. The numbers available in there are in images. The script I've written so far can show the numbers as I've used PIL library but can't print them.
Numbers visible in there just above the submit button are like:
I've tried so far:
import io
import requests
from PIL import Image
from bs4 import BeautifulSoup
from urllib.parse import urljoin
base = 'http://horoscope.horoscopezen.com/'
url = 'http://horoscope.horoscopezen.com/archive2.asp?day=2&month=1&year=2022&sign=1#.Xy07M4oza1v'
def get_numbers(link):
r = requests.get(link)
soup = BeautifulSoup(r.text,"lxml")
image_links = [urljoin(base,td['src']) for td in soup.select("td > img[src^='secimage.asp?']")]
for image_link in image_links:
r = requests.get(image_link)
img = Image.open(io.BytesIO(r.content))
img.show()
break
if __name__ == '__main__':
get_numbers(url)
How can I fetch the numbers from that site?
