Spaces:
Sleeping
Sleeping
File size: 1,574 Bytes
a09a20c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #!/usr/bin/env python3
"""Test the updated YouTube scraper"""
from youtube_scraper import YouTubeScraper
def test_scraper():
scraper = YouTubeScraper()
print('🧪 Testing UPDATED YouTube Scraper...')
print('=' * 60)
print()
# Test with Miss Fortune
print('Test: Searching for "League of Legends Miss Fortune guide"')
videos = scraper.search_videos('League of Legends Miss Fortune guide', 3)
print()
print(f'📊 Results: Found {len(videos)} videos')
print('=' * 60)
print()
if videos:
print('✅ SUCCESS! Scraper is working again!')
print()
for i, v in enumerate(videos, 1):
print(f'{i}. {v.get("title", "No title")}')
print(f' URL: {v.get("url", "No URL")}')
print(f' Views: {v.get("views", "Unknown")}')
print(f' Duration: {v.get("duration", "Unknown")}')
print()
return True
else:
print('❌ Still not working - YouTube blocking is too strong')
print()
print('📝 Analysis:')
print(' - YouTube has strengthened bot detection')
print(' - Web scraping is being actively blocked')
print(' - This is why the scraper that "was working" stopped')
print()
print('💡 Solutions:')
print(' 1. Use YouTube Data API (recommended, reliable)')
print(' 2. Use a proxy service')
print(' 3. Accept that video search is unavailable')
print()
return False
if __name__ == '__main__':
test_scraper()
|