diff --git a/docs/wiki/Home-da.md b/docs/wiki/Home-da.md index f7e396d..f0e5912 100644 --- a/docs/wiki/Home-da.md +++ b/docs/wiki/Home-da.md @@ -1,6 +1,6 @@ -[English](Home) · **Dansk** · [Bahasa Malaysia](Home-ms) +[English](Home) | **Dansk** | [Bahasa Malaysia](Home-ms) -# Dag 48 – Scraping af python.org med Selenium +# Dag 48 - Scraping af python.org med Selenium I denne lektion bruger vi Selenium til at læse de fem kommende begivenheder på [python.org](https://www.python.org/) og samle dem i en dictionary: diff --git a/docs/wiki/Home-ms.md b/docs/wiki/Home-ms.md index 7288c5c..d837091 100644 --- a/docs/wiki/Home-ms.md +++ b/docs/wiki/Home-ms.md @@ -1,6 +1,6 @@ -[English](Home) · [Dansk](Home-da) · **Bahasa Malaysia** +[English](Home) | [Dansk](Home-da) | **Bahasa Malaysia** -# Hari 48 – Mengikis python.org dengan Selenium +# Hari 48 - Mengikis python.org dengan Selenium Dalam pelajaran ini kita menggunakan Selenium untuk membaca lima acara akan datang di [python.org](https://www.python.org/) dan menyusunnya dalam kamus diff --git a/docs/wiki/Home.md b/docs/wiki/Home.md index ea3fbeb..6bca999 100644 --- a/docs/wiki/Home.md +++ b/docs/wiki/Home.md @@ -1,6 +1,6 @@ -**English** · [Dansk](Home-da) · [Bahasa Malaysia](Home-ms) +**English** | [Dansk](Home-da) | [Bahasa Malaysia](Home-ms) -# Day 48 – Scraping python.org with Selenium +# Day 48 - Scraping python.org with Selenium In this lecture we use Selenium to read the five upcoming events from [python.org](https://www.python.org/) and organise them in a dictionary: diff --git a/docs/wiki/Lecture-Steps-da.md b/docs/wiki/Lecture-Steps-da.md index 9c955b8..ece2884 100644 --- a/docs/wiki/Lecture-Steps-da.md +++ b/docs/wiki/Lecture-Steps-da.md @@ -1,19 +1,19 @@ -[English](Lecture-Steps) · **Dansk** · [Bahasa Malaysia](Lecture-Steps-ms) +[English](Lecture-Steps) | **Dansk** | [Bahasa Malaysia](Lecture-Steps-ms) # Lektionens trin -## Trin 1 – Åbn siden +## Trin 1 - Åbn siden -![Forsiden på python.org](images/01-python-org-home.png) +![Forsiden på python.org](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/01-python-org-home.png) `driver.get("https://www.python.org/")` indlæser siden i Chrome. **Hvad du får ud af det:** driveren er din fjernbetjening til en rigtig browser. Den skal altid lukkes igen, så den moderne kode bruger `try/finally`. -## Trin 2 – Find widgetten med inspektionsværktøjet +## Trin 2 - Find widgetten med inspektionsværktøjet -![Widgetten Upcoming Events](images/02-event-widget.png) +![Widgetten Upcoming Events](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/02-event-widget.png) Højreklik på widgetten og vælg *Inspect*. Begivenhederne ligger i et element med klassen `event-widget`; hver begivenhed er en `li` med et `time`- og et `a`-tag. @@ -21,9 +21,9 @@ klassen `event-widget`; hver begivenhed er en `li` med et `time`- og et `a`-tag. **Hvad du får ud af det:** du lærer at læse HTML-træet og finde den beholder, der rummer præcis de data, du vil have. -## Trin 3 – Vælg de fem listepunkter med en CSS-selector +## Trin 3 - Vælg de fem listepunkter med en CSS-selector -![De fem listepunkter markeret med rødt](images/03-event-list-highlighted.png) +![De fem listepunkter markeret med rødt](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/03-event-list-highlighted.png) `driver.find_elements(By.CSS_SELECTOR, ".event-widget li")` returnerer de fem punkter. En klassebaseret selector er kortere og mere stabil end den lange @@ -32,9 +32,9 @@ XPath, man kopierer fra inspektøren, og den rammer ikke urelaterede links. **Hvad du får ud af det:** du kender Seleniums locator-strategier og ved, hvornår CSS-selectors slår XPath. -## Trin 4 – Byg dictionary'en +## Trin 4 - Byg dictionary'en -![Den udskrevne dictionary](images/04-output-dictionary.png) +![Den udskrevne dictionary](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/04-output-dictionary.png) For hvert punkt læser vi `time` og `a` og gemmer dem under punktets indeks, med `enumerate` i stedet for en manuel tæller. diff --git a/docs/wiki/Lecture-Steps-ms.md b/docs/wiki/Lecture-Steps-ms.md index c3d42e0..735b0f3 100644 --- a/docs/wiki/Lecture-Steps-ms.md +++ b/docs/wiki/Lecture-Steps-ms.md @@ -1,19 +1,19 @@ -[English](Lecture-Steps) · [Dansk](Lecture-Steps-da) · **Bahasa Malaysia** +[English](Lecture-Steps) | [Dansk](Lecture-Steps-da) | **Bahasa Malaysia** # Langkah pelajaran -## Langkah 1 – Buka laman +## Langkah 1 - Buka laman -![Laman utama python.org](images/01-python-org-home.png) +![Laman utama python.org](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/01-python-org-home.png) `driver.get("https://www.python.org/")` memuatkan laman dalam Chrome. **Apa yang anda peroleh:** driver ialah alat kawalan jauh untuk pelayar sebenar. Ia mesti ditutup semula, jadi kod moden menggunakan `try/finally`. -## Langkah 2 – Cari widget dengan alat pemeriksa +## Langkah 2 - Cari widget dengan alat pemeriksa -![Widget Upcoming Events](images/02-event-widget.png) +![Widget Upcoming Events](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/02-event-widget.png) Klik kanan pada widget dan pilih *Inspect*. Acara berada dalam elemen berkelas `event-widget`; setiap acara ialah `li` yang mengandungi teg `time` dan `a`. @@ -21,9 +21,9 @@ Klik kanan pada widget dan pilih *Inspect*. Acara berada dalam elemen berkelas **Apa yang anda peroleh:** anda belajar membaca pepohon HTML dan mencari bekas yang menyimpan data yang tepat seperti yang dikehendaki. -## Langkah 3 – Pilih lima item senarai dengan pemilih CSS +## Langkah 3 - Pilih lima item senarai dengan pemilih CSS -![Lima item senarai ditandakan merah](images/03-event-list-highlighted.png) +![Lima item senarai ditandakan merah](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/03-event-list-highlighted.png) `driver.find_elements(By.CSS_SELECTOR, ".event-widget li")` mengembalikan lima item. Pemilih berasaskan kelas lebih pendek dan lebih stabil daripada XPath @@ -32,9 +32,9 @@ panjang yang disalin dari pemeriksa, dan ia tidak memadankan pautan lain. **Apa yang anda peroleh:** anda mengenali strategi locator Selenium dan bila pemilih CSS lebih baik daripada XPath. -## Langkah 4 – Bina kamus +## Langkah 4 - Bina kamus -![Kamus yang dicetak](images/04-output-dictionary.png) +![Kamus yang dicetak](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/04-output-dictionary.png) Untuk setiap item kita baca `time` dan `a` lalu simpan di bawah indeks item itu, dengan `enumerate` dan bukannya pembilang manual. diff --git a/docs/wiki/Lecture-Steps.md b/docs/wiki/Lecture-Steps.md index ace700a..fda12ca 100644 --- a/docs/wiki/Lecture-Steps.md +++ b/docs/wiki/Lecture-Steps.md @@ -1,19 +1,19 @@ -**English** · [Dansk](Lecture-Steps-da) · [Bahasa Malaysia](Lecture-Steps-ms) +**English** | [Dansk](Lecture-Steps-da) | [Bahasa Malaysia](Lecture-Steps-ms) # Lecture steps -## Step 1 – Open the page +## Step 1 - Open the page -![python.org home page](images/01-python-org-home.png) +![python.org home page](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/01-python-org-home.png) `driver.get("https://www.python.org/")` loads the page in Chrome. **What you gain:** the driver is your remote control for a real browser. It must always be closed again, so the modern code wraps it in `try/finally`. -## Step 2 – Locate the widget with the inspector +## Step 2 - Locate the widget with the inspector -![The Upcoming Events widget](images/02-event-widget.png) +![The Upcoming Events widget](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/02-event-widget.png) Right-click the widget and choose *Inspect*. The events live inside an element with the class `event-widget`; each event is an `li` holding a `time` and an @@ -22,9 +22,9 @@ with the class `event-widget`; each event is an `li` holding a `time` and an **What you gain:** you learn to read the HTML tree and find the container that holds exactly the data you want. -## Step 3 – Select the five list items with a CSS selector +## Step 3 - Select the five list items with a CSS selector -![The five list items outlined in red](images/03-event-list-highlighted.png) +![The five list items outlined in red](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/03-event-list-highlighted.png) `driver.find_elements(By.CSS_SELECTOR, ".event-widget li")` returns the five items. A class-based selector is shorter and more stable than the long XPath @@ -33,9 +33,9 @@ copied from the inspector, and it does not match unrelated links. **What you gain:** you know the Selenium locator strategies and when CSS selectors beat XPath. -## Step 4 – Build the dictionary +## Step 4 - Build the dictionary -![The printed dictionary](images/04-output-dictionary.png) +![The printed dictionary](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-scrapping-python-org/raw/branch/main/docs/screenshots/04-output-dictionary.png) For every item we read `time` and `a` and store them under the item's index, with `enumerate` instead of a manual counter. diff --git a/docs/wiki/Modernisation-da.md b/docs/wiki/Modernisation-da.md index 2ee32d7..2d73e71 100644 --- a/docs/wiki/Modernisation-da.md +++ b/docs/wiki/Modernisation-da.md @@ -1,4 +1,4 @@ -[English](Modernisation) · **Dansk** · [Bahasa Malaysia](Modernisation-ms) +[English](Modernisation) | **Dansk** | [Bahasa Malaysia](Modernisation-ms) # Modernisering diff --git a/docs/wiki/Modernisation-ms.md b/docs/wiki/Modernisation-ms.md index e41df60..64d7edd 100644 --- a/docs/wiki/Modernisation-ms.md +++ b/docs/wiki/Modernisation-ms.md @@ -1,4 +1,4 @@ -[English](Modernisation) · [Dansk](Modernisation-da) · **Bahasa Malaysia** +[English](Modernisation) | [Dansk](Modernisation-da) | **Bahasa Malaysia** # Pemodenan diff --git a/docs/wiki/Modernisation.md b/docs/wiki/Modernisation.md index 9d4e7f1..21314a3 100644 --- a/docs/wiki/Modernisation.md +++ b/docs/wiki/Modernisation.md @@ -1,4 +1,4 @@ -**English** · [Dansk](Modernisation-da) · [Bahasa Malaysia](Modernisation-ms) +**English** | [Dansk](Modernisation-da) | [Bahasa Malaysia](Modernisation-ms) # Modernisation diff --git a/docs/wiki/_Sidebar.md b/docs/wiki/_Sidebar.md index 009aa7a..097d37e 100644 --- a/docs/wiki/_Sidebar.md +++ b/docs/wiki/_Sidebar.md @@ -1,4 +1,4 @@ -**English** · [Dansk](Home-da) · [Bahasa Malaysia](Home-ms) +**English** | [Dansk](Home-da) | [Bahasa Malaysia](Home-ms) - [Home](Home) - [Lecture steps](Lecture-Steps) diff --git a/docs/wiki/images/01-python-org-home.png b/docs/wiki/images/01-python-org-home.png deleted file mode 100644 index 14763d3..0000000 Binary files a/docs/wiki/images/01-python-org-home.png and /dev/null differ diff --git a/docs/wiki/images/02-event-widget.png b/docs/wiki/images/02-event-widget.png deleted file mode 100644 index 070c536..0000000 Binary files a/docs/wiki/images/02-event-widget.png and /dev/null differ diff --git a/docs/wiki/images/03-event-list-highlighted.png b/docs/wiki/images/03-event-list-highlighted.png deleted file mode 100644 index 479173a..0000000 Binary files a/docs/wiki/images/03-event-list-highlighted.png and /dev/null differ diff --git a/docs/wiki/images/04-output-dictionary.png b/docs/wiki/images/04-output-dictionary.png deleted file mode 100644 index 7f06ef3..0000000 Binary files a/docs/wiki/images/04-output-dictionary.png and /dev/null differ