from bs4 import BeautifulSoup
h = '''
<div class="searchPersonaInfo">
<a class="searchPersonaName" href="url">Ник</a>
<br>
Алекс
<br>
Murmansk
<img src="img.gif">
</div>
'''
soup = BeautifulSoup(h, 'lxml')
div = soup.find(class_='searchPersonaInfo')
for s in div.stripped_strings:
print(s)
https://sirus.su/api/statistic/tooltip.json
data = json.loads(response.text)
data = response.json()
import base64
imgstring = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAyAPoDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDx0/8ACNX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qIoR6EC8HFee6snhK7MmoRa1qUUtyDutodGhjQEf7K3GEXIHGDQBBN41vGhjWOw0QSAfM/8AYVkAfbHlH8+PpUH/AAmWqf8AProf/ghsv/jNSabp3ha7Uxy6prX2kglVi02HaPxa4Gfpx3qT+xfDf/QS8R/+CKP/AOSaAOXooooA7GD/AJI3ff8AYeg/9ES1x1FFADkkeJw8bsjDoynBFXNYjSLVZkjRUUbcKowB8ooooAo0UUUAFdN4Pdli8RBWIDaNMGAPUbkOD+IH5UUUAZ9xGn/CN2kmxd/mFd2OcZbjNaPhtR9glbA3GUgnHPQf40UUAcxVm+ZmuQzEljFGSSeT8i0UUAVqKKKACiiigAooooA9C+HcjxeFPHckbsjppaMrKcEESDBBrz2iigCeyUNf26sAVMqggjg807UGZtSuSxJPmsOT6GiigCtWhaf8gfUf+2X/AKFRRQAXf/IH07/tr/6FV4geRK+PndFLN3bNuSc/U8/WiigDBooooAKKKKAP/9k="
imgdata = base64.b64decode(imgstring.split('base64,')[1])
filename = 'some_image.jpg'
with open(filename, 'wb') as f:
f.write(imgdata)
class ItemService:
def enrich_with_data(self, session: requests.Session, items: list[Item]) -> list[Item]:
for item in items:
response = self.repository.get_additional_data(session, item)
item_info = response.json()['iteminfo']
item.full_item_name = item_info['full_item_name']
#print(item.full_item_name)
return items, item.full_item_name