--- title: "[TD] Python (TD 1 Webscraping) - 11/05/2021" tags: Python, TD --- # [TD] Python (TD 1 Webscraping) - 11/05/2021 ``` Intervenant : Cédric Joly Lien des slides : [lien] ``` ON VA TRAVAILLER ## List comprehension ### Ave César ! ```python= "".join([chr(ord(char)-7) for char in cypher]) ``` ### Password Generator [Solution](https://gist.github.com/zulzeen/2f701c5aa39e18261089f3cc2584c2dd) ## Objects and Classes ### Students [Solution](https://gist.github.com/zulzeen/ad6f5a6a4738705adcfbefac3e792991) ```python= @property def nom(self): return self._nom ``` On peut les appeler en tant qu'attributs. ## Webscraping - Objectif : extraire des informations d'un site web - [GOG](https://www.gog.com/games?price=discounted&sort=popularity&page=1) - [Humble Bundle](https://www.humblebundle.com/store/search?sort=bestselling&filter=onsale&hmb_source=store_navbar) - Informations recherchées : - Nom du jeu - Lien vers la page du jeu - Prix normal - Montant de la réduction - Plateformes - On cherche à transformer les données en .csv ### Ce qu'il faut savoir "On a pas le droit de le faire" -> oui mais non (sur un site aussi populaire ils supportent la charge) Quand on scrape on ne tape pas dessus comme un bourrin -> on met en place un cache