jianghuyihei commited on
Commit
1bb14f7
1 Parent(s): 2abb453
Files changed (1) hide show
  1. searcher/sementic_search.py +7 -2
searcher/sementic_search.py CHANGED
@@ -31,10 +31,15 @@ def extract(text, type):
31
  return text
32
  else:
33
  return ""
34
-
35
  def download(url):
36
  try:
37
- response = requests.get(url)
 
 
 
 
 
38
  if response.status_code == 200:
39
  return response.content
40
  else:
 
31
  return text
32
  else:
33
  return ""
34
+
35
  def download(url):
36
  try:
37
+ headers = {
38
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
39
+ 'AppleWebKit/537.36 (KHTML, like Gecko) '
40
+ 'Chrome/87.0.4280.88 Safari/537.36'
41
+ } # Mimic a common browser's User-Agent
42
+ response = requests.get(url,headers=headers,timeout=120)
43
  if response.status_code == 200:
44
  return response.content
45
  else: