Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a href="Link_I_Need.html" class="Unique_Class_Name">link text</a>
- soup = BeautifulSoup(html)
- anchors = soup.find_all('a', {'class': 'Unique_Class_Name', 'href': True})
- for anchor in anchors:
- print (anchor['href'])
- soup = BeautifulSoup(html)
- for anchor in soup.select('a.Unique_Class_Name'):
- if anchor.has_attr('href'):
- print (anchor['href'])
- <a class="blueText" href="/info/046386294000000899/?s_bid=046386294000000899&s_sid=FSP-LSR-002&s_fr=V01&s_ck=C01" target="_blank">ε·ζεεΊ</a>
- for url in url_list:
- res = requests.get('%s' % url)
- soup = bs4.BeautifulSoup(res.text, "html.parser")
- for p in soup.find_all('a', class_='blueText'):
- print(p.text)
Add Comment
Please, Sign In to add comment