Apuntes_Python/04_seis_proyectos/01_WebScrappingProgram/main.py

26 lines
618 B
Python
Raw Normal View History

2022-12-24 22:41:20 -03:00
"""
Git-hub, Gitea user image profile scrapper
"""
import requests
from bs4 import BeautifulSoup as bs
# Nombre usario
git_usr = input('Ingresa un nombre de usuario: ')
# Sitio
url = 'https://github.com/' + git_usr
#url = 'https://gitea.letz.dev/' + git_usr
2022-12-24 22:41:20 -03:00
# Request
r = requests.get(url)
# Obtención del link con BeautifulSoup
soup = bs(r.content, 'html.parser')
img_perfil = soup.find('img', {'class' : 'avatar avatar-user width-full border color-bg-primary'})['src']
#img_perfil = soup.find('img', {'class' : 'avatar'})['src']
resp = img_perfil
#resp = 'https://gitea.letz.dev' + img_perfil
2022-12-24 22:41:20 -03:00
print(resp)