Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lilingfengdev committed Jun 13, 2024
1 parent 55dbc77 commit 0f5c11a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 14 deletions.
6 changes: 1 addition & 5 deletions generate-bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@

import PyInstaller.__main__

os.mkdir("dist")

flag = ["-F", "main.py", "--optimize", "2"]
if platform.system() != 'Windows':
flag.append("--strip")
PyInstaller.__main__.run(flag)
PyInstaller.__main__.run(["main.spec"])

8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@


def print_result(result):
print(result.title)
print(result.summary)
print(result.url)
print("====================")
print(f"\033[1;32m标题: \033[0m{result.title}")
print(f"\033[1;34m简介: \033[0m{result.summary}")
print(f"\033[1;36mURL: \033[0m{result.url}")
print("\033[1;33m====================\033[0m")
print()


Expand Down
45 changes: 45 additions & 0 deletions main.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- mode: python ; coding: utf-8 -*-
import platform


a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=2,
)
pyz = PYZ(a.pure)

if platform.system() != 'Windows':
strip = True
a.exclude_system_libraries()
else:
strip = False

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[('O', None, 'OPTION'), ('O', None, 'OPTION')],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=strip,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
7 changes: 2 additions & 5 deletions plugin/engine/bing.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import typing

from plugin.engine.base import SearchEngine, SearchResult
from plugin.engine.base import SearchResult
import re
import requests
from lxml.html import etree

from plugin.utils.translate import translate, EN


class Bing:

def get_bing_url(self, keywords):
Expand All @@ -17,7 +14,7 @@ def get_bing_url(self, keywords):
return bing_url

def search(self, keywords, site) -> typing.List[SearchResult]:
keywords = f'"{translate(keywords)}" 插件 site:{site}'
keywords = f'"{keywords}" 插件 site:{site}'
url = self.get_bing_url(keywords)
result: typing.List[SearchResult] = []
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0',
Expand Down

0 comments on commit 0f5c11a

Please sign in to comment.