'''

import streamlit as st
import pandas as pd
import requests
import json
from PIL import Image
from io import BytesIO
from itertools import groupby
import instaloader
import datetime
import altair as alt

loader = instaloader.Instaloader()

# For login
username = ""
password = ""
loader.context.login(username, password) # Login

loader.context.request_timeout = (9, 15)  # Increase request timeout
access_token = ""
account_id = ""

def load_media_info(access_token, account_id):
    base_url = f"https://graph.facebook.com/v11.0/{account_id}/media"
    params = {
        "fields": "id,media_type,media_url,thumbnail_url,permalink,caption,timestamp,like_count,comments_count,insights.metric(impressions,reach,engagement)",
        "access_token": access_token
    }

    items = []
    while base_url:
        response = requests.get(base_url, params=params)
        data = json.loads(response.text)

        items.extend(data["data"])

        if "paging" in data and "next" in data["paging"]:
            base_url = data["paging"]["next"]
            params = {}
        else:
            base_url = None

    return pd.DataFrame(items)

df = load_media_info(access_token, account_id)
if 'thumbnail_url' not in df.columns:
    df['thumbnail_url'] = df['media_url']
df['thumbnail_url'] = df.apply(lambda x: x["media_url"] if x["media_type"] == "IMAGE" else x["thumbnail_url"], axis=1)

df["id"] = df["timestamp"]
df["id"] = df["id"].apply(lambda x: datetime.datetime.strptime(x.split("+")[0], "%Y-%m-%dT%H:%M:%S").strftime("%Y%m%d"))

df = df.sort_values("timestamp", ascending=False)
df["id_rank"] = [f"_{len(list(group))}" for _, group in groupby(df["id"])]
df["id"] += df["id_rank"]

menu = ["Content", "Analytics"]
choice = st.sidebar.radio("Menu", menu)

def process_caption(caption):
    description_start = 0
    description_end = len(caption)
    if "Description:" in caption:
        description_start = caption.find("Description:") + len("Description:")
    if "Tags:" in caption:
        description_end = caption.find("Tags:")
    caption = caption[description_start:description_end].strip()
    return caption

if choice == "Content":
    selected_id = st.sidebar.selectbox("Select Post", df["id"].unique())
    selected_data = df[df["id"] == selected_id].iloc[0]
    image_url = selected_data["media_url"] if selected_data["media_type"] == "IMAGE" else selected_data["thumbnail_url"]
    image_response = requests.get(image_url)
    image = Image.open(BytesIO(image_response.content))

    caption = process_caption(selected_data['caption'])
    st.image(image, caption=caption, width=300)

    likes = selected_data["like_count"]
    
    try:
        insights = selected_data['insights']
    except KeyError:
        impressions = 0
    else:
        try:
            impressions = insights[0]['values'][0]['value']
        except (KeyError, IndexError):
            impressions = 0

    if impressions != 0:
        percentage = (likes * 100) / impressions
        st.write(f"いいね: {likes} (インプレッションに対する割合: {percentage:.1f}%)")
    else:
        st.write(f"いいね: {likes}")

    st.write(f"コメント数: {selected_data['comments_count']}")

    # Get comments and usernames
    try:
        shortcode = selected_data["permalink"].split("/")[-2]
        post = instaloader.Post.from_shortcode(loader.context, shortcode)
        comments = post.get_comments

'''

上記コードにてJupyter開発環境ではエラー表示はなく、streamlitで表示された事を確認できました。しかし、期待された表示がされていない箇所があるため、以下に改修点を列挙します。

①いまだにコンテンツに対する"いいね率"の表示が正常にされておりません。抜本的な対処も含めて改修したコード全体を表示してください。

②"Content"の説明文について、[Description]の前の文字列と、[Tags]を含むそれ以降の文字列を表示させない機能が動作していない。
これらの機能が正常に動作するよう修正済みのコードを省略せずにすべて表示してください。