How can I use Beautiful Soup in a Jupyter Notebook for web scraping? or Best practices for running Be

16 Replies, 1915 Views

lxml all the way, dude. html.parser is like using a bicycle when you could have a motorcycle.

Also, if your notebook’s crawling, check if the site’s throttling you. Some sites block rapid requests.

Pro tip: Use `headers` in your `requests.get()` to mimic a browser. Sometimes sites block bare requests.

```python
headers = {'User-Agent': 'Mozilla/5.0'}
response = requests.get(url, headers=headers)
```

Works like a charm in my beautiful soup jupyter notebook.

Messages In This Thread



Users browsing this thread: 1 Guest(s)