Browse Source

Merge remote-tracking branch 'origin/main'

main
westernmeadow 1 year ago
parent
commit
c0b3bb1baa
3 changed files with 14 additions and 19 deletions
  1. +12
    -17
      Forums/Utilities/utilities.py
  2. +1
    -1
      MarketPlaces/DB_Connection/db_connection.py
  3. +1
    -1
      MarketPlaces/Initialization/markets_mining.py

+ 12
- 17
Forums/Utilities/utilities.py View File

@ -353,29 +353,24 @@ def encrypt_encode_image_to_base64(driver, xpath):
return None
def decode_decrypt_image_in_base64(html_content):
def decode_decrypt_image_in_base64(string_image):
soup = BeautifulSoup(html_content, 'html.parser')
for img_tag in soup.find_all('img'):
src_attr = img_tag.get('src')
try:
if src_attr and src_attr.startswith('data:image'):
base64_image = bytes(string_image, encoding='utf-8')
encrypted_image = base64.b64decode(base64_image)
decrypted_image = aes_decryption(encrypted_image)
try:
im = Image.open(io.BytesIO(decrypted_image))
im.show()
string_image = src_attr.split('base64,')[-1]
base64_image = bytes(string_image, encoding='utf-8')
encrypted_image = base64.b64decode(base64_image)
decrypted_image = aes_decryption(encrypted_image)
return decrypted_image
im = Image.open(io.BytesIO(decrypted_image))
im.show()
except Exception as e:
print(e)
pass
except Exception as e:
print(e)
pass
return None
def replace_image_sources(driver, html_content):


+ 1
- 1
MarketPlaces/DB_Connection/db_connection.py View File

@ -229,7 +229,7 @@ def create_vendor(cur, row, marketId):
recset = cur.fetchall()
decode_decrypt_image_in_base64(recset[0][5])
# decode_decrypt_image_in_base64(recset[0][5])
if (str(recset[0]['rating_vendor']) != str(row[2] if row[2] != '-1' else None) or # there was a change in the vendor information
str(recset[0]['successfultransactions_vendor']) != str(row[3] if row[3] != '-1' else None) or


+ 1
- 1
MarketPlaces/Initialization/markets_mining.py View File

@ -89,7 +89,7 @@ def opentor():
if __name__ == '__main__':
# opentor()
opentor()
mktsList = getMarkets()


Loading…
Cancel
Save