seawolf2357 commited on
Commit
8a9ead8
·
verified ·
1 Parent(s): 464c233

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -7
app.py CHANGED
@@ -6,14 +6,65 @@ from datetime import datetime, timedelta
6
  API_KEY = "AIzaSyDUz3wkGal0ewRtPlzeMit88bV4hS4ZIVY"
7
  SEARCH_ENGINE_ID = "56b34994f47704ddd"
8
 
9
- # 지원되는 국가 리스트
 
10
  COUNTRIES = {
11
- 'United States': 'countryUS', 'United Kingdom': 'countryGB', 'India': 'countryIN',
12
- 'Australia': 'countryAU', 'Canada': 'countryCA', 'Germany': 'countryDE',
13
- 'France': 'countryFR', 'Italy': 'countryIT', 'Spain': 'countryES', 'Brazil': 'countryBR',
14
- 'Mexico': 'countryMX', 'Argentina': 'countryAR', 'Japan': 'countryJP',
15
- 'South Korea': 'countryKR', 'Russia': 'countryRU', 'China': 'countryCN',
16
- 'Netherlands': 'countryNL', 'Sweden': 'countrySE', 'Poland': 'countryPL', 'Turkey': 'countryTR'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
  def search_news(keyword, country):
 
6
  API_KEY = "AIzaSyDUz3wkGal0ewRtPlzeMit88bV4hS4ZIVY"
7
  SEARCH_ENGINE_ID = "56b34994f47704ddd"
8
 
9
+
10
+ # 지원되는 국가 리스트 (Google Custom Search API에서 지원하는 모든 국가)
11
  COUNTRIES = {
12
+ 'Afghanistan': 'countryAF', 'Albania': 'countryAL', 'Algeria': 'countryDZ', 'American Samoa': 'countryAS',
13
+ 'Andorra': 'countryAD', 'Angola': 'countryAO', 'Anguilla': 'countryAI', 'Antarctica': 'countryAQ',
14
+ 'Antigua and Barbuda': 'countryAG', 'Argentina': 'countryAR', 'Armenia': 'countryAM', 'Aruba': 'countryAW',
15
+ 'Australia': 'countryAU', 'Austria': 'countryAT', 'Azerbaijan': 'countryAZ', 'Bahamas': 'countryBS',
16
+ 'Bahrain': 'countryBH', 'Bangladesh': 'countryBD', 'Barbados': 'countryBB', 'Belarus': 'countryBY',
17
+ 'Belgium': 'countryBE', 'Belize': 'countryBZ', 'Benin': 'countryBJ', 'Bermuda': 'countryBM',
18
+ 'Bhutan': 'countryBT', 'Bolivia': 'countryBO', 'Bosnia and Herzegovina': 'countryBA', 'Botswana': 'countryBW',
19
+ 'Bouvet Island': 'countryBV', 'Brazil': 'countryBR', 'British Indian Ocean Territory': 'countryIO',
20
+ 'Brunei Darussalam': 'countryBN', 'Bulgaria': 'countryBG', 'Burkina Faso': 'countryBF', 'Burundi': 'countryBI',
21
+ 'Cambodia': 'countryKH', 'Cameroon': 'countryCM', 'Canada': 'countryCA', 'Cape Verde': 'countryCV',
22
+ 'Cayman Islands': 'countryKY', 'Central African Republic': 'countryCF', 'Chad': 'countryTD', 'Chile': 'countryCL',
23
+ 'China': 'countryCN', 'Christmas Island': 'countryCX', 'Cocos (Keeling) Islands': 'countryCC', 'Colombia': 'countryCO',
24
+ 'Comoros': 'countryKM', 'Congo': 'countryCG', 'Congo, Democratic Republic': 'countryCD', 'Cook Islands': 'countryCK',
25
+ 'Costa Rica': 'countryCR', "Cote D'Ivoire": 'countryCI', 'Croatia': 'countryHR', 'Cuba': 'countryCU', 'Cyprus': 'countryCY',
26
+ 'Czech Republic': 'countryCZ', 'Denmark': 'countryDK', 'Djibouti': 'countryDJ', 'Dominica': 'countryDM',
27
+ 'Dominican Republic': 'countryDO', 'Ecuador': 'countryEC', 'Egypt': 'countryEG', 'El Salvador': 'countrySV',
28
+ 'Equatorial Guinea': 'countryGQ', 'Eritrea': 'countryER', 'Estonia': 'countryEE', 'Ethiopia': 'countryET',
29
+ 'Falkland Islands (Malvinas)': 'countryFK', 'Faroe Islands': 'countryFO', 'Fiji': 'countryFJ', 'Finland': 'countryFI',
30
+ 'France': 'countryFR', 'French Guiana': 'countryGF', 'French Polynesia': 'countryPF', 'French Southern Territories': 'countryTF',
31
+ 'Gabon': 'countryGA', 'Gambia': 'countryGM', 'Georgia': 'countryGE', 'Germany': 'countryDE', 'Ghana': 'countryGH',
32
+ 'Gibraltar': 'countryGI', 'Greece': 'countryGR', 'Greenland': 'countryGL', 'Grenada': 'countryGD', 'Guadeloupe': 'countryGP',
33
+ 'Guam': 'countryGU', 'Guatemala': 'countryGT', 'Guinea': 'countryGN', 'Guinea-Bissau': 'countryGW', 'Guyana': 'countryGY',
34
+ 'Haiti': 'countryHT', 'Heard Island and Mcdonald Islands': 'countryHM', 'Holy See (Vatican City State)': 'countryVA',
35
+ 'Honduras': 'countryHN', 'Hong Kong': 'countryHK', 'Hungary': 'countryHU', 'Iceland': 'countryIS', 'India': 'countryIN',
36
+ 'Indonesia': 'countryID', 'Iran, Islamic Republic of': 'countryIR', 'Iraq': 'countryIQ', 'Ireland': 'countryIE',
37
+ 'Israel': 'countryIL', 'Italy': 'countryIT', 'Jamaica': 'countryJM', 'Japan': 'countryJP', 'Jordan': 'countryJO',
38
+ 'Kazakhstan': 'countryKZ', 'Kenya': 'countryKE', 'Kiribati': 'countryKI', "Korea, Democratic People's Republic of": 'countryKP',
39
+ 'Korea, Republic of': 'countryKR', 'Kuwait': 'countryKW', 'Kyrgyzstan': 'countryKG', "Lao People's Democratic Republic": 'countryLA',
40
+ 'Latvia': 'countryLV', 'Lebanon': 'countryLB', 'Lesotho': 'countryLS', 'Liberia': 'countryLR', 'Libyan Arab Jamahiriya': 'countryLY',
41
+ 'Liechtenstein': 'countryLI', 'Lithuania': 'countryLT', 'Luxembourg': 'countryLU', 'Macao': 'countryMO',
42
+ 'Macedonia, The Former Yugoslav Republic of': 'countryMK', 'Madagascar': 'countryMG', 'Malawi': 'countryMW',
43
+ 'Malaysia': 'countryMY', 'Maldives': 'countryMV', 'Mali': 'countryML', 'Malta': 'countryMT', 'Marshall Islands': 'countryMH',
44
+ 'Martinique': 'countryMQ', 'Mauritania': 'countryMR', 'Mauritius': 'countryMU', 'Mayotte': 'countryYT', 'Mexico': 'countryMX',
45
+ 'Micronesia, Federated States of': 'countryFM', 'Moldova, Republic of': 'countryMD', 'Monaco': 'countryMC', 'Mongolia': 'countryMN',
46
+ 'Montserrat': 'countryMS', 'Morocco': 'countryMA', 'Mozambique': 'countryMZ', 'Myanmar': 'countryMM', 'Namibia': 'countryNA',
47
+ 'Nauru': 'countryNR', 'Nepal': 'countryNP', 'Netherlands': 'countryNL', 'Netherlands Antilles': 'countryAN', 'New Caledonia': 'countryNC',
48
+ 'New Zealand': 'countryNZ', 'Nicaragua': 'countryNI', 'Niger': 'countryNE', 'Nigeria': 'countryNG', 'Niue': 'countryNU',
49
+ 'Norfolk Island': 'countryNF', 'Northern Mariana Islands': 'countryMP', 'Norway': 'countryNO', 'Oman': 'countryOM',
50
+ 'Pakistan': 'countryPK', 'Palau': 'countryPW', 'Palestinian Territory, Occupied': 'countryPS', 'Panama': 'countryPA',
51
+ 'Papua New Guinea': 'countryPG', 'Paraguay': 'countryPY', 'Peru': 'countryPE', 'Philippines': 'countryPH', 'Pitcairn': 'countryPN',
52
+ 'Poland': 'countryPL', 'Portugal': 'countryPT', 'Puerto Rico': 'countryPR', 'Qatar': 'countryQA', 'Reunion': 'countryRE',
53
+ 'Romania': 'countryRO', 'Russian Federation': 'countryRU', 'Rwanda': 'countryRW', 'Saint Helena': 'countrySH',
54
+ 'Saint Kitts and Nevis': 'countryKN', 'Saint Lucia': 'countryLC', 'Saint Pierre and Miquelon': 'countryPM',
55
+ 'Saint Vincent and the Grenadines': 'countryVC', 'Samoa': 'countryWS', 'San Marino': 'countrySM', 'Sao Tome and Principe': 'countryST',
56
+ 'Saudi Arabia': 'countrySA', 'Senegal': 'countrySN', 'Serbia and Montenegro': 'countryCS', 'Seychelles': 'countrySC',
57
+ 'Sierra Leone': 'countrySL', 'Singapore': 'countrySG', 'Slovakia': 'countrySK', 'Slovenia': 'countrySI', 'Solomon Islands': 'countrySB',
58
+ 'Somalia': 'countrySO', 'South Africa': 'countryZA', 'South Georgia and the South Sandwich Islands': 'countryGS', 'Spain': 'countryES',
59
+ 'Sri Lanka': 'countryLK', 'Sudan': 'countrySD', 'Suriname': 'countrySR', 'Svalbard and Jan Mayen': 'countrySJ', 'Swaziland': 'countrySZ',
60
+ 'Sweden': 'countrySE', 'Switzerland': 'countryCH', 'Syrian Arab Republic': 'countrySY', 'Taiwan, Province of China': 'countryTW',
61
+ 'Tajikistan': 'countryTJ', 'Tanzania, United Republic of': 'countryTZ', 'Thailand': 'countryTH', 'Timor-Leste': 'countryTL',
62
+ 'Togo': 'countryTG', 'Tokelau': 'countryTK', 'Tonga': 'countryTO', 'Trinidad and Tobago': 'countryTT', 'Tunisia': 'countryTN',
63
+ 'Turkey': 'countryTR', 'Turkmenistan': 'countryTM', 'Turks and Caicos Islands': 'countryTC', 'Tuvalu': 'countryTV', 'Uganda': 'countryUG',
64
+ 'Ukraine': 'countryUA', 'United Arab Emirates': 'countryAE', 'United Kingdom': 'countryGB', 'United States': 'countryUS',
65
+ 'United States Minor Outlying Islands': 'countryUM', 'Uruguay': 'countryUY', 'Uzbekistan': 'countryUZ', 'Vanuatu': 'countryVU',
66
+ 'Venezuela': 'countryVE', 'Viet Nam': 'countryVN', 'Virgin Islands, British': 'countryVG', 'Virgin Islands, U.S.': 'countryVI',
67
+ 'Wallis and Futuna': 'countryWF', 'Western Sahara': 'countryEH', 'Yemen': 'countryYE', 'Zambia': 'countryZM', 'Zimbabwe': 'countryZW'
68
  }
69
 
70
  def search_news(keyword, country):