Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,10 @@ MAJOR_COUNTRIES = [
|
|
21 |
def search_serphouse(query, country, page, num_result):
|
22 |
url = "https://api.serphouse.com/serp/live"
|
23 |
|
|
|
|
|
|
|
|
|
24 |
payload = {
|
25 |
"data": {
|
26 |
"q": query,
|
@@ -32,7 +36,7 @@ def search_serphouse(query, country, page, num_result):
|
|
32 |
"page": str(page),
|
33 |
"verbatim": "1",
|
34 |
"num": str(num_result),
|
35 |
-
"date_range":
|
36 |
}
|
37 |
}
|
38 |
|
|
|
21 |
def search_serphouse(query, country, page, num_result):
|
22 |
url = "https://api.serphouse.com/serp/live"
|
23 |
|
24 |
+
now = datetime.utcnow()
|
25 |
+
yesterday = now - timedelta(days=1)
|
26 |
+
date_range = f"{yesterday.strftime('%Y-%m-%d')},{now.strftime('%Y-%m-%d')}"
|
27 |
+
|
28 |
payload = {
|
29 |
"data": {
|
30 |
"q": query,
|
|
|
36 |
"page": str(page),
|
37 |
"verbatim": "1",
|
38 |
"num": str(num_result),
|
39 |
+
"date_range": date_range
|
40 |
}
|
41 |
}
|
42 |
|