ehsan-dashboards/dashboards/VPN_chanel/fetch_samples.py

15 lines
604 B
Python

import urllib.request
import re
urls = ['104', '110', '114', '120']
for pid in urls:
try:
req = urllib.request.Request(f"https://t.me/NetVibe_VPN/{pid}", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'})
html = urllib.request.urlopen(req).read().decode('utf-8')
m = re.findall(r'property="og:image"\s+content="([^"]+)"', html)
if m:
img_url = m[0]
print(f"Downloading {pid}: {img_url}")
urllib.request.urlretrieve(img_url, f"/tmp/netvibe_{pid}.jpg")
except Exception as e:
print(f"Error {pid}: {e}")