commit
e395e4f97e
18
Pipfile
18
Pipfile
@ -10,15 +10,15 @@ ui = "python tkinter_ui.py"
|
||||
[dev-packages]
|
||||
|
||||
[packages]
|
||||
requests = ">=2.31.0"
|
||||
feedparser = ">=6.0.11"
|
||||
pytz = ">=2024.1"
|
||||
selenium = ">=4.19.0"
|
||||
selenium-stealth = ">=1.0.6"
|
||||
aiohttp = ">=3.9.4"
|
||||
bs4 = ">=0.0.2"
|
||||
tqdm = ">=4.66.3"
|
||||
async-timeout = ">=4.0.3"
|
||||
requests = "*"
|
||||
feedparser = "*"
|
||||
pytz = "*"
|
||||
selenium = "*"
|
||||
selenium-stealth = "*"
|
||||
aiohttp = "*"
|
||||
bs4 = "*"
|
||||
tqdm = "*"
|
||||
async-timeout = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.8"
|
||||
|
10
Pipfile.lock
generated
10
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "1d1e4f62291d7e9f7cb0343b70860aacf3746baa9fd2aa58cc2c2be8ee595ecd"
|
||||
"sha256": "11c3de86a4608bc8cb9df8ad66ccc8badc83779b3a5daf7b221a7a3a53ae1660"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
@ -310,6 +310,14 @@
|
||||
"markers": "platform_system == 'Windows'",
|
||||
"version": "==0.4.6"
|
||||
},
|
||||
"exceptiongroup": {
|
||||
"hashes": [
|
||||
"sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad",
|
||||
"sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"
|
||||
],
|
||||
"markers": "python_version < '3.11'",
|
||||
"version": "==1.2.1"
|
||||
},
|
||||
"feedparser": {
|
||||
"hashes": [
|
||||
"sha256:0be7ee7b395572b19ebeb1d6aafb0028dee11169f1c934e0ed67d54992f4ad45",
|
||||
|
7
main.py
7
main.py
@ -100,7 +100,7 @@ class UpdateSource:
|
||||
int((self.pbar.n / self.total) * 100),
|
||||
)
|
||||
|
||||
async def process_channel(self, loop):
|
||||
async def process_channel(self):
|
||||
async with self.semaphore:
|
||||
try:
|
||||
cate, name, old_urls = await self.channel_queue.get()
|
||||
@ -116,7 +116,6 @@ class UpdateSource:
|
||||
if config.open_online_search and self.results["open_online_search"]:
|
||||
online_info_list = (
|
||||
await async_get_channels_info_list_by_online_search(
|
||||
loop,
|
||||
self.results["open_online_search"],
|
||||
format_name,
|
||||
)
|
||||
@ -192,10 +191,8 @@ class UpdateSource:
|
||||
self.tasks = []
|
||||
await self.visit_page()
|
||||
self.total = self.channel_queue.qsize()
|
||||
loop = asyncio.get_running_loop()
|
||||
self.tasks = [
|
||||
asyncio.create_task(self.process_channel(loop))
|
||||
for _ in range(self.total)
|
||||
asyncio.create_task(self.process_channel()) for _ in range(self.total)
|
||||
]
|
||||
self.pbar = tqdm_asyncio(total=self.total)
|
||||
self.pbar.set_description(f"Processing, {self.total} channels remaining")
|
||||
|
15
utils.py
15
utils.py
@ -279,11 +279,16 @@ def get_channels_info_list_by_online_search(pageUrl, name):
|
||||
return info_list
|
||||
|
||||
|
||||
async def async_get_channels_info_list_by_online_search(loop, pageUrl, name):
|
||||
with concurrent.futures.ThreadPoolExecutor() as pool:
|
||||
info_list = await loop.run_in_executor(
|
||||
pool, get_channels_info_list_by_online_search, pageUrl, name
|
||||
)
|
||||
async def async_get_channels_info_list_by_online_search(pageUrl, name):
|
||||
"""
|
||||
Get the channels info list by online search
|
||||
"""
|
||||
# with concurrent.futures.ThreadPoolExecutor() as pool:
|
||||
# loop = asyncio.geto_running_loop()
|
||||
# info_list = await loop.run_in_executor(
|
||||
# pool, get_channels_info_list_by_online_search, pageUrl, name
|
||||
# )
|
||||
info_list = get_channels_info_list_by_online_search(pageUrl, name)
|
||||
return info_list
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user