diff --git a/okr/migrations/0086_alter_youtubetrafficsource_source_type_and_more.py b/okr/migrations/0086_alter_youtubetrafficsource_source_type_and_more.py new file mode 100644 index 0000000..564206a --- /dev/null +++ b/okr/migrations/0086_alter_youtubetrafficsource_source_type_and_more.py @@ -0,0 +1,78 @@ +# Generated by Django 4.2.5 on 2024-01-25 11:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("okr", "0085_alter_tiktokdata_videos"), + ] + + operations = [ + migrations.AlterField( + model_name="youtubetrafficsource", + name="source_type", + field=models.CharField( + choices=[ + ("advertising", "Werbung"), + ("annotation", "Annotation"), + ("campaign_card", "Kampagnenkarte"), + ("end_screen", "Endscreen"), + ("ext_url", "Externe URL"), + ("no_link_embedded", "Kein Link (eingebettet)"), + ("no_link_other", "Kein Link (sonstiges)"), + ("notification", "Benachrichtigung"), + ("playlist", "Playlist"), + ("promoted", "Promoted"), + ("related_video", "Related"), + ("shorts", "Shorts"), + ("sound_page", "Soundpage"), + ("subscriber", "Abonnent*in"), + ("yt_channel", "Youtube-Kanal"), + ("yt_other_page", "Sonstige Youtube-Seite"), + ("yt_playlist_page", "Youtube Playlist-Seite"), + ("yt_search", "Youtube-Suche"), + ("hashtags", "Hashtags"), + ("shorts_content_links", "Shorts Content Links"), + ], + max_length=40, + verbose_name="Source Type", + ), + ), + migrations.AlterField( + model_name="youtubevideotrafficsource", + name="source_type", + field=models.CharField( + choices=[ + ("0: Direct or unknown", "Direct or unknown"), + ("1: YouTube advertising", "YouTube advertising"), + ("3: Browse features", "Browse features"), + ("4: YouTube channels", "YouTube channels"), + ("5: YouTube search", "YouTube search"), + ("7: Suggested videos", "Suggested videos"), + ("8: Other YouTube features", "Other YouTube features"), + ("9: External", "External"), + ("11: Video cards and annotations", "Video cards and annotations"), + ("14: Playlists", "Playlists"), + ("17: Notifications", "Notifications"), + ("18: Playlist pages", "Playlist pages"), + ( + "19: Programming from claimed content", + "Programming from claimed content", + ), + ("20: Interactive video endscreen", "Interactive video endscreen"), + ("23: Stories", "Stories"), + ("24: Shorts", "Shorts"), + ("25: Product Pages", "Product Pages"), + ("26: Hashtag Pages", "Hashtag Pages"), + ("27: Sound Pages", "Sound Pages"), + ("28: Live redirect", "Live redirect"), + ("30: Remixed video", "Remixed video"), + ("31: Vertical live feed", "Vertical live feed"), + ("32: Related video", "Related video"), + ], + max_length=40, + verbose_name="Source Type", + ), + ), + ] diff --git a/okr/models/youtube.py b/okr/models/youtube.py index 33782ae..5d7a1c8 100644 --- a/okr/models/youtube.py +++ b/okr/models/youtube.py @@ -178,6 +178,10 @@ class SourceType(models.TextChoices): YT_PLAYLIST_PAGE = "yt_playlist_page", "Youtube Playlist-Seite" YT_SEARCH = "yt_search", "Youtube-Suche" HASHTAGS = "hashtags", "Hashtags" + SHORTS_CONTENT_LINKS = ( + "shorts_content_links", + "Shorts Content Links", + ) # Not listed in docs, but in data youtube = models.ForeignKey( verbose_name="YouTube-Account", @@ -460,6 +464,10 @@ class SourceType(models.TextChoices): SOURCE_TYPE_25 = "25: Product Pages", "Product Pages" SOURCE_TYPE_26 = "26: Hashtag Pages", "Hashtag Pages" SOURCE_TYPE_27 = "27: Sound Pages", "Sound Pages" + SOURCE_TYPE_28 = "28: Live redirect", "Live redirect" + SOURCE_TYPE_30 = "30: Remixed video", "Remixed video" + SOURCE_TYPE_31 = "31: Vertical live feed", "Vertical live feed" + SOURCE_TYPE_32 = "32: Related video", "Related video" youtube_video = models.ForeignKey( verbose_name="YouTube-Video", diff --git a/okr/scrapers/insta/quintly.py b/okr/scrapers/insta/quintly.py index 9c0d927..d06ba64 100644 --- a/okr/scrapers/insta/quintly.py +++ b/okr/scrapers/insta/quintly.py @@ -73,6 +73,9 @@ def get_insta_insights( interval="daily", ) + if df_insta.empty or df_insta_insights.empty: + return pd.DataFrame() + df_insta.time = df_insta.time.str[:10] df_insta.time = df_insta.time.astype("str") df_insta_insights.time = df_insta_insights.time.str[:10] diff --git a/okr/scrapers/snapchat_shows/__init__.py b/okr/scrapers/snapchat_shows/__init__.py index 488bfca..8db79ce 100644 --- a/okr/scrapers/snapchat_shows/__init__.py +++ b/okr/scrapers/snapchat_shows/__init__.py @@ -98,7 +98,7 @@ def _scrape_insights_snapchat_show(start_date, snapchat_show): "unique_topsnap_views": row.uniqueTopsnapViews, "topsnap_views": row.topsnapViews, # Convert from percentage to fraction - "attachment_conversion": row.attachmentConversion / 100.0, + "attachment_conversion": (row.attachmentConversion or 0) / 100.0, "attachment_article_views": row.attachmentArticleViews, "attachment_video_views": row.attachmentVideoViews, "screenshots": row.screenshots,