come commited on
Commit
fc87e49
·
1 Parent(s): d456d30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import requests
2
  import re
3
  import json
4
- from fake_useragent import UserAgent
5
  import gradio as gr
6
  def ReRequestUrl(url):
7
  try:
@@ -58,6 +58,7 @@ def GetJson(data):
58
 
59
  newJson['properties']=propertiesJson
60
  return newJson
 
61
  def gerTtr(typeStr):
62
  str=str(typeStr)
63
  NewStr=re.findall('<class \'(.*?)\'>',str)
@@ -77,7 +78,6 @@ def excuJson(html,jsonOuputPath):
77
  print(jsonOutput)
78
  json.dump(jsonOutput,open(jsonOuputPath,'w',encoding='utf-8') ,indent=2,ensure_ascii=False)
79
 
80
-
81
  # print(gerTtr(type('uk123')))
82
  print(type('uk123')==str)
83
  print(type(listL))
@@ -87,7 +87,7 @@ def excuJson(html,jsonOuputPath):
87
 
88
  def getHtml(url):
89
  try:
90
- headers={'user-agent':UserAgent().random}
91
  res=requests.get(url,headers=headers)
92
  if res.status_code==200:
93
  return res.text
 
1
  import requests
2
  import re
3
  import json
4
+
5
  import gradio as gr
6
  def ReRequestUrl(url):
7
  try:
 
58
 
59
  newJson['properties']=propertiesJson
60
  return newJson
61
+
62
  def gerTtr(typeStr):
63
  str=str(typeStr)
64
  NewStr=re.findall('<class \'(.*?)\'>',str)
 
78
  print(jsonOutput)
79
  json.dump(jsonOutput,open(jsonOuputPath,'w',encoding='utf-8') ,indent=2,ensure_ascii=False)
80
 
 
81
  # print(gerTtr(type('uk123')))
82
  print(type('uk123')==str)
83
  print(type(listL))
 
87
 
88
  def getHtml(url):
89
  try:
90
+ headers={'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'}
91
  res=requests.get(url,headers=headers)
92
  if res.status_code==200:
93
  return res.text