I'm trying to scrape firm names and their corresponding links from a web-page using requests module.
Although the content is heavily dynamic, I could notice that they are available within the braces next to window.props.
So, I thought to scoop out that portion and process it using json, but I see \u0022 characters around instead of quotes ". This is what I meant:
{\u0022firms\u0022: [{\u0022index\u0022: 1, \u0022slug\u0022: \u0022zjjz\u002Datelier\u0022, \u0022name\u0022:
I've tried with:
import re
import json
import requests
from bs4 import BeautifulSoup
link = 'https://architizer.com/firms/'
with requests.Session() as s:
s.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36'
r = s.get(link)
items = re.findall(r'window.props[^"]+(.*?);',r.text)[0].strip('"').replace('\u0022', '\'')
print(items)
How can I scrape the name and link of different firms traversing multiple pages from that web-page using requests?