Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
firofame authored Dec 8, 2024
1 parent 4275daf commit 06a3673
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
import re
import requests

headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' # Example User-Agent string
}

def read_handles(file_path):
with open(file_path, 'r') as f:
return [tuple(line.strip().split(',')) for line in f]

def fetch_channel_data(handle):
url = f'https://www.youtube.com/@{handle}/live'
try:
response = requests.get(url)
response = requests.get(url, timeout=10, headers=headers)
response.raise_for_status()
except requests.RequestException as e:
print(f"Error fetching data for handle {handle}: {e}")
Expand Down

0 comments on commit 06a3673

Please sign in to comment.