I am trying to parse src='the-link'
from this HTML snippet. But I don't know how. Here is my code:
from bs4 import BeautifulSoup
import requests
source = requests.get('https://www.reddit.com/r/programmingmemes/').text
soup = BeautifulSoup(source, 'lxml')
img = soup.find('div', class_='_3Oa0THmZ3f5iZXAQ0hBJ0k')
div = img.find('div')
src = div.find('src')
print(src)
I want the output as:
<div> <img alt="Post image" class="_2_tDEnGMLxpM6uOa2kaDB3 ImageBox-image media-element _1XWObl-3b9tPy64oaG6fax" src="preview.redd.it/ik1g60hzoqc61.jpg? width=640&crop=smart&auto=webp&s=c5fedaba3e5627cf8fcdd008317ac39789d71abc" style="max-height:512px"/> </div>
question from:
https://stackoverflow.com/questions/65849025/this-gives-me-none-as-output 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…