|
| 1 | +# Title: |
| 2 | +print(""" |
| 3 | +
|
| 4 | +___ ___ _ _____ _ ______ _ __ __ |
| 5 | +| \/ | | | |_ _| | | | ___| | | / | / | |
| 6 | +| . . | ___ __ _ __ _| | | | _ __ | | _____ | |_ ___ _ __ _ __ ___ __ _| |_ ___ _ __ __ __`| | `| | |
| 7 | +| |\/| |/ _ \/ _` |/ _` | | | || '_ \| |/ / __| | _/ _ \| '__| '_ ` _ \ / _` | __/ _ \ '__| \ \ / / | | | | |
| 8 | +| | | | __/ (_| | (_| | |____| || | | | <\__ \ | || (_) | | | | | | | | (_| | || __/ | \ V / _| |___| |_ |
| 9 | +\_| |_/\___|\__, |\__,_\_____|___/_| |_|_|\_\___/ \_| \___/|_| |_| |_| |_|\__,_|\__\___|_| \_/ \___(_)___/ |
| 10 | + __/ | |
| 11 | + |___/ |
| 12 | +
|
| 13 | +""") |
| 14 | + |
| 15 | +print(" Created with love by MaxUnch\n") |
| 16 | + |
| 17 | +input(" |--[Press Enter to begin the process]--|") |
| 18 | + |
| 19 | + |
| 20 | +# Opening the file in only-read mode: |
| 21 | +try: |
| 22 | + fileR = open("NewMegaLinks.txt", "r") |
| 23 | + # Save the content readed line by line: |
| 24 | + txtReaded = fileR.readlines() |
| 25 | +finally: |
| 26 | + fileR.close() |
| 27 | +# ----------------------------------------------------------------------------- |
| 28 | +# OlD Links: |
| 29 | +print("\n [NEW MEGA LINKS FORMAT]\n") |
| 30 | +# Read line by line to format: |
| 31 | +x = 0 |
| 32 | +s = 0 |
| 33 | +for link in txtReaded: |
| 34 | + if "/file/" in link: |
| 35 | + print(link) |
| 36 | + x += 1 |
| 37 | + elif "/folder/" in link: |
| 38 | + print(link) |
| 39 | + x += 1 |
| 40 | + else: |
| 41 | + print("*-Invalid Format-*\n") |
| 42 | + s += 1 |
| 43 | +# Count the number of links found: |
| 44 | +print(f"\n### {s} invalid link/s and {x} valid link/s have been found ###") |
| 45 | +# ----------------------------------------------------------------------------- |
| 46 | +# NEW Links: |
| 47 | +print("\n [OLD MEGA LINKS FORMAT]\n") |
| 48 | +# Formating link by link: |
| 49 | +y = 0 |
| 50 | +z = 0 |
| 51 | +saveLines = [] |
| 52 | +for line in txtReaded: |
| 53 | + if "/file/" in line: |
| 54 | + megaReplace1 = line.replace("#", "!") |
| 55 | + megaReplace2 = megaReplace1.replace("/file/", "/#f!") |
| 56 | + print(megaReplace2) |
| 57 | + saveLines.insert(y, megaReplace2) |
| 58 | + y += 1 |
| 59 | + elif "/folder/" in line: |
| 60 | + megaReplace1 = line.replace("#", "!") |
| 61 | + megaReplace2 = megaReplace1.replace("/folder/", "/#F!") |
| 62 | + print(megaReplace2) |
| 63 | + saveLines.insert(y, megaReplace2) |
| 64 | + y += 1 |
| 65 | + else: |
| 66 | + print("*-Invalid Format-*\n") |
| 67 | + z += 1 |
| 68 | +# Count the number of links formatted: |
| 69 | +print(f"\n### {z} invalid link/s and {y} valid link/s have been formatted ###\n") |
| 70 | +# ----------------------------------------------------------------------------- |
| 71 | +# Verify the txt. file to write results: |
| 72 | +try: |
| 73 | + fileW = open("OldMegaLinks.txt", "w") |
| 74 | + for writeLine in saveLines: |
| 75 | + fileW.write(writeLine + "\n") |
| 76 | +finally: |
| 77 | + fileW.close() |
| 78 | +print("### ALL DONE ###") |
| 79 | +input("\n |--[Press Enter to Finish]--|") |
0 commit comments