|
5 | 5 | from selenium.webdriver.chrome.service import Service
|
6 | 6 | from selenium.webdriver.support.ui import WebDriverWait
|
7 | 7 |
|
| 8 | + |
8 | 9 | class geeksforgeeks:
|
9 | 10 | service = Service(ChromeDriverManager().install())
|
10 | 11 | driver = webdriver.Chrome(service=service)
|
@@ -78,7 +79,8 @@ def get_popular_now(self):
|
78 | 79 | "message": "Popular Courses are now fetched",
|
79 | 80 | }
|
80 | 81 | except (WebDriverException, NoSuchElementException) as e:
|
81 |
| - raise Exception(f"An error occurred while scraping popular courses: {str(e)}") |
| 82 | + raise Exception( |
| 83 | + f"An error occurred while scraping popular courses: {str(e)}") |
82 | 84 |
|
83 | 85 | def get_self_paced(self):
|
84 | 86 | """
|
@@ -111,7 +113,8 @@ def get_self_paced(self):
|
111 | 113 | },
|
112 | 114 | )
|
113 | 115 | name.append(course_name.text)
|
114 |
| - course_rating = items.find("div", {"class": "courseListingPage_courseCardContentsGrid__jk3VM"}).find("span",{"class":"urw-din"}) |
| 116 | + course_rating = items.find("div", {"class": "courseListingPage_courseCardContentsGrid__jk3VM"}).find( |
| 117 | + "span", {"class": "urw-din"}) |
115 | 118 | if not course_rating:
|
116 | 119 | course_rating = "Information not available"
|
117 | 120 | else:
|
@@ -142,7 +145,8 @@ def get_self_paced(self):
|
142 | 145 | "message": "Self paced Courses are now fetched",
|
143 | 146 | }
|
144 | 147 | except (WebDriverException, NoSuchElementException) as e:
|
145 |
| - raise Exception(f"An error occurred while scraping popular courses: {str(e)}") |
| 148 | + raise Exception( |
| 149 | + f"An error occurred while scraping popular courses: {str(e)}") |
146 | 150 |
|
147 | 151 | def get_live_course(self):
|
148 | 152 | """
|
@@ -207,5 +211,5 @@ def get_live_course(self):
|
207 | 211 | "message": "Live Courses are now fetched",
|
208 | 212 | }
|
209 | 213 | except (WebDriverException, NoSuchElementException) as e:
|
210 |
| - raise Exception(f"An error occurred while scraping popular courses: {str(e)}") |
211 |
| -
|
| 214 | + raise Exception( |
| 215 | + f"An error occurred while scraping popular courses: {str(e)}") |
0 commit comments