Last active
November 6, 2024 06:20
-
-
Save Rust1667/e21e92ae385e71f0d87e869bed90fff2 to your computer and use it in GitHub Desktop.
Generate a markdown index with the guides found in FMHY - https://rentry.co/fmhy-guides
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fmhy-guides.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import base64 | |
import re | |
import requests | |
from bs4 import BeautifulSoup | |
if "GITHUB_ACTIONS" in os.environ: import rentry | |
corrected_titles = { | |
'Updates / To-do': 'Private trackers general', | |
'Explanation': 'VirusTotal on Colab', | |
'fs927': 'Make a Remux from a BluRay disc', | |
'--GUIDE--': 'Voldy Guide (Stable Diffusion)', | |
'SETUP': 'LoRA Guide for the impatient', | |
'GUIDES AND POST SETUP': 'Nintendo Guides', | |
'Step 1. Press win+g': 'Xbox Game Bar / WindowsFPS', | |
'To set Initial Details': 'Serem Free Harem Setup', | |
'WARNING: i copied almost all of this from : https://github.com/kmille36/Windows-11-VPS' : 'Windows 11 VPS', | |
'Probably all the available guides and 100% factual information we have about how Denuvo work and...': 'Denuvo Cracking Resources', | |
'Firefox install video - https://streamable\.com/nmu7ut': 'TTVLOL Install Video' | |
} | |
manual_add_list = [ | |
"https://ori5000.github.io/musicripping.html", | |
"https://switch.homebrew.guide/", | |
"https://imgur.com/gallery/02aYs" | |
] | |
link_blacklist = [ | |
"https://rentry.co/thk62", | |
"https://rentry.co/ccuz3", | |
"https://rentry.co/operagx", | |
"https://rentry.co/ue9qk", | |
"https://rentry.co/8kqrrn", | |
"https://rentry.org/cs3-repos", | |
"https://rentry.co/Audio-Players", | |
"https://rentry.co/o89dd", | |
"https://rentry.co/w54ys", | |
"https://rentry.co/VLC-skin", | |
"https://rentry.co/qnu6x", | |
"https://rentry.co/MovieRecs", | |
"https://rentry.co/OnlyFans420", | |
"https://rentry.co/OnlyFans421", | |
"https://rentry.org/OnlyFans420", | |
"https://rentry.org/OnlyFans421", | |
"https://rentry.co/batoto", | |
"https://rentry.co/manga-apis", | |
"https://rentry.co/i8dwr", | |
"https://rentry.co/upo2r", | |
"https://rentry.co/v92q6", | |
"https://rentry.org/dmd8", | |
"https://rentry.co/the-italian-corsairs", | |
"https://rentry.co/italian-piracy-resources", | |
"https://rentry.co/t29tz", | |
"https://rentry.co/ItalianStreamingImproved", | |
"https://rentry.co/rawmangaz", | |
"https://rentry.co/sn66v", | |
"https://rentry.co/streambase", | |
"https://rentry.org/PiracyBG-PTBR", | |
"https://rentry.org/PortuguesePiracySites", | |
"https://rentry.co/dt92f", | |
"https://rentry.co/nsq29", | |
"https://rentry.co/cozqr", | |
"https://rentry.co/astrill", | |
"https://rentry.co/k2vev", | |
"https://rentry.org/rrstango", | |
"https://rentry.co/tvrnw", | |
"https://rentry.co/zu3i6", | |
"https://rentry.co/qoobrepacker", | |
"https://rentry.co/2q3rn", | |
"https://telegra.ph/All-of-my-Channels-List-02-18", | |
"https://telegra.ph/CHto-delat-pri-otklyuchenii-interneta-02-27", | |
"https://telegra.ph/Websites-To-Watch-And-Download-Anime-09-10", | |
"https://telegra.ph/murglar-en-05-12", | |
"https://rentry.co/vin7x", | |
"https://telegra.ph/Websites-To-Watch-And-Download-Anime-09-10", | |
"https://rentry.co/smolOD", | |
"https://rentry.co/echlinkss", | |
"https://rentry.co/spotifyIPA", | |
"https://rentry.co/YTcrack", | |
"https://rentry.co/frapsfullfree", | |
"https://rentry.co/acestream-mod-apks", | |
"https://rentry.co/NinjaWarrior", | |
"https://rentry.org/FreeCoursesByXem", | |
"https://rentry.co/MB_Premium", | |
"https://rentry.co/sinflix", | |
"https://rentry.co/cool_websites", | |
"https://rentry.org/cool-stuff-i-found-on-the-internet", | |
"https://rentry.org/ducklink", | |
"https://rentry.co/e9y6b", | |
"https://rentry.co/89gads", | |
"https://rentry.co/course-collections", | |
"https://rentry.co/satreading", | |
"https://rentry.co/FSR", | |
"https://rentry.co/bgvyn", | |
"https://rentry.co/ProgrammingLearningResources", | |
"https://rentry.co/HTML5Temp", | |
"https://rentry.co/Heroku-Alt", | |
"https://rentry.co/PygmalionLinks", | |
"https://rentry.org/sdg-link", | |
"https://rentry.co/OnionDirectories", | |
"https://rentry.co/TouchGrasss", | |
"https://rentry.org/lmg-resources", | |
"https://telegra.ph/GDrive-Server-Direct-Links-06-28", | |
"https://rentry.org/pgames", | |
"https://rentry.co/ROM-Collections", | |
"https://rentry.co/qBitEndpoints", | |
"https://rentry.co/coom", | |
"https://rentry.co/fmhy-guides", | |
"https://rentry.co/Occult-Repo", | |
"https://rentry.co/megathread", | |
"https://rentry.org/megathread", | |
"https://rentry.co/filecr_malware", | |
"https://rentry.co/24ufx", | |
"https://rentry.org/ekrw4", | |
"https://rentry.org/xc48kg", | |
"https://rentry.org/LocalModelsPapers", | |
"https://rentry.org/qib8f", | |
"https://rentry.org/4viqf" | |
] | |
def extract_pastebin_links(text): | |
# Define a regular expression pattern to match rentry.co and rentry.org links | |
pattern_rentry = r'\(https:\/\/rentry\.(?:co|org)\/[a-zA-Z0-9\-_]+\)' | |
pattern_telegraph = r'\(https:\/\/telegra\.ph\/[a-zA-Z0-9\-_]+\)' | |
# Find all matches in the text using the pattern | |
matches_rentry = re.findall(pattern_rentry, text) | |
matches_telegraph = re.findall(pattern_telegraph, text) | |
matches = matches_rentry + matches_telegraph | |
# Remove the parentheses | |
links = [match[1:-1] for match in matches] | |
return links | |
def get_page_title(url): | |
try: | |
response = requests.get(url, timeout=10) | |
response.raise_for_status() | |
soup = BeautifulSoup(response.text, 'html.parser') | |
title_tag = soup.find('title') | |
return title_tag.text.strip() if title_tag else "Title not found" | |
except requests.exceptions.RequestException: | |
return "Error fetching title" | |
def download_raw_content(url): | |
print("\ndownloading from " + url + "...") | |
response = requests.get(url, timeout=10) | |
print("downloaded.\n") | |
return response.text | |
def get_main_wiki_pastebin_links(): | |
url = "https://raw.githubusercontent.com/nbats/FMHYedit/main/single-page" | |
text = download_raw_content(url) | |
pastebin_links = extract_pastebin_links(text) | |
return pastebin_links | |
def fix_base64_string(encoded_string): | |
missing_padding = len(encoded_string) % 4 | |
if missing_padding != 0: | |
encoded_string += '=' * (4 - missing_padding) | |
return encoded_string | |
def get_base64_pastebin_links(): | |
url = "https://raw.githubusercontent.com/fmhy/FMHYedit/main/base64.md" | |
content = download_raw_content(url) | |
decoded_content = "" | |
start = 0 | |
while True: | |
start = content.find("`", start) | |
if start == -1: | |
break | |
end = content.find("`", start + 1) | |
if end == -1: | |
break | |
encoded_string = content[start + 1:end] | |
try: | |
encoded_string = fix_base64_string(encoded_string) | |
decoded_bytes = base64.b64decode(encoded_string) | |
decoded_content += decoded_bytes.decode("utf-8") | |
except base64.binascii.Error: | |
decoded_content += f"`{encoded_string}`" | |
start = end + 1 | |
decoded_content = decoded_content.replace("http", "\nhttp") | |
links = [] | |
for line in decoded_content.split("\n"): | |
if re.search(r"(rentry\.co|rentry\.org|telegra\.ph)", line): | |
links.append(line) | |
return links | |
def remove_duplicates(strings): | |
unique_strings = {} | |
result = [] | |
for s in strings: | |
s_lower = s.lower() | |
if s_lower not in unique_strings: | |
unique_strings[s_lower] = True | |
result.append(s) | |
print("\nremoved " + str(len(strings) - len(result)) + " duplicates.") | |
return result | |
def fix_title(title): | |
if title in corrected_titles: | |
print("\nCorrecting title from <" + title + "> to <" + corrected_titles[title] + ">\n") | |
return corrected_titles[title] | |
else: | |
return title | |
def add_titles_to_links(link_list): | |
result_list = [] | |
for link in link_list: | |
title = get_page_title(link) | |
title = fix_title(title) | |
entry = f"* [{title}]({link})" | |
print(entry) | |
result_list.append(entry) | |
return result_list | |
def update_a_rentry(rentry_url, edit_code, new_content): | |
print(f"updating {rentry_url} rentry...") | |
response = rentry.edit(url=rentry_url, edit_code=edit_code, text=new_content) | |
if response['status'] != '200': | |
print('error: {}'.format(response['content'])) | |
try: | |
for i in response['errors'].split('.'): | |
i and print(i) | |
return False | |
except: | |
return False | |
else: | |
print('Ok') | |
return True | |
def get_md_page_from_list(list): | |
result_string = '\n'.join(list) | |
md_text = "# FMHY Guides\n\n" | |
md_text += str(len(list)) + " guides\n\n" | |
md_text += result_string | |
md_text += "\n\n!!!note More FMHY Guides using [search](https://fmhy-search.streamlit.app/?q=guide) / [2](https://fmhy.vercel.app/search?q=guide)" | |
md_text += "\n\n->*index generated with this [script](https://gist.github.com/Rust1667/e21e92ae385e71f0d87e869bed90fff2) *->" | |
return md_text | |
def filter_with_blacklist(input_list, blacklist): | |
return [item for item in input_list if not any(black_item in item for black_item in blacklist)] | |
def get_link_list(): | |
# Links from the main wiki | |
main_wiki_pastebin_links = get_main_wiki_pastebin_links() | |
main_wiki_pastebin_links = filter_with_blacklist(main_wiki_pastebin_links, link_blacklist) | |
print(str(len(main_wiki_pastebin_links)) + " links") | |
for link in main_wiki_pastebin_links: print(link) | |
# Links from base64 | |
base64_pastebin_links = get_base64_pastebin_links() | |
base64_pastebin_links = filter_with_blacklist(base64_pastebin_links, link_blacklist) | |
print(str(len(base64_pastebin_links)) + " links") | |
for link in base64_pastebin_links: print(link) | |
# Join lists, remove duplicates, count total | |
links = main_wiki_pastebin_links + base64_pastebin_links + manual_add_list | |
links = remove_duplicates(links) | |
print("\n\n" + str(len(links)) + " links total\n\n") | |
# Add titles | |
links = add_titles_to_links(links) | |
return links | |
def save_links_to_rentry(links): | |
md_string = get_md_page_from_list(links) | |
my_edit_code = os.environ.get('RENTRY_GUIDES_EDIT_CODE') | |
update_a_rentry("fmhy-guides", my_edit_code, md_string) | |
def save_string_to_text_file(string, file_path): | |
with open(file_path, "w", encoding='utf-8') as f: | |
f.write(string) | |
print(f"Result saved to {file_path}") | |
def save_list_to_text_file(list): | |
result_string = '\n'.join(list) | |
md_text = "# FMHY Guides\n\n" | |
md_text += str(len(list)) + " guides\n\n" | |
md_text += result_string | |
md_text += "\n\n!!!note More FMHY Guides using [search](https://fmhy-search.streamlit.app/?q=guide)" | |
md_text += "\n\n->*index generated with this [script](https://gist.github.com/Rust1667/e21e92ae385e71f0d87e869bed90fff2) *->" | |
save_string_to_text_file(md_text, "fmhy-guides.md") | |
def main(): | |
links = get_link_list() | |
if "GITHUB_ACTIONS" in os.environ: | |
print("Editing rentry...") | |
save_links_to_rentry(links) | |
else: | |
print("Saving to local file...") | |
save_list_to_text_file(links) | |
if __name__ == "__main__": | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/get-fmhy-guides-github-gist/ && python3 ./get-fmhy-guides.py && cat ./fmhy-guides.md | rentry edit -p <password> -u fmhy-guides |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
edited