xin88

Cổng game hàng đầu!

Logo Xin88
```python import json def generate_html_content(main_game_json_str, related_games_json_str, original_html_template): main_game_data = json.loads(main_game_json_str) related_games_data = json.loads(related_games_json_str) def process_game_name_for_display(raw_name): name = raw_name if name.startswith("xin88 "): name = name[len("xin88 "):] # Remove suffixes like _portrait or _landscape suffixes_to_remove = ["_portrait", "_landscape"] for suffix in suffixes_to_remove: if name.endswith(suffix): name = name[:-len(suffix)] break # Assume only one such suffix name = name.replace("_", " ") return " ".join(word.capitalize() for word in name.split()) processed_main_game_name = process_game_name_for_display(main_game_data['game_name']) # Prepare main game data for insertion main_image_src = main_game_data['game_image'] main_image_alt = processed_main_game_name main_h1_text = processed_main_game_name main_p_text = main_game_data['game_desc'] reels = main_game_data['Reels'] rows = main_game_data['Rows'] paylines = main_game_data['Paylines'] hit_freq = main_game_data['Hit_Freq'] free_spins_freq = main_game_data['Free_Spins_Freq'] max_win = main_game_data['Max_Win'] max_win_prob = main_game_data['Max_Win_Probability'] volatility = main_game_data['Volatility'] min_max_bet = main_game_data['Min_Max_Bet'] release_date = main_game_data['Release_Date'] # Generate HTML for related games related_games_html_parts = [] for game in related_games_data: processed_related_game_name = process_game_name_for_display(game['game_name']) raw_related_game_name = game['game_name'] # For the title attribute # Ensure alt and title attributes are properly escaped if they contain quotes, though not expected here. # Python's f-string handles standard characters well. part = f"""
{processed_related_game_name}

{processed_related_game_name}

""" related_games_html_parts.append(part) related_games_html_block = "".join(related_games_html_parts) # Fill the template # This approach uses direct string replacement on the provided HTML structure. # A more robust method for complex HTML would be using a template engine or DOM parser, # but for this specific request, string replacement is feasible if markers are unique. # Replacing image src and alt output_html = original_html_template.replace( 'src="https://img.xin88link.com/myimgweb/uploads/images/20250530/6839765d562b1.jpg"', f'src="{main_image_src}"' ).replace( 'alt="xin88 Blue Diamond"', f'alt="{main_image_alt}"' ) # Replacing H1 output_html = output_html.replace( '

xin88 Blue Diamond

', f'

{main_h1_text}

' ) # Replacing P output_html = output_html.replace( '

Trải nghiệm game tại xin88 com, khám phá thêm tại xin88 me.

', f'

{main_p_text}

' ) # Replacing stats # It's safer to replace the specific values within the spans output_html = output_html.replace( '5', f'{reels}' ).replace( '3', f'{rows}' ).replace( '20', f'{paylines}' ).replace( '28%', f'{hit_freq}' ).replace( '1 trong 120 vòng', f'{free_spins_freq}' ).replace( 'x3000 lần cược', f'{max_win}' ).replace( '1 trên 5,000,000', f'{max_win_prob}' ).replace( 'Trung bình', # Assuming 'Trung bình' is unique enough or the first one is targeted f'{volatility}', 1 # Replace only the first occurrence for Volatility ).replace( # If Volatility and Min_Max_Bet values are the same, this could be an issue. Let's use more specific original values. # Let's re-do stats replacement to be more robust by targeting the full original list item string for the value part. # This is still fragile if text-sm text-gray-500 changes. # Original:
  • Biến động:Trung bình
  • # The above replacement for Volatility is okay if "Trung bình" is the value for Volatility in original. # Original:
  • Cược Tối thiểu/Tối đa:0.2 - 100 đơn vị
  • # Original:
  • Ngày phát hành:30/05/2025
  • # The list of replacements needs to be sequential and careful. # This is where a DOM parser would be much better. # For now, assuming the original values are fixed as per the prompt. # Let's make the replacements more specific: 'Biến động:Trung bình', f'Biến động:{volatility}' ).replace( 'Cược Tối thiểu/Tối đa:0.2 - 100 đơn vị', f'Cược Tối thiểu/Tối đa:{min_max_bet}' ).replace( 'Ngày phát hành:30/05/2025', f'Ngày phát hành:{release_date}' ) # Replacing the related games block # Find the start and end of the original related games block to replace its content original_related_games_block_start_marker = '
    ' original_related_games_block_end_marker = '
    \n
    \n \n \n' # This is specific to the structure provided. # A more robust way is to find the content between
    and its corresponding
    # For simplicity with string replacement, if the original content is known: original_related_items_content = """
    B52 Lien Minh Huyen Thoai

    B52 Lien Minh Huyen Thoai

    B52 Mien Vien Tay

    B52 Mien Vien Tay

    """ # Ensure correct indentation for the new block if replacing inside a multi-line string structure # The new block is `related_games_html_block`. We need to place it correctly. # The structure is
    \n {content} \n
    # So, indent `related_games_html_block` or ensure it naturally fits. # My `part` generator adds newlines internally for each item. # `related_games_html_block` will be a string of HTML items. # A more robust replacement for the related content: start_index = output_html.find(original_related_games_block_start_marker) if start_index != -1: # Find the end of this div block. It's the that matches the grid. # This requires careful counting or knowledge of the structure. # The original content is inside
    ...content...
    # The original example has specific content. Let's replace that specific content. output_html = output_html.replace(original_related_items_content, related_games_html_block) else: # Fallback or error if marker not found - for now, assume it's found. pass return output_html original_html = """
    xin88 Blue Diamond

    xin88 Blue Diamond

    Trải nghiệm game tại xin88 com, khám phá thêm tại xin88 me.

    Thông số trò chơi

    • Guồng quay:5
    • Hàng:3
    • Đường thắng:20
    • Tần suất trúng:28%
    • Tần suất Vòng quay miễn phí:1 trong 120 vòng
    • Thắng tối đa:x3000 lần cược
    • Xác suất thắng tối đa:1 trên 5,000,000
    • Biến động:Trung bình
    • Cược Tối thiểu/Tối đa:0.2 - 100 đơn vị
    • Ngày phát hành:30/05/2025
    """ main_game_json = '{"game_name":"xin88 b52_mien_vien_tay_portrait","game_desc":"Đặt cược uy tín với xin88 bet, truy cập ngay xin88 link.","game_image":"https://img.xin88link.com/myimgweb/uploads/images/20250603/683e9b6cea507.avif","link":"b52mienvientayportrait.html","Reels":5,"Rows":3,"Paylines":25,"Hit_Freq":"27%","Free_Spins_Freq":"1 trong 130 vòng","Max_Win":"x2500 lần cược","Max_Win_Probability":"1 trên 3,000,000","Volatility":"Trung bình","Min_Max_Bet":"0.2 - 100 đơn vị","Release_Date":"03/06/2025"}' related_games_json = '[{"game_name":"xin88 b52_xoc_dia_livestream_portrait","game_desc":"Đặt cược uy tín với xin88 bet, truy cập ngay xin88 link.","game_image":"https://img.xin88link.com/myimgweb/uploads/images/20250603/683e96450b1c7.avif","link":"b52xocdialivestreamportrait.html","Reels":1,"Rows":1,"Paylines":1,"Hit_Freq":"45%","Free_Spins_Freq":"Không áp dụng","Max_Win":"x8 lần cược","Max_Win_Probability":"Thay đổi","Volatility":"Thấp","Min_Max_Bet":"1 - 1000 đơn vị","Release_Date":"03/06/2025"},{"game_name":"xin88 b52_mien_vien_tay_portrait","game_desc":"Đặt cược uy tín với xin88 bet, truy cập ngay xin88 link.","game_image":"https://img.xin88link.com/myimgweb/uploads/images/20250603/683e9b6cea507.avif","link":"b52mienvientayportrait.html","Reels":5,"Rows":3,"Paylines":25,"Hit_Freq":"27%","Free_Spins_Freq":"1 trong 130 vòng","Max_Win":"x2500 lần cược","Max_Win_Probability":"1 trên 3,000,000","Volatility":"Trung bình","Min_Max_Bet":"0.2 - 100 đơn vị","Release_Date":"03/06/2025"}]' # Call the function and print the result # The Python script itself won't be part of the output, only its result. # For the final output, I will just output the resulting HTML string. final_html = generate_html_content(main_game_json, related_games_json, original_html) print(final_html) ``` Biểu tượng phúc lợi Xin88