Skip to content
Snippets Groups Projects
Commit 8984abb4 authored by Jan Eggers's avatar Jan Eggers
Browse files

Removed image from CSV

parent d357f0df
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ authors = [ ...@@ -10,7 +10,7 @@ authors = [
maintainers = [ maintainers = [
{name = "Jan Eggers", email = "jan.eggers@hr.de"}, {name = "Jan Eggers", email = "jan.eggers@hr.de"},
] ]
version = "0.2.3.2" # Neue Versionsnummern für pip-Update version = "0.2.3.3" # Neue Versionsnummern für pip-Update
description = "Bluesky- und Telegram-Konten auf KI-Inhalte checken" description = "Bluesky- und Telegram-Konten auf KI-Inhalte checken"
requires-python = ">=3.8" requires-python = ">=3.8"
dependencies = [ dependencies = [
......
...@@ -35,7 +35,7 @@ def tgc_profile(channel="telegram"): ...@@ -35,7 +35,7 @@ def tgc_profile(channel="telegram"):
dict with the keys dict with the keys
- 'channel' - 'channel'
- 'description' - 'description'
- 'image' (base64 des Profilbilds) und 'image_url' (URL des Profilbilds) # - 'image' (base64 des Profilbilds) und 'image_url' (URL des Profilbilds)
- 'subscribers' (Number) - 'subscribers' (Number)
- 'photos' (number) - 'photos' (number)
- 'videos' (number) - 'videos' (number)
...@@ -189,7 +189,7 @@ def tg_post_parse(b, save = True, describe = True): ...@@ -189,7 +189,7 @@ def tg_post_parse(b, save = True, describe = True):
if b.select_one("div.tgme_widget_message_sticker_wrap") is not None: if b.select_one("div.tgme_widget_message_sticker_wrap") is not None:
sticker_url = b.select_one("i.tgme_widget_message_sticker")['data-webp'] sticker_url = b.select_one("i.tgme_widget_message_sticker")['data-webp']
sticker = {'url': sticker_url, sticker = {'url': sticker_url,
'image': base64.b64encode(requests.get(sticker_url).content).decode('utf-8') # 'image': base64.b64encode(requests.get(sticker_url).content).decode('utf-8')
} }
if describe: if describe:
# GPT4o-mini versteht JPG, PNG, nicht animiertes GIF... und WEBP. # GPT4o-mini versteht JPG, PNG, nicht animiertes GIF... und WEBP.
...@@ -202,7 +202,7 @@ def tg_post_parse(b, save = True, describe = True): ...@@ -202,7 +202,7 @@ def tg_post_parse(b, save = True, describe = True):
if b.select_one("a.tgme_widget_message_photo_wrap") is not None: if b.select_one("a.tgme_widget_message_photo_wrap") is not None:
photo_url = re.search(r"(?<=image\:url\(\').+(?=\')", b.select_one("a.tgme_widget_message_photo_wrap")['style']).group(0) photo_url = re.search(r"(?<=image\:url\(\').+(?=\')", b.select_one("a.tgme_widget_message_photo_wrap")['style']).group(0)
photo = {'url': photo_url, photo = {'url': photo_url,
'image': base64.b64encode(requests.get(photo_url).content).decode('utf-8') # 'image': base64.b64encode(requests.get(photo_url).content).decode('utf-8')
} }
if describe: if describe:
photo['description'] = gpt4_description(f"data:image/jpeg;base64,{photo['image']}") photo['description'] = gpt4_description(f"data:image/jpeg;base64,{photo['image']}")
...@@ -240,7 +240,8 @@ def tg_post_parse(b, save = True, describe = True): ...@@ -240,7 +240,8 @@ def tg_post_parse(b, save = True, describe = True):
} }
photo = { photo = {
'url': video_thumbnail_url, 'url': video_thumbnail_url,
'image': base64.b64encode(requests.get(video_thumbnail_url).content).decode('utf-8') # Keine Bas64 aus Übersichtlichkeits-Gründen
#'image': base64.b64encode(requests.get(video_thumbnail_url).content).decode('utf-8')
} }
if save or describe: if save or describe:
# Thumbnail wird unter photo abgespeichert # Thumbnail wird unter photo abgespeichert
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment