Spaces:
Running
Running
removing old test_scraper.py
Browse files- scripts/test_scraper.py +0 -34
scripts/test_scraper.py
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
from mediaunmasked.scrapers.article_scraper import ArticleScraper
|
2 |
-
import logging
|
3 |
-
|
4 |
-
# Configure logging
|
5 |
-
logging.basicConfig(level=logging.INFO)
|
6 |
-
logger = logging.getLogger(__name__)
|
7 |
-
|
8 |
-
def test_scraper():
|
9 |
-
scraper = ArticleScraper()
|
10 |
-
url = "https://www.channelnewsasia.com/singapore/singapore-mccy-sg-culture-pass-arts-culture-heritage-4951451"
|
11 |
-
|
12 |
-
logger.info(f"Testing scraper with URL: {url}")
|
13 |
-
|
14 |
-
try:
|
15 |
-
result = scraper.scrape_article(url)
|
16 |
-
|
17 |
-
if result:
|
18 |
-
print("\nScraping Successful!")
|
19 |
-
print("-" * 50)
|
20 |
-
print(f"Headline: {result['headline']}")
|
21 |
-
print("-" * 50)
|
22 |
-
print("Content Preview (first 500 chars):")
|
23 |
-
print(result['content'][:500])
|
24 |
-
print("...")
|
25 |
-
print("-" * 50)
|
26 |
-
print(f"Total content length: {len(result['content'])} characters")
|
27 |
-
else:
|
28 |
-
print("Scraping failed - no result returned")
|
29 |
-
|
30 |
-
except Exception as e:
|
31 |
-
logger.error(f"Error during scraping: {str(e)}", exc_info=True)
|
32 |
-
|
33 |
-
if __name__ == "__main__":
|
34 |
-
test_scraper()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|