I found out you can't use javascript in beautifulsoup. I have this code:
from bs4 import BeautifulSoup
import requests
import warnings
import time
warnings.filterwarnings("ignore", category=UserWarning, module='bs4')
url = ["https://google.com"]
# add header
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'}
for item in url:
r = requests.get(item, headers=headers)
print(r.text)
time.sleep(2)
I tried running this but I got an error to enable javascript in my browser. My question is if there is any way to scrape links which use javascript in python (with or without beautifulsoup, with preferred)?
PS: My javascript code:
<script src="https://linkvertise.net/cdn/linkvertise.js"></script><script>linkvertise(33538, {whitelist: [], blacklist: [""]});</script>