Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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="'


sp = BeautifulSoup(your_html)
sp.find('a').get('href')

# output:

# /mp3s/mp3/Shadmehr-Aghili-Avaz-Nemishi
Comment

PREVIOUS NEXT
Code Example
Python :: how to kill tkinter 
Python :: ignoring warnings 
Python :: django rest documentation 
Python :: start virtualenv 
Python :: Efficiently count zero elements in numpy array? 
Python :: completely uninstall python and all vritualenvs from mac 
Python :: find the first occurrence of item in a list in python 
Python :: python reverse linked list 
Python :: convert image to grayscale opencv 
Python :: python get input from console 
Python :: python find closest lower value in list 
Python :: python remove background 
Python :: print ocaml 
Python :: check if string has digits python 
Python :: python 64 bit 
Python :: python super init 
Python :: drop missing values in a column pandas 
Python :: delete all files in a directory python 
Python :: how to add delay in python 
Python :: create 2d array python list comprehension 
Python :: is flask open source 
Python :: find null values pandas 
Python :: cut part of video ffmpeg 
Python :: how to import a python function from another file 
Python :: how to flatten a nested list in python 
Python :: jupyter notebook delete the output 
Python :: addition in python 
Python :: df count zeros 
Python :: macos set default python version 
Python :: renaming column in dataframe pandas 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =