Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,30 +50,19 @@ def search_serphouse(query, country, page, num_result):
|
|
| 50 |
def is_recent_news(time_str):
|
| 51 |
if not time_str:
|
| 52 |
return False
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
return True
|
| 61 |
-
elif unit in ['day', 'days']:
|
| 62 |
-
return value <= 1
|
| 63 |
-
else:
|
| 64 |
-
# 'ago'가 포함된 경우 (예: '2 hours ago')
|
| 65 |
-
if 'ago' in time_str.lower():
|
| 66 |
-
if unit in ['minute', 'minutes', 'hour', 'hours']:
|
| 67 |
-
return True
|
| 68 |
-
elif unit in ['day', 'days']:
|
| 69 |
-
return value <= 1
|
| 70 |
-
except ValueError:
|
| 71 |
-
# 날짜 형식인 경우 (예: 'Sep 22, 2024')
|
| 72 |
try:
|
| 73 |
-
|
| 74 |
-
return
|
| 75 |
except ValueError:
|
| 76 |
-
|
|
|
|
| 77 |
return False
|
| 78 |
|
| 79 |
def format_results(results):
|
|
|
|
| 50 |
def is_recent_news(time_str):
|
| 51 |
if not time_str:
|
| 52 |
return False
|
| 53 |
+
|
| 54 |
+
time_str = time_str.lower().strip()
|
| 55 |
+
|
| 56 |
+
if time_str == "1 day ago":
|
| 57 |
+
return True
|
| 58 |
+
|
| 59 |
+
if "hours ago" in time_str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
try:
|
| 61 |
+
hours = int(time_str.split()[0])
|
| 62 |
+
return hours <= 24
|
| 63 |
except ValueError:
|
| 64 |
+
return False
|
| 65 |
+
|
| 66 |
return False
|
| 67 |
|
| 68 |
def format_results(results):
|