|
7 | 7 | # package. |
8 | 8 | # FIRST AUTHOR <EMAIL@ADDRESS>, 2016. |
9 | 9 | # |
10 | | -#, fuzzy |
11 | 10 | msgid "" |
12 | 11 | msgstr "" |
13 | 12 | "Project-Id-Version: pythonguide 0.0.1\n" |
14 | 13 | "Report-Msgid-Bugs-To: \n" |
15 | 14 | "POT-Creation-Date: 2016-07-03 01:22+0200\n" |
16 | | -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
17 | | -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 15 | +"PO-Revision-Date: 2016-07-10 21:44+0100\n" |
| 16 | + |
18 | 17 | |
19 | 18 | "MIME-Version: 1.0\n" |
20 | | -"Content-Type: text/plain; charset=utf-8\n" |
| 19 | +"Content-Type: text/plain; charset=UTF-8\n" |
21 | 20 | "Content-Transfer-Encoding: 8bit\n" |
22 | 21 | "Generated-By: Babel 2.3.4\n" |
| 22 | +"X-Generator: Poedit 1.5.4\n" |
| 23 | +"Language: fr\n" |
23 | 24 |
|
24 | 25 | #: ../../scenarios/scrape.rst:2 |
25 | 26 | msgid "HTML Scraping" |
26 | | -msgstr "" |
| 27 | +msgstr "Scraping HTML" |
27 | 28 |
|
28 | 29 | #: ../../scenarios/scrape.rst:5 |
29 | 30 | msgid "Web Scraping" |
30 | | -msgstr "" |
| 31 | +msgstr "Web Scraping" |
31 | 32 |
|
32 | 33 | #: ../../scenarios/scrape.rst:7 |
33 | 34 | msgid "" |
34 | 35 | "Web sites are written using HTML, which means that each web page is a " |
35 | | -"structured document. Sometimes it would be great to obtain some data from" |
36 | | -" them and preserve the structure while we're at it. Web sites don't " |
37 | | -"always provide their data in comfortable formats such as ``csv`` or " |
38 | | -"``json``." |
| 36 | +"structured document. Sometimes it would be great to obtain some data from " |
| 37 | +"them and preserve the structure while we're at it. Web sites don't always " |
| 38 | +"provide their data in comfortable formats such as ``csv`` or ``json``." |
39 | 39 | msgstr "" |
| 40 | +"Les sites web sont écrits en utilisant HTML, ce qui signifie que chaque page " |
| 41 | +"Web est un document structuré. Parfois, il serait bien d'obtenir des données " |
| 42 | +"à partir d'elles et de préserver la structure pendant que nous y sommes. Les " |
| 43 | +"sites web ne fournissent pas toujours leurs données dans des formats " |
| 44 | +"confortables tels que le ``csv`` ou ``json``." |
40 | 45 |
|
41 | 46 | #: ../../scenarios/scrape.rst:12 |
42 | 47 | msgid "" |
43 | | -"This is where web scraping comes in. Web scraping is the practice of " |
44 | | -"using a computer program to sift through a web page and gather the data " |
45 | | -"that you need in a format most useful to you while at the same time " |
46 | | -"preserving the structure of the data." |
| 48 | +"This is where web scraping comes in. Web scraping is the practice of using a " |
| 49 | +"computer program to sift through a web page and gather the data that you " |
| 50 | +"need in a format most useful to you while at the same time preserving the " |
| 51 | +"structure of the data." |
47 | 52 | msgstr "" |
| 53 | +"C'est là où le web scraping entre en jeu. Le web scraping est la pratique " |
| 54 | +"d'utiliser un programme d'ordinateur pour passer au crible d'une page Web et " |
| 55 | +"de recueillir les données dont vous avez besoin dans un format plus utile " |
| 56 | +"pour vous tout en préservant la structure de la donnée." |
48 | 57 |
|
49 | 58 | #: ../../scenarios/scrape.rst:18 |
50 | 59 | msgid "lxml and Requests" |
51 | | -msgstr "" |
| 60 | +msgstr "lxml et Requests" |
52 | 61 |
|
53 | 62 | #: ../../scenarios/scrape.rst:20 |
54 | 63 | msgid "" |
55 | | -"`lxml <http://lxml.de/>`_ is a pretty extensive library written for " |
56 | | -"parsing XML and HTML documents very quickly, even handling messed up tags" |
57 | | -" in the process. We will also be using the `Requests <http://docs.python-" |
58 | | -"requests.org/en/latest/>`_ module instead of the already built-in urllib2" |
59 | | -" module due to improvements in speed and readability. You can easily " |
60 | | -"install both using ``pip install lxml`` and ``pip install requests``." |
61 | | -msgstr "" |
| 64 | +"`lxml <http://lxml.de/>`_ is a pretty extensive library written for parsing " |
| 65 | +"XML and HTML documents very quickly, even handling messed up tags in the " |
| 66 | +"process. We will also be using the `Requests <http://docs.python-requests." |
| 67 | +"org/en/latest/>`_ module instead of the already built-in urllib2 module due " |
| 68 | +"to improvements in speed and readability. You can easily install both using " |
| 69 | +"``pip install lxml`` and ``pip install requests``." |
| 70 | +msgstr "" |
| 71 | +"`lxml <http://lxml.de/>`_ est une bibliothèque assez étendue, écrite pour " |
| 72 | +"analyser des documents XML et HTML très rapidement, manipulant même des " |
| 73 | +"balises invalides au cours du processus. Nous allons aussi utiliser le " |
| 74 | +"module `Requests <http://docs.python-requests.org/en/latest/>`_ à la place " |
| 75 | +"du module urllib2 natif à cause d'améliorations en terme de vitesse et de " |
| 76 | +"lisibilité. Vous pouvez facilement installer les deux en utilisant ``pip " |
| 77 | +"install lxml`` et ``pip install requests``." |
62 | 78 |
|
63 | 79 | #: ../../scenarios/scrape.rst:28 |
64 | 80 | msgid "Let's start with the imports:" |
65 | | -msgstr "" |
| 81 | +msgstr "Commençons avec les imports:" |
66 | 82 |
|
67 | 83 | #: ../../scenarios/scrape.rst:35 |
68 | 84 | msgid "" |
69 | | -"Next we will use ``requests.get`` to retrieve the web page with our data," |
70 | | -" parse it using the ``html`` module and save the results in ``tree``:" |
| 85 | +"Next we will use ``requests.get`` to retrieve the web page with our data, " |
| 86 | +"parse it using the ``html`` module and save the results in ``tree``:" |
71 | 87 | msgstr "" |
| 88 | +"Ensuite, nous utiliserons ``requests.get`` pour récupérer la page web avec " |
| 89 | +"notre donnée, la parser en utilisant le module ``html`` et sauver les " |
| 90 | +"résultats dans `` tree``:" |
72 | 91 |
|
73 | 92 | #: ../../scenarios/scrape.rst:43 |
74 | 93 | msgid "" |
75 | | -"(We need to use ``page.content`` rather than ``page.text`` because " |
76 | | -"``html.fromstring`` implicitly expects ``bytes`` as input.)" |
| 94 | +"(We need to use ``page.content`` rather than ``page.text`` because ``html." |
| 95 | +"fromstring`` implicitly expects ``bytes`` as input.)" |
77 | 96 | msgstr "" |
| 97 | +"(Nous avons besoin d'utiliser ``page.content`` plutôt que ``page.text`` " |
| 98 | +"parce que ``html.fromstring`` attend implicitement des ``bytes`` en entrée.)" |
78 | 99 |
|
79 | 100 | #: ../../scenarios/scrape.rst:46 |
80 | 101 | msgid "" |
81 | | -"``tree`` now contains the whole HTML file in a nice tree structure which " |
82 | | -"we can go over two different ways: XPath and CSSSelect. In this example, " |
83 | | -"we will focus on the former." |
| 102 | +"``tree`` now contains the whole HTML file in a nice tree structure which we " |
| 103 | +"can go over two different ways: XPath and CSSSelect. In this example, we " |
| 104 | +"will focus on the former." |
84 | 105 | msgstr "" |
| 106 | +"``tree`` contient maintenant le fichier HTML entier dans une belle structure " |
| 107 | +"arborescente que nous pouvons parcourir de deux façons différentes: XPath et " |
| 108 | +"CSSSelect. Dans cet exemple, nous allons nous concentrer sur le premier." |
85 | 109 |
|
86 | 110 | #: ../../scenarios/scrape.rst:50 |
87 | 111 | msgid "" |
88 | | -"XPath is a way of locating information in structured documents such as " |
89 | | -"HTML or XML documents. A good introduction to XPath is on `W3Schools " |
90 | | -"<http://www.w3schools.com/xsl/xpath_intro.asp>`_ ." |
| 112 | +"XPath is a way of locating information in structured documents such as HTML " |
| 113 | +"or XML documents. A good introduction to XPath is on `W3Schools <http://www." |
| 114 | +"w3schools.com/xsl/xpath_intro.asp>`_ ." |
91 | 115 | msgstr "" |
| 116 | +"XPath est un moyen de trouver de l'information dans des documents structurés " |
| 117 | +"tels que des documents HTML ou XML. Une bonne introduction à XPath est sur " |
| 118 | +"`W3Schools <http://www.w3schools.com/xsl/xpath_intro.asp>`_ ." |
92 | 119 |
|
93 | 120 | #: ../../scenarios/scrape.rst:54 |
94 | 121 | msgid "" |
95 | 122 | "There are also various tools for obtaining the XPath of elements such as " |
96 | | -"FireBug for Firefox or the Chrome Inspector. If you're using Chrome, you " |
97 | | -"can right click an element, choose 'Inspect element', highlight the code," |
98 | | -" right click again and choose 'Copy XPath'." |
| 123 | +"FireBug for Firefox or the Chrome Inspector. If you're using Chrome, you can " |
| 124 | +"right click an element, choose 'Inspect element', highlight the code, right " |
| 125 | +"click again and choose 'Copy XPath'." |
99 | 126 | msgstr "" |
| 127 | +"Il existe également divers outils pour obtenir le XPath d'éléments comme " |
| 128 | +"Firebug pour Firefox ou l'Inspecteur Chrome. Si vous utilisez Chrome, vous " |
| 129 | +"pouvez faire un clic droit sur un élément, choisissez 'Inspecter', mettez en " |
| 130 | +"surbrillance le code, faites un clic droit à nouveau et choisissez 'Copy' " |
| 131 | +"puis 'Copy XPath' " |
100 | 132 |
|
101 | 133 | #: ../../scenarios/scrape.rst:59 |
102 | 134 | msgid "" |
103 | | -"After a quick analysis, we see that in our page the data is contained in " |
104 | | -"two elements - one is a div with title 'buyer-name' and the other is a " |
105 | | -"span with class 'item-price':" |
| 135 | +"After a quick analysis, we see that in our page the data is contained in two " |
| 136 | +"elements - one is a div with title 'buyer-name' and the other is a span with " |
| 137 | +"class 'item-price':" |
106 | 138 | msgstr "" |
| 139 | +"Après une analyse rapide, nous voyons que dans notre page les données sont " |
| 140 | +"contenues dans deux éléments - l'un est une div avec le titre 'buyer-name' " |
| 141 | +"et l'autre est un span avec la classe 'item-price':" |
107 | 142 |
|
108 | 143 | #: ../../scenarios/scrape.rst:68 |
109 | 144 | msgid "" |
110 | 145 | "Knowing this we can create the correct XPath query and use the lxml " |
111 | 146 | "``xpath`` function like this:" |
112 | 147 | msgstr "" |
| 148 | +"Sachant cela, nous pouvons créer la requête XPath correcte et utiliser la " |
| 149 | +"fonction ``xpath`` lxml comme ceci:" |
113 | 150 |
|
114 | 151 | #: ../../scenarios/scrape.rst:78 |
115 | 152 | msgid "Let's see what we got exactly:" |
116 | | -msgstr "" |
| 153 | +msgstr "Voyons voir ce que nous avons exactement:" |
117 | 154 |
|
118 | 155 | #: ../../scenarios/scrape.rst:98 |
119 | 156 | msgid "" |
120 | | -"Congratulations! We have successfully scraped all the data we wanted from" |
121 | | -" a web page using lxml and Requests. We have it stored in memory as two " |
122 | | -"lists. Now we can do all sorts of cool stuff with it: we can analyze it " |
123 | | -"using Python or we can save it to a file and share it with the world." |
124 | | -msgstr "" |
| 157 | +"Congratulations! We have successfully scraped all the data we wanted from a " |
| 158 | +"web page using lxml and Requests. We have it stored in memory as two lists. " |
| 159 | +"Now we can do all sorts of cool stuff with it: we can analyze it using " |
| 160 | +"Python or we can save it to a file and share it with the world." |
| 161 | +msgstr "" |
| 162 | +"Félicitations! Nous avons scrapé avec succès toutes les données que nous " |
| 163 | +"voulions à partir d'une page Web en utilisant lxml et Requests. Nous les " |
| 164 | +"avons stocké en mémoire, dans deux listes. Maintenant, nous pouvons faire " |
| 165 | +"toutes sortes de trucs cools avec elles: nous pouvons l'analyser en " |
| 166 | +"utilisant Python ou nous pouvons l'enregistrer dans un fichier et les " |
| 167 | +"partager avec le monde." |
125 | 168 |
|
126 | 169 | #: ../../scenarios/scrape.rst:103 |
127 | 170 | msgid "" |
128 | 171 | "Some more cool ideas to think about are modifying this script to iterate " |
129 | 172 | "through the rest of the pages of this example dataset, or rewriting this " |
130 | 173 | "application to use threads for improved speed." |
131 | 174 | msgstr "" |
132 | | - |
| 175 | +"Quelques idées plus cools sur lesquelles réfléchir sont de modifier ce " |
| 176 | +"script pour parcourir le reste des pages de ce jeu de données exemple, ou la " |
| 177 | +"réécriture de cette application pour utiliser les threads pour améliorer la " |
| 178 | +"vitesse." |