Skip to content

Commit

Permalink
🔀 Merge pull request #164 from wdr-data/main
Browse files Browse the repository at this point in the history
Prod merge: More bugfixes
  • Loading branch information
jh0ker authored Jan 29, 2024
2 parents 16024a8 + 15e3aea commit d240842
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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",
),
),
]
8 changes: 8 additions & 0 deletions okr/models/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions okr/scrapers/insta/quintly.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion okr/scrapers/snapchat_shows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d240842

Please sign in to comment.