What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-06 20:08:24
iterate over meta tag python
import urllib.request from bs4 import BeautifulSoup f = open('out.txt','w') url = "http://www.international.gc.ca/about-a_propos/atip-aiprp/reports-rapports/2012/02-atip_aiprp.aspx" page = urllib.request.urlopen(url) soup = BeautifulSoup(page... Add solution -
Python 2021-11-05 10:04:12
beautifulsoup4
from bs4 import BeautifulSoup # works very well with Requests or urllib module # Quick Start from bs4 import BeautifulSoup soup = BeautifulSoup("<p>Some<b>bad<i>HTML") print(soup.prettify()) #OUTPUT: <html> <body&g... Add solution -
Html 2021-11-04 04:02:16
python regex in html
>>> from bs4 import BeautifulSoup >>> soup = BeautifulSoup("<p>Some<b>bad<i>HTML") >>> print soup.prettify() <html> <body> <p> Some <b> bad <i> HTML import re print(soup.... Add solution -
Python 2021-10-28 09:09:09
how to send a message from google form to a python
import urllib.request from bs4 import BeautifulSoup import requests, warnings def get_questions(in_url): res = urllib.request.urlopen(in_url) soup = BeautifulSoup(res.read(), 'html.parser') get_names = lambda f: [v for k,v in f.attrs.items() i... Add solution -
Other 2021-10-25 02:26:08
web scraping
#pip install beautifulsoup4 #python : import os import requests from bs4 import BeautifulSoup url = "https://www.google.com/" reponse = requests.get(url) if reponse.ok: soup = BeautifulSoup(reponse.text, "lxml") title = str(soup.f... Add solution -
Other 2021-10-23 02:30:09
Faster scraping
import requests from bs4 import BeautifulSoup BASE_URL = "https://news.ycombinator.com/" STORY_LINKS = [] for i in range(10): resp = requests.get(f"{BASE_URL}news?p={i}") soup = BeautifulSoup(resp.content, "html.parser&q... Add solution -
Python 2021-10-22 18:54:18
python user in instagram api
# importing libraries from bs4 import BeautifulSoup import requests # instagram URL URL = "https://www.instagram.com/{}/" # parse function def parse_data(s): # creating a dictionary data = {} # splittting the content # then ta... Add solution -
Python 2021-10-21 14:13:03
python scrape data from aspx page
#pip install requests #pip install lxml #pip install bs4 import requests from bs4 import BeautifulSoup r_obj = requests.Session() url = "aspx_website_url_here" # i.e. http://bisegrw.edu.pk/ r_soup = r_obj.get(url) soup = BeautifulSoup(r_soup.co... Add solution -
Python 2021-10-19 22:07:09
beautifulsoup getting data from a website
from bs4 import BeautifulSoup soup = BeautifulSoup(html_doc, 'html.parser') print(soup.prettify()) # <html> # <head> # <title> # The Dormouse's story # </title> # </head> # <body> # <p class="title&... Add solution -
Python 2021-10-15 13:46:11
extract url from page python
from bs4 import BeautifulSoup your_html = '<div class="itemContainer"> <a c="" href="/mp3s/mp3/Shadmehr-Aghili-Avaz-Nemishi"><div class="image_crop"><img alt="2f370b436731d9b" src=&qu... Add solution