You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project uses pyppeteer which is uses very old version of Chromium. This is easily fixable. You can check my comment on another issue here.
Let me know if this helps.
Unhandled error: Browser closed unexpectedly:
closedUnhandled error: Browser closed unexpectedly:
my code
from asyncio import events
import uvloop
import requests
import asyncio, time
import re
import argparse
import sys
import threading
from requests_html import AsyncHTMLSession, HTMLSession
import urllib3
from pyppeteer import launch
import hashlib
import os
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0',
'Content-Encoding': 'gzip'
}
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
def get_url(url_txt):
with open(url_txt, "r") as f:
s = f.readlines()
lt = [i.strip() for i in s]
return lt
def output_data(i, out_name):
with open(out_name, "a", encoding='utf-8') as f:
f.write(i + "\n")
def get_md5_value(src):
myMd5 = hashlib.md5()
myMd5.update(src.encode("utf8"))
myMd5_Digest = myMd5.hexdigest()
return myMd5_Digest
async def process_data(sem, s, i, None_data_list):
async with sem:
try:
async def start_up(urls, None_data_list, timeout_duration=3000):
s = AsyncHTMLSession(verify=False)
sem = asyncio.Semaphore(3)
tasks = (process_data(sem, s, url, None_data_list) for url in urls)
await asyncio.wait_for(asyncio.gather(*tasks), timeout=timeout_duration)
await s.close()
def main(urls):
None_data_list = []
try:
start = time.perf_counter()
print(urls)
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(start_up(urls, None_data_list))
end = time.perf_counter()
print(f'None_Scan : {end - start} ')
output_data(str(end - start), 'debug_time.txt')
print('')
except asyncio.TimeoutError:
print("Timeout occurred")
except Exception as e:
print(e)
finally:
print(len(None_data_list))
os.system('pkill -f -9 chrome')
return None_data_list
test.py
new_request_None_url = ['http://bi-mokadisplay.tcl.com:83','http://tmsa.cmp.tcl.com:88']
update_data_list = nonetitle_info.main(new_request_None_url)
print(update_data_list)
#data_info.none_update(False, update_data_list)
The text was updated successfully, but these errors were encountered: