margin = offset = 40
for line in textwrap.wrap(text, width=40):
draw.text((margin, offset), line, font=font, fill="#aa0000")
offset += font.getsize(line)[1]
Сделал переадресацию сайта с 80 порта на 443
#apt update && apt upgrade -y
#apt install build-essential -y
#apt install libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y
#apt install zlib1g -y
#cd /usr/src
#wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
#tar -xzvf Python-3.7.0.tgz
#cd Python-3.7.0
#./configure --enable-optimizations
#make altinstall
python3.7 -m venv DIR_NAME
source DIR_NAME/bin/activate
import requests
headers = {'user-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0',
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
}
url = 'https://www.youtube.com/watch?v=pSWOcXg703s'
response = requests.get(url,headers=headers)
html = response.text
first_1 = html.find('og:title" content="')+19
second_2 = html.find('">',first_1)
title = html[first_1:second_2]
first = html.find('videoViewCountRenderer')+72
second = html.find('"}]}',first)
views = html[first:second]
first_ = html.find('likeStatus":"INDIFFERENT","tooltip"')+37
second_ = html.find('"}},',first_)
likes = html[first_:second_].replace(' ','').split('/')
print(f'Название видео: {title}')
print(f'Сейчас смотрят: {views}')
print(f'Лайков: {likes[0]}')
print(f'Дизлайков: {likes[1]}')
Название видео: Elon Musk Live: Bitcoin BTC Talk, BTC Mass Adoption & SpaceX update [April, 2020]
Сейчас смотрят: 59 365
Лайков: 2 542
Дизлайков: 153
>>> import geoip2.database
>>>
>>> # This creates a Reader object. You should use the same object
>>> # across multiple requests as creation of it is expensive.
>>> reader = geoip2.database.Reader('/path/to/GeoLite2-City.mmdb')
>>>
>>> # Replace "city" with the method corresponding to the database
>>> # that you are using, e.g., "country".
>>> response = reader.city('128.101.101.101')
>>>
>>> response.country.iso_code
'US'
>>> response.country.name
'United States'
>>> response.country.names['zh-CN']
u'美国'
>>>
>>> response.subdivisions.most_specific.name
'Minnesota'
>>> response.subdivisions.most_specific.iso_code
'MN'
>>>
>>> response.city.name
'Minneapolis'
>>>
>>> response.postal.code
'55455'
>>>
>>> response.location.latitude
44.9733
>>> response.location.longitude
-93.2323
>>> reader.close()
>>> from django.contrib.gis.geoip2 import GeoIP2
>>> g = GeoIP2()
>>> g.country('google.com')
{'country_code': 'US', 'country_name': 'United States'}
>>> g.city('72.14.207.99')
{'city': 'Mountain View',
'country_code': 'US',
'country_name': 'United States',
'dma_code': 807,
'latitude': 37.419200897216797,
'longitude': -122.05740356445312,
'postal_code': '94043',
'region': 'CA'}
>>> g.lat_lon('salon.com')
(39.0437, -77.4875)
>>> g.lon_lat('uh.edu')
(-95.4342, 29.834)
>>> g.geos('24.124.1.80').wkt
'POINT (-97 38)'