Skip to content

Commit

Permalink
scrapují se pouze neoscrapované dny
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkasparek committed Nov 10, 2024
1 parent 05a2f2a commit e997ad9
Show file tree
Hide file tree
Showing 15 changed files with 611,484 additions and 176,251 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ downloads/
data_raw/
.ipynb_checkpoints/
pokus.txt
pokusy
pokusy
cd_*.parquet
ar_*.parquet
le_*.parquet
rj_*.parquet
13 changes: 7 additions & 6 deletions 001_cd_scrapovani.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def cd(odkud, kam, pocet_dni=0):
f"Projáníčka, propáníčka, pro ztracené korále – máme všichni namále: {e}."
)


trasy_a = [("Praha", "Brno"), ("Praha", "Ostrava")]

trasy_b = [
Expand All @@ -132,7 +133,7 @@ def cd(odkud, kam, pocet_dni=0):
("Praha", "Budapešť"),
("Praha", "Vídeň"),
("Praha", "Bratislava"),
("Praha", "Varšava")
("Praha", "Varšava"),
]

trasy_c = [
Expand All @@ -149,18 +150,18 @@ def cd(odkud, kam, pocet_dni=0):
("Praha", "Záhřeb"),
("Praha", "Lublaň"),
("Praha", "Amsterdam"),
("Praha","Krakow")
("Praha", "Krakow"),
]

random.shuffle(trasy_b)
random.shuffle(trasy_c)

trasy = trasy_a + trasy_b[0:2] + [trasy_c[0]]

dny = [0, 1, 2, 3, 4]
dny.append(random.randint(5, 7))
dny.append(random.randint(8, 10))
dny.append(random.randint(11, 15))
dny = [0, 1, 2, 3]
dny.append(random.randint(4, 5))
dny.append(random.randint(6, 7))
dny.append(random.randint(8, 15))
dny.append(random.randint(16, 30))
dny.append(random.randint(31, 90))

Expand Down
5,317 changes: 886 additions & 4,431 deletions 002_cd_cisteni.ipynb

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions 003_rj_scrapovani.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,25 @@ def uloz_stranku(pocet_dni):

pole1.send_keys(Keys.ENTER)

sleep(random.randint(4, 6))
sleep(random.randint(4, 5))
pole2 = wait.until(
EC.presence_of_element_located((By.CSS_SELECTOR, "[aria-label='Kam']"))
)

print("Vyťukávám KAM.")

pole2.send_keys(kam)
sleep(random.randint(3, 5))
sleep(random.randint(3, 4))
pole2.send_keys(Keys.ENTER)
sleep(random.randint(3, 5))
sleep(random.randint(3, 4))

print("Posílám druhý ENTER.")

pole2.send_keys(Keys.ENTER)

wait.until(EC.presence_of_element_located((By.TAG_NAME, "body")))

sleep(random.randint(3, 5))
sleep(random.randint(3, 4))

uloz_stranku(pocet_dni=0)

Expand Down Expand Up @@ -110,19 +110,25 @@ def uloz_stranku(pocet_dni):
except Exception as e:
print(e)

trasy = [
('Praha','Brno'),
trasy_a = [('Praha','Brno'),
('Praha','Ostrava')]

trasy_b = [
('Olomouc','Przemysl'),
('Kolín','Ústí nad Labem'),
('Ostrava','Brno'),
('Brno','Vídeň'),
('Praha','Budapešť'),
('Praha','Košice'),
('Praha','Čop'),
('Praha','Vídeň'),
('Praha','Bratislava'),
('Praha','Krakov')
]

random.shuffle(trasy_b)
trasy = trasy_a + trasy_b[:3]
random.shuffle(trasy)
trasy = trasy[:-3]

for t in trasy:
regiojet(t[0],t[1])
Expand Down
Loading

0 comments on commit e997ad9

Please sign in to comment.