Skip to content

Instantly share code, notes, and snippets.

#dependencies
import requests
from bs4 import BeautifulSoup
import json
url = 'http://api.scraperapi.com?api_key=51e43be283e4db2a5afbxxxxxxxxxxx&url=https://datatables.net/examples/styling/stripe.html'
#empty array
employee_list = []
with open('json_data', 'w') as json_file:
json.dump(employee_list, json_file, indent=2)
employee_list.append({
'Name': name,
'Position': position,
'Office': office,
'Age': age,
'Start date': start_date,
'salary': salary
})
position = row.find_all('td')[1].text
office = row.find_all('td')[2].text
age = row.find_all('td')[3].text
start_date = row.find_all('td')[4].text
salary = row.find_all('td')[5].text
for row in rows:
name = row.find_all('td')[0].text
print(name)
document.querySelectorAll('table.stripe > tbody > tr > td')[0]
for employee_data in table.find_all('tbody'):
rows = employee_data.find_all('tr')
print(rows)
table = soup.find('table', class_ = 'stripe')
print(table)
soup = BeautifulSoup(response.text, 'html.parser')
import requests
from bs4 import BeautifulSoup
url = 'http://api.scraperapi.com?api_key=51e43be283e4db2a5afbxxxxxxxxxxxx&url=https://datatables.net/examples/styling/stripe.html'
response = requests.get(url)
print(response.status_code)