CyberCode Academy

CyberCode Academy

Welcome to CyberCode Academy — your audio classroom for Programming and Cybersecurity. 🎧 Each course is divided into a series of short, focused episodes that take you from beginner to advanced level — one lesson at a time. From Python and web development to ethical hacking and digital defense, our content transforms complex concepts into simple, engaging audio learning. Study anywhere, anytime — and level up your skills with CyberCode Academy. 🚀 Learn. Code. Secure. You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

  1. לפני 11 שע׳

    Course 40 - Web Scraping with Python | Episode 24: Mastering Advanced Operations, Parsers, and Encodings in Beautiful Soup

    In this lesson, you’ll learn about: optimizing Beautiful Soup for speed and memory, handling encodings safely, managing tags precisely, and controlling how your final HTML output is generated1. Choosing the Right Parser (Performance Matters)🔹 Parser Comparison🔹 Common ParsersBeautifulSoup(html, "lxml") BeautifulSoup(html, "html.parser") BeautifulSoup(html, "html5lib") 🔹 Differences lxml → fastest, tolerant of broken HTMLhtml.parser → built-in, moderate speedhtml5lib → most accurate (browser-like), slowest👉 Key Insight Use lxml for speed, html5lib for accuracy2. Selective Parsing with SoupStrainer🔹 Parse Only What You Need🔹 Examplefrom bs4 import SoupStrainer only_links = SoupStrainer("a") soup = BeautifulSoup(html, "lxml", parse_only=only_links) 👉 Key Insight Avoid parsing the whole document → save memory + increase speed3. Handling Encodings & Unicode🔹 Clean Text Across Languages🔹 Automatic Handling Converts everything to Unicode internallyDetects encoding via 🔹 Manual Fixsoup = BeautifulSoup(html, "lxml", from_encoding="utf-8") 👉 Key Insight Wrong encoding = broken text (especially non-English content)4. Tag Comparison & Copying🔹 Understanding Equality🔹 Structural vs Memory Equalitytag1 == tag2 # same structure tag1 is tag2 # same object in memory 🔹 Copying Tagsimport copy new_tag = copy.copy(tag) 👉 Key Insight Copy tags when modifying → avoid breaking original data5. Output Formatting Control🔹 Converting Back to HTML🔹 Basic Outputstr(soup) 🔹 Custom Formatterdef upper(text): return text.upper() soup.prettify(formatter=upper) 🔹 Formatter Options "html" → standard HTML"html5" → HTML5-compliantCustom function → full control👉 Key Insight You control how scraped data is presented and transformed6. Mental ModelThink of advanced scraping optimization as: ⚡ Parser → speed vs accuracy🎯 SoupStrainer → efficiency🌍 Encoding → correctness🧠 Tag handling → safety🧾 Output → final polishFinal TakeawayAt this level, scraping becomes engineering-grade data processing.You are not just extracting data—you are: Optimizing performancePreserving data integritySafely manipulating structuresProducing clean, standardized output👉 This is what transforms scraping into a reliable, production-ready pipeline You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

    Course 40 - Web Scraping with Python | Episode 24: Mastering Advanced Operations, Parsers, and Encodings in Beautiful Soup
  2. לפני יום אחד (1)

    Course 40 - Web Scraping with Python | Episode 23: Mastering HTML Parse Tree Modification with Beautiful Soup

    In this lesson, you’ll learn about: how to edit, expand, and restructure HTML using Beautiful Soup—turning a static document into a fully dynamic, modifiable data structure1. Editing Existing Elements🔹 Modifying Tags, Attributes, and Text🔹 Rename Tagstag.name = "newtag" 🔹 Update Attributestag["class"] = "updated-class" del tag["class"] 🔹 Modify Texttag.string = "Updated text" 👉 Key Insight Every HTML element is mutable—you can fully rewrite it2. Adding New Content🔹 Expanding the Tree🔹 Append & Extendtag.append("New text") tag.extend(["More text", "Another"]) 🔹 Insert at Positiontag.insert(1, "Inserted text") 🔹 Insert Around Elementstag.insert_before("Before") tag.insert_after("After") 👉 Key Insight You control where new content appears (inside or beside elements)3. Creating New Elements🔹 Building from Scratch🔹 Create New Tagnew_tag = soup.new_tag("div") 🔹 Create Text Nodefrom bs4 import NavigableString text = NavigableString("Hello") 🔹 Create Commentfrom bs4 import Comment comment = Comment("This is a comment") 👉 Key Insight You’re not limited to existing HTML—you can generate entirely new structures4. Removing Elements🔹 Deleting vs Extracting🔹 Extract (Keep in Memory)removed = tag.extract() 🔹 Decompose (Destroy Completely)tag.decompose() 🔹 Clear Content Onlytag.clear() 👉 Key Insight extract() → temporary removaldecompose() → permanent deletion5. Structural Refactoring🔹 Changing the Tree Layout🔹 Replace Elementstag.replace_with(new_tag) 🔹 Wrap Elementstag.wrap(soup.new_tag("div")) 🔹 Unwrap Elementstag.unwrap() 👉 Key Insight You can reshape the entire hierarchy, not just edit nodes6. Saving the Modified HTMLwith open("output.html", "w") as f: f.write(str(soup)) 👉 Key Insight After modification, your parsed tree becomes a new document7. Mental ModelThink of Beautiful Soup as: ✏️ Editor → modify elements➕ Builder → add new nodes❌ Cleaner → remove unwanted data🔄 Architect → restructure layoutFinal TakeawayAt this stage, Beautiful Soup is no longer just a scraping tool—it becomes a full HTML transformation engine.You can: Edit existing dataInject new structuresRemove unwanted elementsRedesign the entire document👉 This is what enables automation pipelines, data cleaning systems, and dynamic content generation from raw HTML You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

    Course 40 - Web Scraping with Python | Episode 23: Mastering HTML Parse Tree Modification with Beautiful Soup
  3. לפני יומיים (2)

    Course 40 - Web Scraping with Python | Episode 22: Mastering Tree Traversal, CSS Selectors, and XPath

    In this lesson, you’ll learn about: precision data extraction using advanced tree traversal, powerful CSS selectors, and XPath navigation for handling even the most complex web structures1. Advanced Tree Traversal (Beyond Basics)🔹 Navigating the HTML “Family Tree”Instead of just searching, you move through the structure intelligently.🔹 Key Navigation Methodstag.find_parent() tag.find_next_sibling() tag.find_next() tag.find_all_next() 🔹 What Each Does find_parent() → move upwardfind_next_sibling() → next element at same levelfind_next() → next matching element anywhere afterfind_all_next() → all matches after current point👉 Key Insight Traversal lets you start anywhere and still reach your target2. CSS Selectors (Soup Sieve Power)🔹 Modern, Flexible SelectionBeautiful Soup supports CSS selectors via Soup Sieve.🔹 Basic Syntaxsoup.select("div.classname") soup.select("#main") soup.select("ul > li") 🔹 Selector Types #id → specific element.class → group of elementsA > B → direct children onlyA B → any nested descendants🔹 Sibling Selectorssoup.select("h2 + p") # next sibling soup.select("h2 ~ p") # all following siblings 👉 Key Insight CSS selectors are often cleaner and more readable than manual navigation3. Attribute Matching in CSS🔹 Targeting Dynamic Datasoup.select('a[href^="https"]') soup.select('img[src$=".png"]') soup.select('a[href*="example"]') 🔹 Matching Types ^= → starts with$= → ends with*= → contains👉 Key Insight Perfect for scraping dynamic or partially known values4. XPath Navigation (Precision Mode)🔹 Path-Based TargetingXPath works like navigating folders:🔹 Examples# Absolute path /html/body/div[1]/a # Global search //a # Attribute filtering //a[@href="example.com"] # Indexing (//a)[1] 🔹 Key Features Navigate from root or anywhereFilter by attributesSelect exact index👉 Key Insight XPath is the most precise but strict method5. CSS vs XPath vs TraversalMethodStrengthBest UseTraversalFlexibleDynamic navigationCSS SelectorsReadableMost scraping tasksXPathPreciseComplex structures6. Combining Techniques🔹 Real Power Comes from MixingExample workflow: Start with CSS selectorNavigate with traversalRefine with XPath👉 Key Insight No single method is enough for all cases7. Mental ModelThink like this: 🧭 Traversal → move through structure🎯 CSS → quickly target patterns🔬 XPath → pinpoint exact elementsFinal TakeawayAt this level, scraping becomes surgical precision engineering.You are no longer guessing where data is—you are: Navigating directly to itSelecting it with intentExtracting it efficiently👉 With traversal + CSS + XPath, you can handle any web structure, no matter how complex You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

    Course 40 - Web Scraping with Python | Episode 22: Mastering Tree Traversal, CSS Selectors, and XPath
  4. לפני 3 ימים

    Course 40 - Web Scraping with Python | Episode 21: Mastering XML Parsing and Advanced Search with Beautiful Soup and XPath

    In this lesson, you’ll learn about: how XML and XPath enable precise data navigation, and how to use advanced Beautiful Soup techniques for highly targeted extraction from complex documents1. XML as a Data Structure🔹 Why XML Matters🔹 Key Characteristics Designed for data transfer, not displayStrict and well-formedHighly structured and predictable👉 Key Insight XML is ideal for scraping because its structure is consistent and machine-friendly2. Parsing XML with LXML🔹 Turning XML into a Treefrom bs4 import BeautifulSoup soup = BeautifulSoup(xml_data, "xml") 🔹 Why Use LXML Fast parsingHandles large structured dataWorks seamlessly with XPath3. XPath: Precision Navigation🔹 Query Language for TreesXPath works like a file system path:# Example concept /html/body/div[1]/a 🔹 What XPath Can Do Select nodes by locationFilter by attributesNavigate deep hierarchies👉 Key Insight XPath gives you surgical precision in large documents4. Limiting Search Results🔹 Control Output Sizesoup.find_all("item", limit=5) Returns only first N matches👉 Why It Matters Improves performanceUseful for testing and sampling5. Controlling Search Depth🔹 Recursive vs Non-Recursivesoup.find_all("div", recursive=False) True (default) → searches entire subtreeFalse → only direct children👉 Key Insight Restricting depth = faster + more accurate queries6. Handling Custom Attributes🔹 Attributes with Special Namessoup.find_all(attrs={"extra-info": "value"}) 🔹 Why This Matters Handles data-* and hyphenated attributesAvoids Python keyword conflicts👉 Key Insight attrs unlocks full flexibility in attribute filtering7. Text-Based Extraction🔹 Targeting Content Directlysoup.find_all(string="Example Text") 🔹 Pattern Matchingimport re soup.find_all(string=re.compile("Example")) 👉 Key Insight You can search by content, not just structure8. Custom Function Filters🔹 Complex Logic Extractiondef single_text_child(tag): return tag.string is not None soup.find_all(single_text_child) 👉 Why This Is Powerful Enables advanced conditionsFully customizable filtering9. Combining Techniques (Real Power)🔹 Full Precision ExtractionYou can combine: XPath for structurefind_all() for discoveryAttribute filtersText filtersCustom logic10. Mental ModelThink of advanced parsing as: 🧭 XPath → exact location🔍 BeautifulSoup → flexible search🧠 Filters → smart decision logicFinal TakeawayAt this stage, scraping becomes precision engineering rather than simple extraction.You are now able to: Navigate deeply nested structuresControl search scope and performanceExtract exactly what you need with minimal noise👉 This is what separates basic scraping from professional-grade data parsing You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

    Course 40 - Web Scraping with Python | Episode 21: Mastering XML Parsing and Advanced Search with Beautiful Soup and XPath
  5. לפני 5 ימים

    Course 40 - Web Scraping with Python | Episode 20: XPath Fundamentals and Advanced Beautiful Soup Searching

    In this lesson, you’ll learn about: how Beautiful Soup works with both HTML and XML, how XPath enhances tree navigation, and how to perform precise, high-performance searches using advanced filtering techniques1. HTML vs XML in Web Scraping🔹 Understanding the Difference🔹 Key Concepts HTML → designed for display (messy, flexible)XML → designed for data (strict, structured)👉 Key Insight XML is predictable → HTML is not2. Parsing XML with Beautiful Soup🔹 Using LXML Parserfrom bs4 import BeautifulSoup soup = BeautifulSoup(xml_data, "xml") 🔹 Why LXML? FastHandles both HTML & XMLWorks well with large datasets3. XPath (Advanced Navigation)🔹 Querying the TreeXPath allows you to: Navigate by exact pathFilter by attributesTarget deeply nested elements👉 Key Insight XPath = precision targeting in complex trees4. Limiting Search Results🔹 Controlling Output Sizesoup.find_all("a", limit=3) Returns only first N matches👉 Key Insight Useful for performance + sampling data5. Non-Recursive Searches🔹 Restricting Scopesoup.find_all("div", recursive=False) Searches only direct childrenAvoids deep traversal👉 Key Insight Improves speed and accuracy in large documents6. Attribute-Based Filtering🔹 Using attrs Dictionarysoup.find_all(attrs={"data-id": "123"}) 🔹 Why Use attrs? Handles special characters (data-*)Avoids keyword conflicts (name, class)👉 Key Insight attrs gives full control over attribute filtering7. Text-Based Searching🔹 Finding Specific Textsoup.find_all(string="Hello World") 🔹 Match by Patternimport re soup.find_all(string=re.compile("Hello")) 👉 Key Insight You can target content—not just tags8. Custom Function Filters🔹 Advanced Logicdef only_text(tag): return tag.string is not None soup.find_all(only_text) 👉 Key Insight Custom filters = maximum flexibility9. Real-World Precision Extraction🔹 Combining TechniquesYou can combine: XPath / structureAttribute filtersText filtersCustom logic10. Mental ModelThink of advanced scraping like: 🎯 XPath → sniper precision🔍 find_all → search engine🧠 filters → decision logicFinal TakeawayAt this level, scraping becomes surgical instead of exploratory.You are no longer just finding data—you are:👉 targeting exact nodes 👉 limiting scope for performance 👉 combining filters for precisionThat’s what transforms scraping into a high-performance data extraction system. You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

    Course 40 - Web Scraping with Python | Episode 20: XPath Fundamentals and Advanced Beautiful Soup Searching
  6. לפני 6 ימים

    Course 40 - Web Scraping with Python | Episode 19: Tree Navigation, Advanced Filtering, and Link Extraction

    In this lesson, you’ll learn about: advanced Beautiful Soup navigation, powerful filtering techniques, and how to extract and normalize real-world data like links from complex websites1. Advanced Tree Navigation🔹 Multi-Directional MovementBeautiful Soup allows you to move through HTML in three different dimensions:🔹 Vertical Navigationlist(tag.children) list(tag.descendants) tag.parent tag.parents .children → direct children only.descendants → all nested elements.parent / .parents → move upward👉 Key Insight .children is shallow — .descendants is deep traversal🔹 Sideways Navigation (Siblings)tag.next_sibling tag.previous_sibling Moves across elements at the same level🔹 Chronological Navigation (Parser Order)tag.next_element tag.previous_element Follows actual parsing sequenceCan move into text, nested tags, or out of structure👉 Key Insight next_element ≠ next_sibling It follows document order, not hierarchy2. Advanced Filtering Techniques🔹 Precision Data Targeting3. Filtering with Regular Expressionsimport re soup.find_all(re.compile("^p")) Matches tags starting with "p"Useful for pattern-based selection4. Filtering with Attributessoup.find_all("a", class_="nav") soup.find_all("div", id="main") soup.find_all("img", src=True) class_ → avoids Python keyword conflictsrc=True → finds elements that have the attribute👉 Key Insight You can filter by value OR existence of attributes5. Custom Function Filters (Power Feature)def has_src_no_href(tag): return tag.has_attr("src") and not tag.has_attr("href") soup.find_all(has_src_no_href) 👉 Key Insight Custom functions = unlimited filtering logic6. Real-World Example: Link Extraction🔹 Extracting Links from a Page🔹 Extract All Linkslinks = soup.find_all("a") for link in links: print(link.get("href")) 7. Relative vs Absolute URLsTypeExampleRelative/aboutAbsolutehttps://site.com/about🔹 Convert to Absolutebase = "https://example.com" full_url = base + relative_url 👉 Key Insight Most websites use relative links → you must normalize them8. Extracting All Resource Links# Anchor links soup.find_all("a") # Stylesheets / metadata soup.find_all("link") # Images soup.find_all("img") 👉 Key Insight Data isn’t only in tags — it's everywhere9. Mental ModelThink of advanced scraping as: 🧭 Navigation → move through tree🎯 Filtering → select exactly what you want🔗 Extraction → collect and normalize dataFinal TakeawayAt this level, Beautiful Soup becomes more than a parser—it becomes a data navigation engine.Once you master: Deep traversal (descendants, parents)Smart filtering (regex + functions)Real-world normalization (links, resources)👉 You can extract any structured data from any HTML document, no matter how complex. You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

    Course 40 - Web Scraping with Python | Episode 19: Tree Navigation, Advanced Filtering, and Link Extraction
  7. 28 ביולי

    Course 40 - Web Scraping with Python | Episode 18: Mastering HTML Parse Tree Navigation and Element Extraction with Beautiful Soup

    In this lesson, you’ll learn about: how Beautiful Soup builds a navigable HTML tree, how to search and filter elements, and how to move through the structure to extract clean, structured data1. Parsing HTML with Beautiful Soup🔹 From Raw HTML → Structured Tree🔹 Basic Workflowimport requests from bs4 import BeautifulSoup html = requests.get("https://example.com").text soup = BeautifulSoup(html, "lxml") 🔹 Visualizing the Structureprint(soup.prettify()) 👉 Key Insight Beautiful Soup turns messy HTML into a clean tree structure2. Core Elements of the Parse Tree🔹 The 4 Building Blocks🔹 Key Components Tags → HTML elements (, )Attributes → stored as dictionariesNavigableString → text inside tagsComments → hidden HTML notes🔹 Exampletag = soup.a tag.attrs tag.string 👉 Key Insight Everything in HTML becomes an object you can navigate3. Searching & Filtering Elements🔹 Finding Data Efficiently🔹 Common Methodssoup.title soup.find("div") soup.find_all("a") 🔹 Using Regeximport re soup.find_all("a", href=re.compile("example")) 👉 Key Insight find_all() is your main tool for scalable extraction4. Navigating the HTML Tree🔹 Directional Navigation5. Moving Down the Treesoup.body.contentsAccess childrenIterate through nested elements6. Moving Up the Treetag.parentMove to parentAccess ancestors7. Moving Sidewaystag.next_sibling tag.previous_siblingAccess elements at same level👉 Key Insight Scraping = navigating the tree in the right direction8. Extracting Clean Data🔹 Practical Extraction🔹 Example: Extract Table Datafor row in soup.find_all("tr"): cols = row.find_all("td") data = [col.text.strip() for col in cols] 👉 Key Insight .text + .strip() = clean usable data9. Mental ModelThink of BeautifulSoup as:🌳 A tree🔍 find() = search tool🧭 navigation = movement (up/down/sideways)Final TakeawayBeautiful Soup transforms web scraping from:❌ guessing text patterns ➡️ into ✅ navigating structured dataOnce you understand:Tree structureSearch methodsNavigation directions👉 You gain full control over extracting any data from any HTML page You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

    Course 40 - Web Scraping with Python | Episode 18: Mastering HTML Parse Tree Navigation and Element Extraction with Beautiful Soup
  8. 27 ביולי

    Course 40 - Web Scraping with Python | Episode 17: Mastering Requests, Regex, and Beautiful Soup

    In this lesson, you’ll learn about: how Python retrieves web pages, how regex is used for pattern-based extraction, and how BeautifulSoup improves scraping by understanding HTML structure instead of treating it as plain text1. Fetching Web Content in Python🔹 HTTP Request FlowWeb scraping always starts with getting the page content.🔹 Libraries Used urllib → built-in, basic controlhttplib2 → low-level controlrequests → easiest and most popular🔹 Requests Exampleimport requests response = requests.get("https://example.com") html = response.text 🔹 User-Agent HandlingSome sites block bots, so you can:headers = {"User-Agent": "Mozilla/5.0"} requests.get(url, headers=headers) 👉 Key Insight Without proper headers, many sites will reject your scraper2. Regular Expressions (Regex Basics)🔹 Pattern Matching ConceptRegex treats web data as raw text patterns.3. Core Regex FunctionsFunctionBehaviormatch()checks start onlysearch()finds first match anywherefindall()returns all matches🔹 Special SymbolsSymbolMeaning\ddigits\wletters + numbers\swhitespace🔹 Example Patternimport re re.findall(r"\d+", "Price is 123 dollars") 👉 Key Insight Regex is powerful but fragile for HTML4. Advanced Regex Techniques🔹 Ranges & Groups [A-Z] → uppercase letters{3} → exact repetition( ) → capture groups🔹 Example: Extract Namesre.search(r"(\w+) (\w+)", "John Smith") 5. Real Web Scraping Use Cases🔹 Inspecting HTMLUsing browser tools, you can locate: items, headerscontact detailslocation data🔹 Example Targets Phone numbersZip codesCity/state data6. BeautifulSoup (Structured Parsing)🔹 DOM-Based ApproachBeautifulSoup understands HTML as a tree structure, not text.🔹 Basic Usagefrom bs4 import BeautifulSoup soup = BeautifulSoup(html, "lxml") print(soup.title.string) 🔹 Key Advantage Navigates tags easilyHandles broken HTMLCleaner extraction than regex7. Parsers (LXML vs HTML5lib)ParserStrengthlxmlfasthtml5libvery forgiving👉 Key Insight Parser choice affects speed vs accuracy8. Regex vs BeautifulSoupFeatureRegexBeautifulSoupStructure aware❌✔️Speed✔️MediumReliability❌✔️9. Mental ModelThink of scraping like: 📥 Requests → download page🔍 Regex → pattern hunting🌳 BeautifulSoup → structured navigationFinal TakeawayWeb scraping becomes powerful when you stop treating HTML as text and start treating it as a structured tree of data.👉 Use: Requests → fetchRegex → quick patternsBeautifulSoup → real extractionThat combination covers most real-world scraping tasks. You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

    Course 40 - Web Scraping with Python | Episode 17: Mastering Requests, Regex, and Beautiful Soup

אודות

Welcome to CyberCode Academy — your audio classroom for Programming and Cybersecurity. 🎧 Each course is divided into a series of short, focused episodes that take you from beginner to advanced level — one lesson at a time. From Python and web development to ethical hacking and digital defense, our content transforms complex concepts into simple, engaging audio learning. Study anywhere, anytime — and level up your skills with CyberCode Academy. 🚀 Learn. Code. Secure. You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy

אולי יעניין אותך