Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save g-rohit/f0f886ae349b87d78d5feb1fce5a33f7 to your computer and use it in GitHub Desktop.
Save g-rohit/f0f886ae349b87d78d5feb1fce5a33f7 to your computer and use it in GitHub Desktop.
This code snippet gets all the chapter names and sub topic names in a checkbox or todo markdown style from udemy course
// given a condition all the sections are expanded
(function () {
function sanitize(text) {
return text?.trim().replace(/\s+/g, ' ') || '';
}
const sections = document.querySelectorAll('[data-purpose^="section-panel-"]');
const markdownLines = [];
sections.forEach((section) => {
const sectionTitleEl = section.querySelector('[data-purpose="section-heading"] .ud-accordion-panel-title');
const sectionTitle = sanitize(sectionTitleEl?.innerText || 'Untitled Section');
markdownLines.push(`- [ ] Chapter name: ${sectionTitle}`);
const lectures = section.querySelectorAll('li.curriculum-item-link--curriculum-item--OVP5S');
lectures.forEach((lecture) => {
const lectureTitleEl = lecture.querySelector('[data-purpose="item-title"]');
const durationEl = lecture.querySelector('.curriculum-item-link--metadata--XK804 span:last-child');
const lectureTitle = sanitize(lectureTitleEl?.innerText);
const duration = sanitize(durationEl?.innerText);
markdownLines.push(` - [ ] ${lectureTitle}${duration ? ` (${duration})` : ''}`);
});
});
// Output in console
console.log(markdownLines.join('\n'));
})();
// Example output of the course: https://udemy.com/course/js-algorithms-and-data-structures-masterclass/
// - [ ] Chapter name: Section 1: Introduction
// - [ ] 1. Curriculum Walkthrough (8min)
// - [ ] 2. Join The Community! (1min)
// - [ ] 3. What Order Should You Watch In? (3min)
// - [ ] 4. How I'm Running My Code (3min)
// - [ ] Chapter name: Section 2: Big O Notation
// - [ ] 5. Intro to Big O (8min)
// - [ ] 6. Timing Our Code (10min)
// - [ ] 7. Counting Operations (5min)
// - [ ] 8. Visualizing Time Complexities (4min)
// - [ ] 9. Official Intro to Big O (10min)
// - [ ] 10. Simplifying Big O Expressions (10min)
// - [ ] Quiz 1: Big O Time Complexity Quiz
// - [ ] Quiz 2: Big O Time Complexity Quiz 2
// - [ ] 11. Space Complexity (6min)
// - [ ] Quiz 3: Big O Space Complexity Quiz
// - [ ] 12. Logs and Section Recap (9min)
// - [ ] Chapter name: Section 3: Analyzing Performance of Arrays and Objects
// - [ ] 13. PREREQUISITES (1min)
// - [ ] 14. Section Introduction (2min)
// - [ ] 15. The BIG O of Objects (6min)
// - [ ] Quiz 4: Object Operations Quiz
// - [ ] 16. When are Arrays Slow? (6min)
// - [ ] 17. Big O of Array Methods (6min)
// - [ ] Quiz 5: Array Operations Quiz
// - [ ] Chapter name: Section 4: Problem Solving Approach
// - [ ] 18. PREREQUISITES (1min)
// - [ ] 19. Introduction to Problem Solving (7min)
// - [ ] 20. Step 1: Understand The Problem (8min)
// - [ ] 21. Step 2: Concrete Examples (6min)
// - [ ] 22. Step 3: Break It Down (8min)
// - [ ] 23. Step 4: Solve Or Simplify (11min)
// - [ ] 24. Step 5: Look Back and Refactor (17min)
// - [ ] 25. Recap and Interview Strategies (4min)
// - [ ] Chapter name: Section 5: Problem Solving Patterns
// - [ ] 26. PREREQUISITES (1min)
// - [ ] 27. Intro to Problem Solving Patterns (3min)
// - [ ] 28. Frequency Counter Pattern (15min)
// - [ ] 29. Frequency Counter: Anagram Challenge (3min)
// - [ ] Coding Exercise 1: Frequency Counter - validAnagram
// - [ ] 30. Anagram Challenge Solution (6min)
// - [ ] 31. Multiple Pointers Pattern (10min)
// - [ ] 32. Multiple Pointers: Count Unique Values Challenge (4min)
// - [ ] Coding Exercise 2: Multiple Pointers - countUniqueValues
// - [ ] 33. Count Unique Values Solution (7min)
// - [ ] 34. Sliding Window Pattern (13min)
// - [ ] 35. Divide And Conquer Pattern (7min)
// - [ ] Chapter name: Section 6: 100% OPTIONAL Challenges
// - [ ] 36. IMPORTANT NOTE! (1min)
// - [ ] Coding Exercise 3: Frequency Counter - sameFrequency
// - [ ] Coding Exercise 4: Frequency Counter / Multiple Pointers - areThereDuplicates
// - [ ] Coding Exercise 5: Frequency Counter - constructNote
// - [ ] Coding Exercise 6: Frequency Counter - findAllDuplicates
// - [ ] 37. SOLUTIONS PART 1 (1min)
// - [ ] Coding Exercise 7: Multiple Pointers - averagePair
// - [ ] Coding Exercise 8: Multiple Pointers - isSubsequence
// - [ ] Coding Exercise 9: Frequency Counter / Multiple Pointer - findPair
// - [ ] 38. SOLUTIONS PART 2 (1min)
// - [ ] Coding Exercise 10: Sliding Window - maxSubarraySum
// - [ ] Coding Exercise 11: Sliding Window - minSubArrayLen
// - [ ] Coding Exercise 12: Sliding Window - findLongestSubstring
// - [ ] 39. SOLUTIONS PART 3 (1min)
// - [ ] Coding Exercise 13: Divide and Conquer - countZeroes
// - [ ] Coding Exercise 14: Divide and Conquer - sortedFrequency
// - [ ] Coding Exercise 15: Divide and Conquer - findRotatedIndex
// - [ ] 40. SOLUTIONS PART 4 (1min)
// - [ ] Chapter name: Section 7: Recursion
// - [ ] 41. PREREQUISITES (1min)
// - [ ] 42. Story Time: Martin & The Dragon (7min)
// - [ ] 43. Why Use Recursion? (6min)
// - [ ] 44. The Call Stack (7min)
// - [ ] 45. Our First Recursive Function (5min)
// - [ ] Quiz 6: Recursion Quiz
// - [ ] 46. Our Second Recursive Function (8min)
// - [ ] 47. Writing Factorial Iteratively (2min)
// - [ ] 48. Writing Factorial Recursively (3min)
// - [ ] 49. Common Recursion Pitfalls (5min)
// - [ ] 50. Helper Method Recursion (6min)
// - [ ] 51. Pure Recursion (8min)
// - [ ] Chapter name: Section 8: Recursion Problem Set
// - [ ] 52. START HERE! (1min)
// - [ ] Coding Exercise 16: power
// - [ ] Coding Exercise 17: factorial
// - [ ] Coding Exercise 18: productOfArray
// - [ ] Coding Exercise 19: recursiveRange
// - [ ] Coding Exercise 20: fib
// - [ ] 53. SOLUTIONS FOR THIS SECTION (1min)
// - [ ] Chapter name: Section 9: Bonus CHALLENGING Recursion Problems
// - [ ] 54. NOTE ON THIS SECTION (1min)
// - [ ] Coding Exercise 21: reverse
// - [ ] Coding Exercise 22: isPalindrome
// - [ ] Coding Exercise 23: someRecursive
// - [ ] Coding Exercise 24: flatten
// - [ ] 55. SOLUTIONS PART 1 (1min)
// - [ ] Coding Exercise 25: capitalizeFirst
// - [ ] Coding Exercise 26: nestedEvenSum
// - [ ] Coding Exercise 27: capitalizeWords
// - [ ] Coding Exercise 28: stringifyNumbers
// - [ ] Coding Exercise 29: collectStrings
// - [ ] 56. SOLUTIONS PART 2 (1min)
// - [ ] Chapter name: Section 10: Searching Algorithms
// - [ ] 57. PREREQUISITES (1min)
// - [ ] 58. Intro to Searching (4min)
// - [ ] 59. Intro to Linear Search (5min)
// - [ ] Coding Exercise 30: Linear Search Exercise
// - [ ] 60. Linear Search Solution (5min)
// - [ ] 61. Linear Search BIG O (2min)
// - [ ] 62. Intro to Binary Search (6min)
// - [ ] 63. Binary Search PseudoCode (3min)
// - [ ] Coding Exercise 31: Binary Search Exercise
// - [ ] 64. Binary Search Solution (17min)
// - [ ] 65. Binary Search BIG O (6min)
// - [ ] 66. Naive String Search (5min)
// - [ ] 67. Naive String Search Implementation (12min)
// - [ ] Chapter name: Section 11: Bubble Sort
// - [ ] 68. PREREQUISITES (1min)
// - [ ] 69. Introduction to Sorting Algorithms (9min)
// - [ ] 70. Built-In JavaScript Sorting (5min)
// - [ ] 71. Bubble Sort: Overview (7min)
// - [ ] 72. Bubble Sort: Implementation (10min)
// - [ ] 73. Bubble Sort: Optimization (4min)
// - [ ] 74. Bubble Sort: BIG O Complexity (1min)
// - [ ] Coding Exercise 32: Bubble Sort
// - [ ] Chapter name: Section 12: Selection Sort
// - [ ] 75. PREREQUISITES (1min)
// - [ ] 76. Selection Sort: Introduction (6min)
// - [ ] 77. Selection Sort: Implementation (11min)
// - [ ] 78. Selection Sort: Big O Complexity (2min)
// - [ ] Coding Exercise 33: Selection Sort
// - [ ] Chapter name: Section 13: Insertion Sort
// - [ ] 79. PREREQUISITES (1min)
// - [ ] 80. Insertion Sort: Introduction (3min)
// - [ ] 81. Insertion Sort: Implementation (11min)
// - [ ] 82. Insertion Sort: BIG O Complexity (2min)
// - [ ] Coding Exercise 34: Insertion Sort
// - [ ] Chapter name: Section 14: Comparing Bubble, Selection, and Insertion Sort
// - [ ] 83. Comparing Bubble, Selection, and Insertion Sort (6min)
// - [ ] Chapter name: Section 15: Merge Sort
// - [ ] 84. PREREQUISITES (1min)
// - [ ] 85. Intro to the "Crazier" Sorts (6min)
// - [ ] 86. Merge Sort: Introduction (5min)
// - [ ] 87. Merging Arrays Intro (5min)
// - [ ] 88. Merging Arrays: Implementation (7min)
// - [ ] 89. Writing Merge Sort Part 1 (2min)
// - [ ] 90. Writing Merge Sort Part 2 (13min)
// - [ ] 91. Merge Sort BIG O Complexity (6min)
// - [ ] Coding Exercise 35: Sorting Exercise - merge helper
// - [ ] Coding Exercise 36: Merge Sort
// - [ ] Chapter name: Section 16: Quick Sort
// - [ ] 92. PREREQUISITES (1min)
// - [ ] 93. Introduction to Quick Sort (9min)
// - [ ] 94. Pivot Helper Introduction (8min)
// - [ ] 95. Pivot Helper Implementation (8min)
// - [ ] 96. Quick Sort Implementation (9min)
// - [ ] 97. Quick Sort Call Stack Walkthrough (4min)
// - [ ] 98. Quick Sort Big O Complexity (4min)
// - [ ] Coding Exercise 37: Sorting Exercise - pivot helper
// - [ ] Coding Exercise 38: Quick Sort
// - [ ] Chapter name: Section 17: Radix Sort
// - [ ] 99. PREREQUISITES (1min)
// - [ ] 100. Radix Sort: Introduction (9min)
// - [ ] 101. Radix Sort: Helper Methods (11min)
// - [ ] 102. Radix Sort: Pseudocode (4min)
// - [ ] 103. Radix Sort: Implementation (10min)
// - [ ] 104. Radix Sort: BIG O Complexity (4min)
// - [ ] Coding Exercise 39: Radix Sort Helper - getDigit
// - [ ] Coding Exercise 40: Radix Sort Helper - digitCount
// - [ ] Coding Exercise 41: Radix Sort Helper - mostDigits
// - [ ] Coding Exercise 42: Radix Sort
// - [ ] Chapter name: Section 18: Data Structures Introduction
// - [ ] 105. Which Data Structure Is The Best? (13min)
// - [ ] 106. ES2015 Class Syntax Overview (5min)
// - [ ] 107. Data Structures: The Class Keyword (7min)
// - [ ] 108. Data Structures: Adding Instance Methods (10min)
// - [ ] 109. Data Structures: Adding Class Methods (7min)
// - [ ] Chapter name: Section 19: Singly Linked Lists
// - [ ] 110. PREREQUISITES (1min)
// - [ ] 111. Intro to Singly Linked Lists (8min)
// - [ ] 112. Starter Code and Push Intro (7min)
// - [ ] 113. Singly Linked List: Push Solution (4min)
// - [ ] 114. Singly Linked List: Pop Intro (6min)
// - [ ] 115. Singly Linked List: Pop Solution (8min)
// - [ ] 116. Singly Linked List: Shift Intro (2min)
// - [ ] 117. Singly Linked List: Shift Solution (3min)
// - [ ] 118. Singly Linked List: Unshift Intro (2min)
// - [ ] 119. Singly Linked List: Unshift Solution (6min)
// - [ ] 120. Singly Linked List: Get Intro (3min)
// - [ ] 121. Singly Linked List: Get Solution (4min)
// - [ ] 122. Singly Linked List: Set Intro (1min)
// - [ ] 123. Singly Linked List: Set Solution (2min)
// - [ ] 124. Singly Linked List: Insert Intro (4min)
// - [ ] 125. Singly Linked List: Insert Solution (8min)
// - [ ] 126. Singly Linked List: Remove Intro (2min)
// - [ ] 127. Singly Linked List: Remove Solution (3min)
// - [ ] 128. Singly Linked List: Reverse Intro (5min)
// - [ ] 129. Singly Linked List: Reverse Solution (9min)
// - [ ] 130. Singly Linked List: BIG O Complexity (6min)
// - [ ] Coding Exercise 43: SLL - push Exercise
// - [ ] Coding Exercise 44: SLL - pop exercise
// - [ ] Coding Exercise 45: SLL - get Exercise
// - [ ] Coding Exercise 46: SLL - set Exercise
// - [ ] Coding Exercise 47: SLL - insert Exercise
// - [ ] Coding Exercise 48: SLL - remove Exercise
// - [ ] Coding Exercise 49: Extra Challenge: SLL - rotate Exercise
// - [ ] Chapter name: Section 20: Doubly Linked Lists
// - [ ] 131. PREREQUISITES (1min)
// - [ ] 132. Doubly Linked Lists Introduction (5min)
// - [ ] 133. Setting Up Our Node Class (3min)
// - [ ] 134. Push (2min)
// - [ ] 135. Push Solution (4min)
// - [ ] 136. Pop (3min)
// - [ ] 137. Pop Solution (6min)
// - [ ] 138. Shift (3min)
// - [ ] 139. Shift Solution (4min)
// - [ ] 140. Unshift (2min)
// - [ ] 141. Unshift Solution (2min)
// - [ ] 142. Get (4min)
// - [ ] 143. Get Solution (7min)
// - [ ] 144. Set (1min)
// - [ ] 145. Set Solution (2min)
// - [ ] 146. Insert (3min)
// - [ ] 147. Insert Solution (7min)
// - [ ] 148. Remove (2min)
// - [ ] 149. Remove Solution (6min)
// - [ ] 150. Comparing Singly and Doubly Linked Lists (5min)
// - [ ] Coding Exercise 50: DLL push - Exercise
// - [ ] Coding Exercise 51: DLL pop - Exercise
// - [ ] Coding Exercise 52: DLL shift - Exercise
// - [ ] Coding Exercise 53: DLL unshift - Exercise
// - [ ] Coding Exercise 54: DLL get - Exercise
// - [ ] Coding Exercise 55: DLL set - Exercise
// - [ ] Coding Exercise 56: DLL insert - Exercise
// - [ ] Coding Exercise 57: DLL remove - Exercise
// - [ ] Coding Exercise 58: Extra Challenge: DLL reverse - Exercise
// - [ ] Chapter name: Section 21: Stacks + Queues
// - [ ] 151. PREREQUISITES (1min)
// - [ ] 152. Intro to Stacks (6min)
// - [ ] 153. Creating a Stack with an Array (7min)
// - [ ] 154. Writing Our Own Stack From Scratch (12min)
// - [ ] 155. BIG O of Stacks (2min)
// - [ ] 156. Intro to Queues (4min)
// - [ ] 157. Creating Queues Using Arrays (3min)
// - [ ] 158. Writing Our Own Queue From Scratch (10min)
// - [ ] 159. BIG O of Queues (3min)
// - [ ] Coding Exercise 59: Stacks - push Exercise
// - [ ] Coding Exercise 60: Stacks - pop Exercise
// - [ ] Coding Exercise 61: Queues - enqueue Exercise
// - [ ] Coding Exercise 62: Queues - dequeue Exercise
// - [ ] Coding Exercise 63: Stack with 2 Queues - Exercise
// - [ ] Chapter name: Section 22: Binary Search Trees
// - [ ] 160. PREREQUISITES (1min)
// - [ ] 161. Introduction to Trees (7min)
// - [ ] 162. Uses For Trees (7min)
// - [ ] 163. Intro to Binary Trees (6min)
// - [ ] 164. POP QUIZ! (1min)
// - [ ] 165. Searching A Binary Search Tree (3min)
// - [ ] 166. Our Tree Classes (3min)
// - [ ] 167. BST: Insert (4min)
// - [ ] 168. BST: Insert Solution (12min)
// - [ ] 169. BST: Find (5min)
// - [ ] 170. BST: Find Solution (6min)
// - [ ] 171. Big O of Binary Search Trees (6min)
// - [ ] Coding Exercise 64: Binary Search Tree - insert Exercise
// - [ ] Coding Exercise 65: Binary Search Tree - find Exercise
// - [ ] Coding Exercise 66: Extra Challenge: Binary Search Tree - remove Exercise
// - [ ] Coding Exercise 67: Extra Challenge: Binary Search Tree - findSecondLargest Exercise
// - [ ] Coding Exercise 68: Extra Challenge: Binary Search Tree - isBalanced Exercise
// - [ ] Chapter name: Section 23: Tree Traversal
// - [ ] 172. PREREQUISITES (1min)
// - [ ] 173. Intro To Tree Traversal (5min)
// - [ ] 174. Breadth First Search Intro (6min)
// - [ ] 175. Breadth First Search Solution (6min)
// - [ ] 176. Depth First PreOrder Intro (6min)
// - [ ] 177. Depth First PreOrder Solution (7min)
// - [ ] 178. Depth First PostOrder Intro (4min)
// - [ ] 179. Depth First PostOrder Solution (3min)
// - [ ] 180. Depth First InOrder Intro (2min)
// - [ ] 181. Depth First InOrder Solution (3min)
// - [ ] 182. When to Use BFS and DFS (8min)
// - [ ] Coding Exercise 69: Binary Search Tree - BFS Exercise
// - [ ] Coding Exercise 70: Binary Search Tree - DFS Exercise
// - [ ] Chapter name: Section 24: Binary Heaps
// - [ ] 183. PREREQUISITES (1min)
// - [ ] 184. Intro to Heaps (8min)
// - [ ] 185. Storing Heaps (7min)
// - [ ] 186. Heap: Insert Intro (9min)
// - [ ] 187. Heap: Insert Solution (11min)
// - [ ] 188. Heap: ExtractMax Intro (8min)
// - [ ] 189. Heap: ExtractMax Solution (18min)
// - [ ] 190. Priority Queue Intro (9min)
// - [ ] 191. Priority Queue Pseudocode (4min)
// - [ ] 192. Priority Queue Solution (9min)
// - [ ] 193. BIG O of Binary Heaps (9min)
// - [ ] Coding Exercise 71: BinaryHeap - insert Exercise
// - [ ] Coding Exercise 72: BinaryHeap - extractMax Exercise
// - [ ] Chapter name: Section 25: Hash Tables
// - [ ] 194. PREREQUISITES (1min)
// - [ ] 195. Intro to Hash Tables (6min)
// - [ ] 196. More About Hash Tables (5min)
// - [ ] 197. Intro to Hash Functions (6min)
// - [ ] 198. Writing Our First Hash Function (8min)
// - [ ] 199. Improving Our Hash Function (7min)
// - [ ] 200. Handling Collisions (4min)
// - [ ] 201. Hash Table Set and Get (4min)
// - [ ] 202. Hash Table Set Solution (5min)
// - [ ] 203. Hash Table Get Solution (7min)
// - [ ] 204. Hash Table Keys and Values (2min)
// - [ ] 205. Hash Table Keys and Values Solution (9min)
// - [ ] 206. Hash Table Big O Complexity (6min)
// - [ ] Chapter name: Section 26: Graphs
// - [ ] 207. PREREQUISITES (1min)
// - [ ] 208. Intro to Graphs (4min)
// - [ ] 209. Uses for Graphs (8min)
// - [ ] 210. Types of Graphs (9min)
// - [ ] 211. Storing Graphs: Adjacency Matrix (4min)
// - [ ] 212. Storing Graphs: Adjacency List (2min)
// - [ ] 213. Adjacency Matrix Vs. List BIG O (6min)
// - [ ] 214. Add Vertex Intro (2min)
// - [ ] 215. Add Vertex Solution (3min)
// - [ ] 216. Add Edge Intro (3min)
// - [ ] 217. Add Edge Solution (2min)
// - [ ] 218. Remove Edge Intro (2min)
// - [ ] 219. Remove Edge Solution (3min)
// - [ ] 220. Remove Vertex Intro (3min)
// - [ ] 221. Remove Vertex Solution (5min)
// - [ ] Coding Exercise 73: Graphs Exercise - addVertex
// - [ ] Coding Exercise 74: Graphs Exercise - addEdge
// - [ ] Coding Exercise 75: Graphs Exercise - removeEdge
// - [ ] Coding Exercise 76: Graphs Exercise - removeVertex
// - [ ] Chapter name: Section 27: Graph Traversal
// - [ ] 222. PREREQUISITES (1min)
// - [ ] 223. Intro to Graph Traversal (9min)
// - [ ] 224. Depth First Graph Traversal (9min)
// - [ ] 225. DFS Recursive Intro (7min)
// - [ ] 226. DFS Recursive Solution (13min)
// - [ ] 227. DFS Iterative Intro (4min)
// - [ ] 228. DFS Iterative Solution (9min)
// - [ ] 229. Breadth First Graph Traversal (3min)
// - [ ] 230. BFS Intro (2min)
// - [ ] 231. BFS Solution (8min)
// - [ ] Coding Exercise 77: Graphs - DFS Exercise
// - [ ] Coding Exercise 78: Graphs - BFS Exercise
// - [ ] Chapter name: Section 28: Dijkstra's Algorithm!
// - [ ] 232. PREREQUISITES (1min)
// - [ ] 233. Intro to Dijkstra's and Prerequisites (3min)
// - [ ] 234. Who was Dijkstra and what is his Algorithm? (9min)
// - [ ] 235. Writing a Weighted Graph (5min)
// - [ ] 236. Walking through the Algorithm (16min)
// - [ ] 237. Introducing Our Simple Priority Queue (4min)
// - [ ] 238. Dijkstra's Pseudo-Code (4min)
// - [ ] 239. Implementing Dijkstra's Algorithm (21min)
// - [ ] 240. Upgrading the Priority Queue (2min)
// - [ ] Coding Exercise 79: Graphs - Dijkstra Exercise
// - [ ] Chapter name: Section 29: Dynamic Programming
// - [ ] 241. Intro to Dynamic Programming (5min)
// - [ ] 242. Overlapping Subproblems (6min)
// - [ ] 243. Optimal Substructure (6min)
// - [ ] 244. Writing A Recursive Solution (7min)
// - [ ] 245. Time Complexity of Our Solution (4min)
// - [ ] 246. The Problem With Our Solution (4min)
// - [ ] 247. Enter Memoization! (9min)
// - [ ] 248. Time Complexity of Memoized Solution (3min)
// - [ ] 249. Tabulation: A Bottom Up Approach (7min)
// - [ ] Coding Exercise 80: Coin Change - Greedy Algorithm
// - [ ] Coding Exercise 81: Dynamic Programming - Coin Change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment