-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpartie_2.py
97 lines (82 loc) · 25.4 KB
/
partie_2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import os
import logging
import scrapy
from scrapy.crawler import CrawlerProcess
class BookingSpider(scrapy.Spider):
name = 'booking'
start_urls = [
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Le+Mont-Saint-Michel%2C+Basse-Normandie%2C+France&ssne=Marseille&ssne_untouched=Marseille&lang=fr&src=index&dest_id=900039327&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=eeac816686070261&ac_meta=GhBlZWFjODE2Njg2MDcwMjYxIAAoATICZnI6CGxlIG1vbnQgQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&1",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Saint-Malo%2C+Bretagne%2C+France&ssne=Le+Mont-Saint-Michel&ssne_untouched=Le+Mont-Saint-Michel&lang=fr&src=searchresults&dest_id=-1466824&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=6dc981a5a94703f9&ac_meta=GhA2ZGM5ODFhNWE5NDcwM2Y5IAAoATICZnI6CnNhaW50IG1hbG9AAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&2",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Bayeux%2C+Basse-Normandie%2C+France&ssne=Le+Havre&ssne_untouched=Le+Havre&lang=fr&src=searchresults&dest_id=-1410836&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=cfd9820cb2be0596&ac_meta=GhBjZmQ5ODIwY2IyYmUwNTk2IAAoATICZnI6BmJheWV1eEAASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&3",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Le+Havre%2C+Haute-Normandie%2C+France&ssne=Bayeux&ssne_untouched=Bayeux&lang=fr&src=searchresults&dest_id=-1441598&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=42cc81fe1ad40078&ac_meta=GhA0MmNjODFmZTFhZDQwMDc4IAAoATICZnI6CGxlIGhhdnJlQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&4",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Rouen%2C+Haute-Normandie%2C+France&ssne=Bayeux&ssne_untouched=Bayeux&lang=fr&src=searchresults&dest_id=-1462807&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=4ef7821c0b980639&ac_meta=GhA0ZWY3ODIxYzBiOTgwNjM5IAAoATICZnI6BHJvdWVAAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&5",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Paris%2C+%C3%8Ele-de-France%2C+France&ssne=Rouen&ssne_untouched=Rouen&lang=fr&src=searchresults&dest_id=-1456928&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=2890822754eb0395&ac_meta=GhAyODkwODIyNzU0ZWIwMzk1IAAoATICZnI6BXBhcmlzQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&6",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Amiens%2C+Picardie%2C+France&ssne=Paris&ssne_untouched=Paris&lang=fr&src=searchresults&dest_id=-1407447&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=fe438232933f0163&ac_meta=GhBmZTQzODIzMjkzM2YwMTYzIAAoATICZnI6BWFtaWVuQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&7",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Lille%2C+Nord-Pas-de-Calais%2C+France&ssne=Amiens&ssne_untouched=Amiens&lang=fr&src=searchresults&dest_id=-1447079&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=619e823ecea20106&ac_meta=GhA2MTllODIzZWNlYTIwMTA2IAAoATICZnI6BWxpbGxlQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&8",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Strasbourg%2C+Alsace%2C+France&ssne=Lille&ssne_untouched=Lille&lang=fr&src=searchresults&dest_id=-1471697&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=4f1d8249815201b7&ac_meta=GhA0ZjFkODI0OTgxNTIwMWI3IAAoATICZnI6BnN0cmFzYkAASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&9",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Ch%C3%A2teau+du+Haut-K%C5%93nigsbourg%2C+Saint-Hippolyte%2C+Alsace%2C+France&ssne=Strasbourg&ssne_untouched=Strasbourg&lang=fr&src=searchresults&dest_id=204055&dest_type=landmark&ac_position=2&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=419b82553ef302b5&ac_meta=GhA0MTliODI1NTNlZjMwMmI1IAIoATICZnI6CmNoYXRlYXUgZHVAAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&10",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Colmar%2C+Alsace%2C+France&ssne=Ch%C3%A2teau+du+Haut-K%C5%93nigsbourg&ssne_untouched=Ch%C3%A2teau+du+Haut-K%C5%93nigsbourg&lang=fr&src=searchresults&dest_id=-1421049&dest_type=city&ac_position=1&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=d04d8262dbb4013d&ac_meta=GhBkMDRkODI2MmRiYjQwMTNkIAEoATICZnI6BWNvbWFyQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&11",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Eguisheim%2C+Alsace%2C+France&ssne=Colmar&ssne_untouched=Colmar&lang=fr&src=searchresults&dest_id=-1425030&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=85cd826f57c30024&ac_meta=GhA4NWNkODI2ZjU3YzMwMDI0IAAoATICZnI6BGVndWlAAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&12",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Besan%C3%A7on%2C+Franche-Comt%C3%A9%2C+France&ssne=Eguisheim&ssne_untouched=Eguisheim&lang=fr&src=searchresults&dest_id=-1412198&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=ddf78278c55002e3&ac_meta=GhBkZGY3ODI3OGM1NTAwMmUzIAAoATICZnI6CGJlc2FuY29uQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&13",
"https://www.booking.com/searchresults.fr.html?ss=Dijon%2C+Bourgogne%2C+France&ssne=Collioure&ssne_untouched=Collioure&label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&lang=fr&sb=1&src_elem=sb&src=searchresults&dest_id=-1423981&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=a60e838d58f20018&ac_meta=GhBhNjBlODM4ZDU4ZjIwMDE4IAAoATICZnI6BURpam9uQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&14",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Annecy%2C+Rh%C3%B4ne-Alpes%2C+France&ssne=Dijon&ssne_untouched=Dijon&lang=fr&src=searchresults&dest_id=-1407760&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=8c13829343f20002&ac_meta=GhA4YzEzODI5MzQzZjIwMDAyIAAoATICZnI6BmFubmVjeUAASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&15",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Grenoble%2C+Rh%C3%B4ne-Alpes%2C+France&ssne=Annecy&ssne_untouched=Annecy&lang=fr&src=searchresults&dest_id=-1430647&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=e52b829b610300ba&ac_meta=GhBlNTJiODI5YjYxMDMwMGJhIAAoATICZnI6CGdyZW5vYmxlQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&16",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Lyon%2C+Rh%C3%B4ne-Alpes%2C+France&ssne=Grenoble&ssne_untouched=Grenoble&lang=fr&src=searchresults&dest_id=-1448468&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=54e282a677df02bd&ac_meta=GhA1NGUyODJhNjc3ZGYwMmJkIAAoATICZnI6BGx5b25AAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&17",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Gorges+du+Verdon%2C+France&ssne=Lyon&ssne_untouched=Lyon&lang=fr&src=searchresults&dest_id=2746&dest_type=region&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=931e82ae30a50287&ac_meta=GhA5MzFlODJhZTMwYTUwMjg3IAAoATICZnI6B2dvcmdlcyBAAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&18",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Bormes-les-Mimosas%2C+Provence-Alpes-C%C3%B4te+d%27Azur%2C+France&ssne=Gorges+du+Verdon&ssne_untouched=Gorges+du+Verdon&lang=fr&src=searchresults&dest_id=-1413801&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=e52b82ba84a90032&ac_meta=GhBlNTJiODJiYTg0YTkwMDMyIAAoATICZnI6BWJvcm1lQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&19",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Cassis%2C+Provence-Alpes-C%C3%B4te+d%27Azur%2C+France&ssne=Bormes-les-Mimosas&ssne_untouched=Bormes-les-Mimosas&lang=fr&src=searchresults&dest_id=-1416912&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=560c82d21e3d00e8&ac_meta=GhA1NjBjODJkMjFlM2QwMGU4IAAoATICZnI6BmNhc3Npc0AASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&20",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Marseille%2C+Provence-Alpes-C%C3%B4te+d%27Azur%2C+France&ssne=Cassis&ssne_untouched=Cassis&lang=fr&src=searchresults&dest_id=-1449947&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=a33282db2d4b01c3&ac_meta=GhBhMzMyODJkYjJkNGIwMWMzIAAoATICZnI6CW1hcnNlaWxsZUAASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&21",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Aix-en-Provence%2C+Provence-Alpes-C%C3%B4te+d%27Azur%2C+France&ssne=Marseille&ssne_untouched=Marseille&lang=fr&src=searchresults&dest_id=-1406939&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=dac582e5dac60208&ac_meta=GhBkYWM1ODJlNWRhYzYwMjA4IAAoATICZnI6A2FpeEAASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&22",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Avignon%2C+Provence-Alpes-C%C3%B4te+d%27Azur%2C+France&ssne=Aix-en-Provence&ssne_untouched=Aix-en-Provence&lang=fr&src=searchresults&dest_id=-1409631&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=60f882ef6479024e&ac_meta=GhA2MGY4ODJlZjY0NzkwMjRlIAAoATICZnI6CGF2aWdub25nQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&23",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Uz%C3%A8s%2C+Languedoc-Roussillon%2C+France&ssne=Avignon&ssne_untouched=Avignon&lang=fr&src=searchresults&dest_id=-1474231&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=f3a382fabfd3017c&ac_meta=GhBmM2EzODJmYWJmZDMwMTdjIAAoATICZnI6BHV6ZXNAAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&24",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=N%C3%AEmes%2C+Languedoc-Roussillon%2C+France&ssne=Uz%C3%A8s&ssne_untouched=Uz%C3%A8s&lang=fr&src=searchresults&dest_id=-1455068&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=33c983075a3c037e&ac_meta=GhAzM2M5ODMwNzVhM2MwMzdlIAAoATICZnI6BW5pbWVzQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&25",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Aigues-Mortes%2C+Languedoc-Roussillon%2C+France&ssne=N%C3%AEmes&ssne_untouched=N%C3%AEmes&lang=fr&src=searchresults&dest_id=-1406800&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=2cde830f73fd01c3&ac_meta=GhAyY2RlODMwZjczZmQwMWMzIAAoATICZnI6BmFpZ3Vlc0AASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&26",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Les+Saintes-Maries-de-la-Mer%2C+Provence-Alpes-C%C3%B4te+d%27Azur%2C+France&ssne=Aigues-Mortes&ssne_untouched=Aigues-Mortes&lang=fr&src=searchresults&dest_id=-1465138&dest_type=city&ac_position=1&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=8aa1831944e30245&ac_meta=GhA4YWExODMxOTQ0ZTMwMjQ1IAEoATICZnI6B3NhaW50ZXNAAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&27",
"https://www.booking.com/searchresults.fr.html?label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&ss=Collioure%2C+Languedoc-Roussillon%2C+France&ssne=Les+Saintes-Maries-de-la-Mer&ssne_untouched=Les+Saintes-Maries-de-la-Mer&lang=fr&src=searchresults&dest_id=-1421032&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=1&search_selected=true&search_pageview_id=59a9832dbea20486&ac_meta=GhA1OWE5ODMyZGJlYTIwNDg2IAAoATICZnI6CWNvbGxpb2lyZUAASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&28",
"https://www.booking.com/searchresults.fr.html?ss=Carcassonne%2C+Languedoc-Roussillon%2C+France&ssne=Dijon&ssne_untouched=Dijon&label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&lang=fr&sb=1&src_elem=sb&src=searchresults&dest_id=-1416701&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=675d83e0f92a02d8&ac_meta=GhA2NzVkODNlMGY5MmEwMmQ4IAAoATICZnI6B2NhcmNhc3NAAEoAUAA%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&29",
"https://www.booking.com/searchresults.fr.html?ss=Ari%C3%A8ge%2C+France&ssne=Carcassonne&ssne_untouched=Carcassonne&label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&lang=fr&sb=1&src_elem=sb&src=searchresults&dest_id=2507&dest_type=region&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=65e583f8ad3504b5&ac_meta=GhA2NWU1ODNmOGFkMzUwNGI1IAAoATICZnI6BmFyaWVnZUAASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&30",
"https://www.booking.com/searchresults.fr.html?ss=Toulouse%2C+Midi-Pyr%C3%A9n%C3%A9es%2C+France&ssne=Ari%C3%A8ge&ssne_untouched=Ari%C3%A8ge&label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&lang=fr&sb=1&src_elem=sb&src=searchresults&dest_id=-1473166&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=766784066b3e020f&ac_meta=GhA3NjY3ODQwNjZiM2UwMjBmIAAoATICZnI6CHRvdWxvdXNlQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&31",
"https://www.booking.com/searchresults.fr.html?ss=Montauban%2C+Midi-Pyr%C3%A9n%C3%A9es%2C+France&ssne=Toulouse&ssne_untouched=Toulouse&label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&lang=fr&sb=1&src_elem=sb&src=searchresults&dest_id=-1452421&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=2&search_selected=true&search_pageview_id=e092840efc3c0420&ac_meta=GhBlMDkyODQwZWZjM2MwNDIwIAAoATICZnI6BW1hdXRvQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&32",
"https://www.booking.com/searchresults.fr.html?ss=Biarritz%2C+Aquitaine%2C+France&ssne=Montauban&ssne_untouched=Montauban&label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&lang=fr&sb=1&src_elem=sb&src=searchresults&dest_id=-1412526&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=0f8b8415616b0032&ac_meta=GhAwZjhiODQxNTYxNmIwMDMyIAAoATICZnI6BWJpYXJyQABKAFAA&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&33",
"https://www.booking.com/searchresults.fr.html?ss=Bayonne%2C+Aquitaine%2C+France&ssne=Biarritz&ssne_untouched=Biarritz&label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&lang=fr&sb=1&src_elem=sb&src=searchresults&dest_id=-1410844&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=2454841fff1800c9&ac_meta=GhAyNDU0ODQxZmZmMTgwMGM5IAAoATICZnI6BmJheW9ubkAASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&34",
"https://www.booking.com/searchresults.fr.html?ss=La+Rochelle%2C+Poitou-Charentes%2C+France&ssne=Bayonne&ssne_untouched=Bayonne&label=fr-fr-booking-desktop-DCpBIW3k2*WIo8XuzMdB9AS652796013276%3Apl%3Ata%3Ap1%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-65526620%3Alp9110984%3Ali%3Adec%3Adm&sid=e65e52fe2a16430d6e8e305ab55e10a1&aid=2311236&lang=fr&sb=1&src_elem=sb&src=searchresults&dest_id=-1438604&dest_type=city&ac_position=0&ac_click_type=b&ac_langcode=fr&ac_suggestion_list_length=5&search_selected=true&search_pageview_id=5268842755fc0539&ac_meta=GhA1MjY4ODQyNzU1ZmMwNTM5IAAoATICZnI6BmxhIHJvY0AASgBQAA%3D%3D&checkin=2024-05-13&checkout=2024-05-14&group_adults=2&no_rooms=1&group_children=0&35"
]
def parse(self, response):
result = response.xpath('//div[@data-testid="property-card"]/div[1]/div[2]/div/div[1]/div/div[1]/div/div[1]/div/h3/a[@data-testid="title-link"]/@href').getall()
hotel_url = []
for url in result:
clean_url = str(url).split('?')[0]
hotel_url.append(clean_url)
city_id = response.request.url.split('&')[-1]
for url in hotel_url[0:20]:
request = scrapy.Request(url, callback = self.parse_hotel_page, cb_kwargs = {'city_id': city_id})
yield request
def parse_hotel_page(self, response, city_id):
yield {
'city_id': city_id,
'hotel_name':
response.xpath('//div[1]/div[1]/div[1]/div/div[2]/div[7]/div[1]/div[@id="hp_hotel_name"]/div/h2/text()').get(),
'description':
response.xpath('//div[@data-capla-component-boundary="b-property-web-property-page/PropertyDescriptionDesktop"]/p/text()').get(),
'score':
response.xpath('//div[@data-testid="review-score-right-component"]/div[1]/text()').get(),
'price':
response.xpath('//table[@id="hprt-table"]/tbody/tr[1]/td[3]/div/div/div[1]/div[2]/div/span/text()').
get(),
'url': response.request.url,
'lat_lon':
response.xpath('//div[1]/div[1]/div[1]/div/div[2]/div[7]/p/a').attrib["data-atlas-latlng"]
}
filename = 'booking.json'
# If file already exists delete it before crawling:
if filename in os.listdir('./src/'):
os.remove('./src/' + filename)
process = CrawlerProcess(settings = {
'USER_AGENT': 'Chrome/97.0',
'LOG_LEVEL': logging.INFO,
'FEEDS': {
'./src/' + filename : {'format': 'json'}
}
})
process.crawl(BookingSpider)
process.start()