# Read the content of the text file

file_path = 'C:/Users/viral/Documents/play store apps batch 1/'+mytitle+'.txt'  # Replace with the actual file path
with open(file_path, 'r', encoding='utf-8') as file:
    text_content = file.read()

# Replace this with your Bitly link
bitly_link = 'https://bit.ly/your_bitly_link'

# Regular expression pattern to match lines containing Play Store links
pattern = r'(.*https://play\.google\.com/store/apps/details\?id=([^\s]+))'

# Find all matches and process them
matches = re.findall(pattern, text_content)
for match in matches:
    original_line = match[0]
    play_store_link = match[1]
    app_name = original_line.split(':-')[0].strip()  # Extract app name from the line
    modified_app_name = re.sub(r'[^\w\s]', '', app_name).replace(' ', '_').replace('__', '_')  # Modify the app name
    new_link = f'{bitly_link}?{modified_app_name}'  # Create the new link with the modified app name

    # Replace the original line with the new format
    modified_line = f'{app_name}:-  {new_link}'
    text_content = text_content.replace(original_line, modified_line)

print(text_content)

0 comments:

Post a Comment

 
Top