Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Ošetřeno více názvů pro jednu zemi
Browse files Browse the repository at this point in the history
Existuje-li pro jednu zemi více názvů, tak použije pouze ten první, nikoli poslední.
  • Loading branch information
jirutka committed Feb 5, 2012
1 parent 9b3a7ac commit 6f062ee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions csfd.py
Expand Up @@ -33,8 +33,8 @@
# #
# #
# @author Jakub Jirutka <jakub@jirutka.cz> # @author Jakub Jirutka <jakub@jirutka.cz>
# @version 1.0.3 beta # @version 1.0.4 beta
# @date 2011-12-26 # @date 2012-02-05
# #


from urllib.request import Request, urlopen from urllib.request import Request, urlopen
Expand Down Expand Up @@ -147,6 +147,8 @@ def _fetch_data(self, url):
# názvy v dalších zemích # názvy v dalších zemích
for item in profile.xpath("ul[@class='names']/li"): for item in profile.xpath("ul[@class='names']/li"):
country = self._convert_flag(item.find('img').get('src')) country = self._convert_flag(item.find('img').get('src'))
# existuje-li pro jednu zemi více názvů, chceme jen ten první
if (country in self._names): continue
self._names[country] = item.find('h3').text.strip() self._names[country] = item.find('h3').text.strip()


# oficiální název v ČR # oficiální název v ČR
Expand Down

0 comments on commit 6f062ee

Please sign in to comment.