#clean files removetrash () { rm *.txt *.temp *.html ; rm -d -rf *\(temp\)* rm A B C D E F G H I J K L M N O P Q R S T U V W X Y Z } #clean removetrash #get stories curl "https://www.cyoc.net/interactives/story_index.html" | grep -Po '(?<=href=")[^"]*(?<=/outline.html)[^"]*(?=")' > 01-chapters-00.txt #data preparatator A=$(cat "01-chapters-00.txt") B=$(cat "01-chapters-00.txt" | sed -e 's#.*[a-zA-Z0-9].*# dir=cyoc-outline(temp)#') C=$(cat "01-chapters-00.txt" | sed -e 's#.*/interactives/# out=#g' -e 's#/outline.html#.html#' ) paste -d'\n' <(echo "$A") <(echo "$B") <(echo "$C") > 01-chapters-01.txt #dowload file for i in {1..3}; do :; aria2c -i 01-chapters-01.txt -x1 -j1 --save-session=01-chapters-01.temp ; mv 01-chapters-01.temp 01-chapters-01.txt ; done #add to archive zip -j -r -D "cyoc-outline.zip" "cyoc-outline(temp)/"* #create index python3 << 'EOF' import os import csv import re from bs4 import BeautifulSoup from urllib.parse import urljoin BASE_URL = "https://www.cyoc.net" def parse_tree_iterative(root_ul, file_path, base_url=BASE_URL, verbose=False): stack = [(root_ul, [], 0)] chapters = [] while stack: ul_tag, path, depth = stack.pop() for i, li in enumerate(ul_tag.find_all('li', recursive=False)): chapter_path = path + [str(i + 1)] path_string = "-".join(chapter_path) a_tag = li.find('a', recursive=False) if a_tag: title = a_tag.get_text(strip=True) or "N/A" full_url = urljoin(base_url+'/', a_tag.get('href','')) li_text = li.get_text(strip=True) match = re.search(r'Ch\s*(\d+)', li_text) chapter_number = match.group(1) if match else "N/A" author_name, author_url = "Anonymous", "" author_a_tag = li.find('a', href=re.compile(r'/user_')) if author_a_tag: author_name = author_a_tag.get_text(strip=True) or "Anonymous" author_url = urljoin(base_url+'/', author_a_tag.get('href','')) chapters.append({ 'filename': os.path.basename(file_path), 'chapter_number': chapter_number, 'story_title': title, 'history_path': path_string, 'url': full_url, 'author_name': author_name, 'author_url': author_url }) nested_ul = li.find('ul', recursive=False) if nested_ul: if verbose: print(f"Adding nested