Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -22,9 +22,27 @@ MAJOR_COUNTRIES = [
|
|
22 |
"Indonesia", "Philippines", "Vietnam", "Pakistan", "Bangladesh"
|
23 |
]
|
24 |
|
25 |
-
def search_serphouse(query, country, page=1, num_result=100):
|
26 |
url = "https://api.serphouse.com/serp/live"
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
now = datetime.utcnow()
|
29 |
yesterday = now - timedelta(days=1)
|
30 |
date_range = f"{yesterday.strftime('%Y-%m-%d')},{now.strftime('%Y-%m-%d')}"
|
@@ -32,8 +50,8 @@ def search_serphouse(query, country, page=1, num_result=100): # num_result를 1
|
|
32 |
payload = {
|
33 |
"data": {
|
34 |
"q": query,
|
35 |
-
"domain":
|
36 |
-
"loc": country,
|
37 |
"lang": "en",
|
38 |
"device": "desktop",
|
39 |
"serp_type": "news",
|
@@ -271,4 +289,5 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, title="NewsAI 서비스") as
|
|
271 |
show_progress=True # Gradio의 기본 로딩 표시를 끕니다.
|
272 |
)
|
273 |
|
274 |
-
iface.launch(auth=("gini", "pick"))
|
|
|
|
22 |
"Indonesia", "Philippines", "Vietnam", "Pakistan", "Bangladesh"
|
23 |
]
|
24 |
|
25 |
+
def search_serphouse(query, country, page=1, num_result=100):
|
26 |
url = "https://api.serphouse.com/serp/live"
|
27 |
|
28 |
+
# 국가별 도메인 매핑
|
29 |
+
country_domains = {
|
30 |
+
"United States": "google.com",
|
31 |
+
"United Kingdom": "google.co.uk",
|
32 |
+
"Canada": "google.ca",
|
33 |
+
"Australia": "google.com.au",
|
34 |
+
"Germany": "google.de",
|
35 |
+
"France": "google.fr",
|
36 |
+
"Japan": "google.co.jp",
|
37 |
+
"South Korea": "google.co.kr",
|
38 |
+
"China": "google.com.hk", # 중국은 홍콩 도메인 사용
|
39 |
+
"India": "google.co.in",
|
40 |
+
# 필요한 다른 국가들의 도메인을 추가할 수 있습니다.
|
41 |
+
}
|
42 |
+
|
43 |
+
# 선택된 국가의 도메인 가져오기 (없으면 기본값 google.com 사용)
|
44 |
+
domain = country_domains.get(country, "google.com")
|
45 |
+
|
46 |
now = datetime.utcnow()
|
47 |
yesterday = now - timedelta(days=1)
|
48 |
date_range = f"{yesterday.strftime('%Y-%m-%d')},{now.strftime('%Y-%m-%d')}"
|
|
|
50 |
payload = {
|
51 |
"data": {
|
52 |
"q": query,
|
53 |
+
"domain": domain, # 국가별 도메인 사용
|
54 |
+
"loc": country, # 국가 이름
|
55 |
"lang": "en",
|
56 |
"device": "desktop",
|
57 |
"serp_type": "news",
|
|
|
289 |
show_progress=True # Gradio의 기본 로딩 표시를 끕니다.
|
290 |
)
|
291 |
|
292 |
+
#iface.launch(auth=("gini", "pick"))
|
293 |
+
iface.launch()
|