Spaces:
Runtime error
Runtime error
Commit
·
48d4d11
1
Parent(s):
924cb86
moved google search api to env file
Browse files- plagiarism.py +6 -9
plagiarism.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import time
|
2 |
from googleapiclient.discovery import build
|
3 |
import asyncio
|
@@ -5,6 +6,9 @@ import httpx
|
|
5 |
from bs4 import BeautifulSoup
|
6 |
import justext
|
7 |
import newspaper
|
|
|
|
|
|
|
8 |
|
9 |
|
10 |
def clean_html(text):
|
@@ -98,15 +102,8 @@ def google_search(
|
|
98 |
sorted_date,
|
99 |
domains_to_include,
|
100 |
):
|
101 |
-
|
102 |
-
|
103 |
-
api_key = "AIzaSyCLyCCpOPLZWuptuPAPSg8cUIZhdEMVf6g"
|
104 |
-
# api_key = "AIzaSyCS1WQDMl1IMjaXtwSd_2rA195-Yc4psQE"
|
105 |
-
# api_key = "AIzaSyCB61O70B8AC3l5Kk3KMoLb6DN37B7nqIk"
|
106 |
-
# api_key = "AIzaSyCg1IbevcTAXAPYeYreps6wYWDbU0Kz8tg"
|
107 |
-
# api_key = "AIzaSyA5VVwY1eEoIoflejObrxFDI0DJvtbmgW8"
|
108 |
-
cse_id = "851813e81162b4ed4"
|
109 |
-
# get list of URLS to check
|
110 |
start_time = time.perf_counter()
|
111 |
url_list = google_search_urls(
|
112 |
topic,
|
|
|
1 |
+
import os
|
2 |
import time
|
3 |
from googleapiclient.discovery import build
|
4 |
import asyncio
|
|
|
6 |
from bs4 import BeautifulSoup
|
7 |
import justext
|
8 |
import newspaper
|
9 |
+
from dotenv import load_dotenv
|
10 |
+
|
11 |
+
load_dotenv()
|
12 |
|
13 |
|
14 |
def clean_html(text):
|
|
|
102 |
sorted_date,
|
103 |
domains_to_include,
|
104 |
):
|
105 |
+
api_key = os.environ.get("GOOGLE_SEARCH_API_KEY")
|
106 |
+
cse_id = os.environ.get("GOOGLE_SEARCH_CSE_ID")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
start_time = time.perf_counter()
|
108 |
url_list = google_search_urls(
|
109 |
topic,
|