Changeset 895cd87
- Timestamp:
- 10/01/22 22:55:27 (2 years ago)
- Branches:
- master
- Children:
- fd5b100
- Parents:
- 48f3030
- Location:
- phonelux_scrappers
- Files:
-
- 4 added
- 1 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
phonelux_scrappers/lowest_price_setter.py
r48f3030 r895cd87 1 1 import json 2 2 import psycopg2 3 import requests 3 4 import config_read 4 5 5 import sys 6 6 … … 8 8 sys.stdout = open(file_path, "w") 9 9 10 # Call to read the configuration file and connect to database 11 cinfo = config_read.get_databaseconfig("postgresdb.config") 12 db_connection = psycopg2.connect( 13 database=cinfo[0], 14 host=cinfo[1], 15 user=cinfo[2], 16 password=cinfo[3] 17 ) 18 cur = db_connection.cursor() 19 20 cur.execute('SELECT id,model FROM phones ORDER BY id;') 21 22 phones = cur.fetchall() 10 phones = json.loads(requests.get('http://localhost:8080/phones').text) 23 11 24 12 for phone in phones: 25 phone_id = str(phone[0]) 26 print('id: '+phone_id) 27 cur.execute('SELECT offer_name,price FROM phone_offers WHERE phone_id=' + phone_id + ' ORDER BY price;') 28 details = cur.fetchone() 29 lowestPrice = None 13 phone_id = str(phone['id']) 14 print(phone['model']) 30 15 31 if details is not None: 32 lowestPrice = details[1] 33 cur.execute('UPDATE phones SET lowest_price='+str(lowestPrice)+' WHERE id='+phone_id+';') 34 db_connection.commit() 16 offers = list(json.loads(requests.get('http://localhost:8080/phones/offers/' + phone_id).text)) 17 offers.sort(key=lambda o: o['price']) 18 lowest_price = str(0) 19 if len(offers) > 0: 20 lowest_price = str(offers[0]['price']) 21 print(lowest_price) 35 22 36 cur.close() 37 db_connection.close()23 # UPDATE DATABASE WITH NEW LOWEST PRICE 24 requests.put('http://localhost:8080/setlowestprice/' + phone_id + '/' + lowest_price) -
phonelux_scrappers/outputfile.txt
r48f3030 r895cd87 1 phone id: 3 2 https://admin.ledikom.mk/uploads/items/1500/1649755126honor-50-1-250x300-pad.jpg?v=1 3 phone id: 4 4 https://setec.mk/image/cache/catalog/Product/74172_0-228x228.jpg 5 phone id: 5 6 https://admin.ledikom.mk/uploads/items/412/1641670848apple-iphone-13-1-250x300-pad.jpg?v=1 7 phone id: 6 8 https://admin.ledikom.mk/uploads/items/413/1641671221apple-iphone-13-pro-1-250x300-pad.jpg?v=1 9 phone id: 7 10 https://admin.ledikom.mk/uploads/items/411/1641668143apple-iphone-13-pro-max-1-250x300-pad.jpg?v=1 11 phone id: 8 12 https://admin.ledikom.mk/uploads/items/342/1641664916apple-iphone-12-1-250x300-pad.jpg?v=1 13 phone id: 9 14 https://admin.ledikom.mk/uploads/items/192/1641654006apple-iphone-11-1-250x300-pad.jpg?v=1 15 phone id: 10 16 https://mobitech.mk/wp-content/uploads/2022/01/apple-iphone-xr-new.jpg 17 phone id: 12 18 https://admin.ledikom.mk/uploads/items/372/1642792043samsung-galaxy-a32-1-250x300-pad.jpg?v=1 19 phone id: 13 20 https://admin.ledikom.mk/uploads/items/1501/1649755462honor-50-lite-1-250x300-pad.jpg?v=1 21 phone id: 14 22 https://mobitech.mk/wp-content/uploads/2021/12/apple-iphone-7r4-1.jpg 23 phone id: 15 24 https://mobitech.mk/wp-content/uploads/2021/12/apple-iphone-x-1.jpg 25 phone id: 16 26 https://mobitech.mk/wp-content/uploads/2021/12/apple-iphone-xs-new.jpg 27 phone id: 18 28 https://admin.ledikom.mk/uploads/items/83/1653051611nokia-105-2017-duos-1-250x300-pad.jpg?v=1 29 phone id: 19 30 https://admin.ledikom.mk/uploads/items/1478/1647544681samsung-galaxy-s22-5g-1-250x300-pad.jpg?v=1 31 phone id: 20 32 https://admin.ledikom.mk/uploads/items/392/1642792789samsung-galaxy-a22-5g-1-250x300-pad.jpg?v=1 33 phone id: 21 34 https://admin.ledikom.mk/uploads/items/1563/1651071492samsung-galaxy-a33-5g-1-250x300-pad.jpg?v=1 35 phone id: 22 36 https://www.neptun.mk/2022/04/07/23_e3fe9e55-914d-4ac3-89af-8aea5e659341.JPG?width=192 37 phone id: 23 38 https://admin.ledikom.mk/uploads/items/1497/1649754127samsung-galaxy-a13-1-250x300-pad.jpg?v=1 39 phone id: 24 40 https://mobelix.com.mk/storage/app/uploads/public/5eb/2bf/b67/thumb_2064_550_800_0_0_crop.jpg 41 phone id: 25 42 https://admin.ledikom.mk/uploads/items/3036/1655459489xiaomi-redmi-10-1-250x300-pad.jpg?v=1 43 phone id: 26 44 https://admin.ledikom.mk/uploads/items/1499/1649754737samsung-galaxy-a53-5g-1-250x300-pad.jpg?v=1 45 phone id: 27 46 https://www.neptun.mk/2021/10/09/15571370a_e41b8951-dd67-4951-a899-104b37ff4f9d.jpg?width=192 47 phone id: 28 48 https://admin.ledikom.mk/uploads/items/344/1642708501samsung-galaxy-s21-5g-1-250x300-pad.jpg?v=1 49 phone id: 30 50 https://mobigo.mk/wp-content/uploads/2021/12/huawei-nova-9-5g.jpg 51 phone id: 32 52 https://admin.ledikom.mk/uploads/items/406/1642794048samsung-a03s-1-250x300-pad.jpg?v=1 53 phone id: 34 54 https://mobigo.mk/wp-content/uploads/2021/07/xiaomi-redmi-note10-pro.jpg 55 phone id: 35 56 https://mobigo.mk/wp-content/uploads/2021/01/xiaomi-mi-10t-5g-pro.jpg 57 phone id: 37 58 https://www.a1.mk/documents/20126/2021612/POCO_X3_Pro.png 59 phone id: 38 60 https://admin.ledikom.mk/uploads/items/340/1642705059samsung-galaxy-a02s-1-250x300-pad.jpg?v=1 61 phone id: 40 62 https://admin.ledikom.mk/uploads/items/390/mi10tlite5g-978742-250x300-pad.jpg?v=1 63 phone id: 41 64 https://mobigo.mk/wp-content/uploads/2020/07/samsung-galaxy-a10s.jpg 65 phone id: 42 66 https://setec.mk/image/cache/catalog/Product/73862_0-228x228.jpg 67 phone id: 43 68 https://admin.ledikom.mk/uploads/items/351/1653051682nokia-3310-2017-1-250x300-pad.jpg?v=1 69 phone id: 44 70 https://mobigo.mk/wp-content/uploads/2019/07/huawei-p30-pro.jpg 71 phone id: 45 72 https://mobigo.mk/wp-content/uploads/2019/02/huawei-mate-20-pro-1.jpg 73 phone id: 46 74 https://admin.ledikom.mk/uploads/items/364/1642789715samsung-galaxy-a72-1-250x300-pad.jpg?v=1 75 phone id: 47 76 https://mobelix.com.mk/storage/app/uploads/public/605/319/381/thumb_2496_550_800_0_0_crop.jpg 77 phone id: 48 78 https://mobelix.com.mk/storage/app/uploads/public/605/31a/2d7/thumb_2499_550_800_0_0_crop.jpg 79 phone id: 54 80 https://mobelix.com.mk/storage/app/uploads/public/622/360/d34/thumb_3692_550_800_0_0_crop.png 81 phone id: 55 82 https://mobelix.com.mk/storage/app/uploads/public/5f8/037/ce9/thumb_2308_550_800_0_0_crop.png 83 phone id: 56 84 https://admin.ledikom.mk/uploads/items/395/mi10lite5g-836560-250x300-pad.jpg?v=1 85 phone id: 57 86 https://mobelix.com.mk/storage/app/uploads/public/5f2/bc0/63d/thumb_2194_550_800_0_0_crop.jpg 87 phone id: 58 88 https://mobelix.com.mk/storage/app/uploads/public/5dd/3c7/29c/thumb_1944_550_800_0_0_crop.jpg 89 phone id: 59 90 https://mobelix.com.mk/storage/app/uploads/public/623/876/e71/thumb_3713_550_800_0_0_crop.png 91 phone id: 61 92 https://mobelix.com.mk/storage/app/uploads/public/5de/4e7/f26/thumb_1978_550_800_0_0_crop.jpg 93 phone id: 62 94 https://mobelix.com.mk/storage/app/uploads/public/5e5/3c4/5e6/thumb_2034_550_800_0_0_crop.png 95 phone id: 63 96 https://mobelix.com.mk/storage/app/uploads/public/5de/4e7/49d/thumb_1976_550_800_0_0_crop.jpg 97 phone id: 64 98 https://mobelix.com.mk/storage/app/uploads/public/5c9/0dc/413/thumb_1773_550_800_0_0_crop.jpg 99 phone id: 65 100 https://mobelix.com.mk/storage/app/uploads/public/5cd/053/0ab/thumb_1811_550_800_0_0_crop.jpg 101 phone id: 68 102 https://mobelix.com.mk/storage/app/uploads/public/5bc/877/975/thumb_686_550_800_0_0_crop.jpg 103 phone id: 69 104 https://admin.ledikom.mk/uploads/items/436/1653051842nokia-6310-2021-1-250x300-pad.jpg?v=1 105 phone id: 70 106 https://admin.ledikom.mk/uploads/items/315/1644588871xiaomi-poco-x3-nfc-1-250x300-pad.jpg?v=1 107 phone id: 71 108 https://mobelix.com.mk/storage/app/uploads/public/5fd/343/c47/thumb_2416_550_800_0_0_crop.jpg 109 phone id: 73 110 https://www.neptun.mk/2022/01/13/1150569a91-b4ec-4484-a977-da071903f48b_37266053-7f21-42d2-bde9-ebb29a1220c6.jpg?width=192 111 phone id: 74 112 https://mobelix.com.mk/storage/app/uploads/public/5ff/f06/b11/thumb_2451_550_800_0_0_crop.png 113 phone id: 75 114 https://admin.ledikom.mk/uploads/items/345/1642711031samsung-galaxy-s21-5g-1-250x300-pad.jpg?v=1 115 phone id: 76 116 https://admin.ledikom.mk/uploads/items/362/1653383457asus-rog-phone-5-1-250x300-pad.jpg?v=1 117 phone id: 77 118 https://admin.ledikom.mk/uploads/items/343/1642708100samsung-galaxy-s21-ultra-5g-1-250x300-pad.jpg?v=1 119 phone id: 79 120 https://mobelix.com.mk/storage/app/uploads/public/606/eff/40a/thumb_2684_550_800_0_0_crop.png 121 phone id: 80 122 https://mobelix.com.mk/storage/app/uploads/public/609/2af/b4b/thumb_3135_550_800_0_0_crop.png 123 phone id: 81 124 https://mobelix.com.mk/storage/app/uploads/public/609/2af/c8d/thumb_3137_550_800_0_0_crop.png 125 phone id: 82 126 https://admin.ledikom.mk/uploads/items/359/1642789645samsung-galaxy-a52-1-250x300-pad.jpg?v=1 127 phone id: 83 128 https://admin.ledikom.mk/uploads/items/379/1653381685xiaomi-redmi-note-10-pro-max-1-250x300-pad.jpg?v=1 129 phone id: 85 130 https://setec.mk/image/cache/catalog/Product/60645_0-228x228.jpg 131 phone id: 86 132 https://admin.ledikom.mk/uploads/items/354/1642788228samsung-galaxy-m02s-1-250x300-pad.jpg?v=1 133 phone id: 87 134 https://mobelix.com.mk/storage/app/uploads/public/60d/ed0/0f3/thumb_3191_550_800_0_0_crop.png 135 phone id: 88 136 https://mobelix.com.mk/storage/app/uploads/public/60d/eef/d6a/thumb_3193_550_800_0_0_crop.png 137 phone id: 89 138 https://admin.ledikom.mk/uploads/items/398/1651156416xiaomi-mi-11-ultra-1-250x300-pad.jpg?v=1 139 phone id: 90 140 https://www.neptun.mk/2021/05/18/22222_28c3ee3c-d029-4ccd-a5a6-64aa1ab03fb2.jpg?width=192 141 phone id: 91 142 https://mobelix.com.mk/storage/app/uploads/public/5ee/0f2/e81/thumb_2131_550_800_0_0_crop.png 143 phone id: 98 144 https://www.a1.mk/documents/20126/2346005/Honor-X7-Front.png 145 phone id: 102 146 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/22032022111538download(1).jpg 147 phone id: 106 148 https://www.neptun.mk/2022/02/22/xiaomiredminote11azulestelar01l_367116a3-c5cb-46a0-af2b-b97401a4155f.jpg?width=192 149 phone id: 119 150 https://mobitech.mk/wp-content/uploads/2021/12/apple-iphone-xs-max-new1.jpg 151 phone id: 125 152 https://admin.ledikom.mk/uploads/items/1498/1649754304samsung-galaxy-a23-1-250x300-pad.jpg?v=1 153 phone id: 126 154 https://admin.ledikom.mk/uploads/items/352/1642711564samsung-galaxy-a02-1-250x300-pad.jpg?v=1 155 phone id: 129 156 https://i2.wp.com/mobilezone.mk/wp-content/uploads/2021/08/12-pro-blue.png?resize=512%2C600&ssl=1 157 phone id: 140 158 https://www.a1.mk/documents/20126/2336887/Nokia+C21_Front_Blue.png 159 phone id: 153 160 https://admin.ledikom.mk/uploads/items/429/1641673183apple-iphone-13-mini-1-250x300-pad.jpg?v=1 161 phone id: 156 162 https://admin.ledikom.mk/uploads/items/1477/1647544699samsung-galaxy-s21-fe-5g-1-250x300-pad.jpg?v=1 163 phone id: 173 164 https://www.a1.mk/documents/20126/2315371/Honor-8X-2022-Front-Blue.png 165 phone id: 184 166 https://akcija.com.mk/app/img/products/gallery/2021/07/WIKVIEWBLAST_Wiko_View_4G_Black_32_+_3.webp 167 phone id: 194 168 https://admin.ledikom.mk/uploads/items/1502/1649758047google-pixel-6-1-250x300-pad.jpg?v=1 169 phone id: 195 170 https://mobelix.com.mk/storage/app/uploads/public/612/e29/ab9/thumb_3301_550_800_0_0_crop.png 171 phone id: 196 172 https://admin.ledikom.mk/uploads/items/408/galaxyzfold35g-874417-250x300-pad.jpg?v=1 173 phone id: 199 174 https://www.neptun.mk/2021/11/10/xiaomi11tproblancomedianoche04adl_dcdba358-c8be-4ed6-ada5-0dac8dd6a314.jpg?width=192 175 phone id: 200 176 https://mobelix.com.mk/storage/app/uploads/public/618/11f/35e/thumb_3446_550_800_0_0_crop.png 177 phone id: 201 178 https://www.a1.mk/documents/20126/1900464/A1-Alpha-21.png 179 phone id: 202 180 https://www.a1.mk/documents/20126/2152486/Motorola-MOTO-G60-Front.png 181 phone id: 203 182 https://admin.ledikom.mk/uploads/items/1503/1649766652google-pixel-6-pro-1-250x300-pad.jpg?v=1 183 phone id: 204 184 https://mobelix.com.mk/storage/app/uploads/public/61a/0c6/65d/thumb_3478_550_800_0_0_crop.png 185 phone id: 205 186 https://www.neptun.mk/2021/09/02/720_c7b32e05-41eb-47c4-b2e6-64b19d789d54.jpg?width=192 187 phone id: 206 188 https://admin.ledikom.mk/uploads/items/1485/1649682740xiaomi-redmi-note-11t-5g-1-250x300-pad.jpg?v=1 189 phone id: 207 190 https://mobelix.com.mk/storage/app/uploads/public/61f/26c/5d9/thumb_3564_550_800_0_0_crop.png 191 phone id: 208 192 https://mobelix.com.mk/storage/app/uploads/public/5eb/2cd/447/thumb_2075_550_800_0_0_crop.png 193 phone id: 209 194 https://www.a1.mk/documents/20126/1862420/Nokia-G10.png 195 phone id: 210 196 https://admin.ledikom.mk/uploads/items/299/1642704279samsung-galaxy-note20-1-250x300-pad.jpg?v=1 197 phone id: 211 198 https://admin.ledikom.mk/uploads/items/341/1642707896samsung-galaxy-note20-ultra-5g-1-250x300-pad.jpg?v=1 199 phone id: 214 200 https://mobelix.com.mk/storage/app/uploads/public/621/a31/b32/thumb_3662_550_800_0_0_crop.png 201 phone id: 215 202 https://www.neptun.mk/2022/07/21/54000_0a9e6bb1-320e-4b2e-a10a-0bfd4093b9fc.jpg?width=192 203 phone id: 216 204 https://admin.ledikom.mk/uploads/items/1492/1653141418xiaomi-redmi-note-11-pro-1-250x300-pad.jpg?v=1 205 phone id: 217 206 https://www.a1.mk/documents/20126/2336936/TCL-306_Atlantic-Blue_Front.png 207 phone id: 219 208 https://admin.ledikom.mk/uploads/items/2798/1652776962xiaomi-poco-x4-pro-5g-1-250x300-pad.jpg?v=1 209 phone id: 220 210 https://admin.ledikom.mk/uploads/items/1480/1647546041samsung-galaxy-s22-ultra-5g-1-250x300-pad.jpg?v=1 211 phone id: 221 212 https://mobelix.com.mk/storage/app/uploads/public/5ec/92e/6d3/thumb_2119_550_800_0_0_crop.png 213 phone id: 222 214 https://mobelix.com.mk/storage/app/uploads/public/624/5ca/928/thumb_3764_550_800_0_0_crop.png 215 phone id: 223 216 https://admin.ledikom.mk/uploads/items/1566/1651355303oneplus-10-pro-1-250x300-pad.jpg?v=1 217 phone id: 224 218 https://admin.ledikom.mk/uploads/items/1564/1651071926samsung-galaxy-a73-5g-1-250x300-pad.jpg?v=1 219 phone id: 225 220 https://mobelix.com.mk/storage/app/uploads/public/628/ba6/995/thumb_3840_550_800_0_0_crop.png 221 phone id: 226 222 https://mobelix.com.mk/storage/app/uploads/public/629/ddd/5ac/thumb_3862_550_800_0_0_crop.png 223 phone id: 227 224 https://admin.ledikom.mk/uploads/items/3026/1655278093samsung-galaxy-m33-5g-1-250x300-pad.jpg?v=1 225 phone id: 228 226 https://mobelix.com.mk/storage/app/uploads/public/62c/d2d/bb7/thumb_3883_550_800_0_0_crop.png 227 phone id: 229 228 https://mobelix.com.mk/storage/app/uploads/public/62d/574/ea8/thumb_3889_550_800_0_0_crop.png 229 phone id: 233 230 https://www.neptun.mk/2019/12/31/06a36488-e86c-4599-8c59-7c7a4c588c80_8dbb8b4f-de84-4ae3-8392-5468909ee0e0.png?width=192 231 phone id: 234 232 https://akcija.com.mk/app/img/products/gallery/2022/03/Alcatel_1066G_Black.webp 233 phone id: 235 234 https://www.neptun.mk/2018/08/14/Tiger_L5_Black_Special_v11.23_1c0a6cd6-8705-42ad-a6ba-db7c7b939b7c.jpg?width=192 235 phone id: 237 236 https://admin.ledikom.mk/uploads/items/1488/1649683643xiaomi-redmi-9c-nfc-1-250x300-pad.jpg?v=1 237 phone id: 238 238 https://admin.ledikom.mk/uploads/items/432/redmi9a-48378-250x300-pad.jpg?v=1 239 phone id: 239 240 https://www.neptun.mk/2022/03/21/realmec1120212gb32gb04azuladll_253ab3fd-0f10-4c00-97b3-062c3db73710.jpg?width=192 241 phone id: 240 242 https://akcija.com.mk/app/img/products/gallery/2022/03/Blackview_A80_Black_49835.jpg 243 phone id: 241 244 https://akcija.com.mk/app/img/products/gallery/2021/07/WIKVIEMAXWP2ANTST_Wiko_View_Max_Anthracite.webp 245 phone id: 243 246 https://akcija.com.mk/app/img/products/gallery/2021/07/WIKLENNYWK400ANTST_Wiko_Lenny5_WK400_Anthracit.webp 247 phone id: 244 248 https://www.neptun.mk/2021/06/04/xiaomi-black-shark-4-600x600-600x600_78632f44-8eab-4436-8d92-4c30017fa7c5.jpg?width=192 249 phone id: 245 250 https://www.neptun.mk/2021/10/21/gsmarena004_415d078d-4c7e-43c8-b76c-857922a385b2.jpg?width=192 251 phone id: 246 252 https://www.a1.mk/documents/20126/2315411/Honor-Magic-4-lite-5G-Black-Front.png 253 phone id: 247 254 https://www.a1.mk/documents/20126/2087663/POCO-M4_Pro-5G-black.png 255 phone id: 249 256 https://admin.ledikom.mk/uploads/items/2800/1652862618xiaomi-poco-f4-gt-1-250x300-pad.jpg?v=1 257 phone id: 250 258 https://www.neptun.mk/2022/07/25/Capture1_39933e15-2e42-4fdd-ad50-b26daefc653d.JPG?width=192 259 phone id: 251 260 https://www.neptun.mk/2020/12/29/2.jpeg?width=192 261 phone id: 252 262 https://www.a1.mk/documents/20126/1482115/LG-K52.png 263 phone id: 253 264 https://www.a1.mk/documents/20126/2097647/TCL-20-plus-Milky-Way-Grey.png 265 phone id: 255 266 https://admin.ledikom.mk/uploads/items/400/1653051754nokia-6300-4g-1-250x300-pad.jpg?v=1 267 phone id: 256 268 https://setec.mk/image/cache/catalog/Product/73864_0-228x228.jpg 269 phone id: 257 270 https://www.neptun.mk/2022/07/21/22.JPG?width=192 271 phone id: 260 272 https://www.neptun.mk/2021/11/24/white_542da90b-c215-4e75-b6a0-416d1cbb745c.JPG?width=192 273 phone id: 261 274 https://www.a1.mk/documents/20126/622141/CAT-S62-front.png 275 phone id: 262 276 https://www.a1.mk/documents/20126/622141/CAT-B26.png 277 phone id: 263 278 https://www.a1.mk/documents/20126/2014065/Alcatel-3082-4G.png 279 phone id: 264 280 https://www.a1.mk/documents/20126/1384010/Doro_1370.png 281 phone id: 265 282 https://www.a1.mk/documents/20126/1741700/Alcatel-3080.png 283 phone id: 266 284 https://www.a1.mk/documents/20126/1384010/Doro_2404.png 285 phone id: 267 286 https://www.a1.mk/documents/20126/2065640/Motorola-MOTO-E20.png 287 phone id: 270 288 https://www.neptun.mk/2020/02/05/resizer.php_49f522a0-9f44-4a37-8212-e0e1b2995fa8.jpg?width=192 289 phone id: 271 290 https://setec.mk/image/cache/catalog/Product/48063_0-228x228.jpg 291 phone id: 272 292 https://setec.mk/image/cache/catalog/Product/50397_0-228x228.jpg 293 phone id: 273 294 https://setec.mk/image/cache/catalog/Product/52379_0-228x228.jpg 295 phone id: 274 296 https://setec.mk/image/cache/catalog/Product/53519_0-228x228.jpg 297 phone id: 275 298 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/27062022151936download.jpg 299 phone id: 276 300 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/a60problack_1.jpg 301 phone id: 277 302 https://setec.mk/image/cache/catalog/Product/49840_0-228x228.jpg 303 phone id: 278 304 https://setec.mk/image/cache/catalog/Product/48542_0-228x228.jpg 305 phone id: 279 306 https://setec.mk/image/cache/catalog/Product/52744_0-228x228.jpg 307 phone id: 280 308 https://setec.mk/image/cache/catalog/Product/50394_0-228x228.jpg 309 phone id: 282 310 https://www.neptun.mk/2021/01/27/111_3237af8a-8b15-4e3e-aff8-38a86a1bcb40.jpg?width=192 311 phone id: 285 312 https://www.neptun.mk/2022/03/21/C21Y-Black_3fe958bc-9eeb-4bc6-8cc5-5caa930a4369.jpg?width=192 313 phone id: 286 314 https://setec.mk/image/cache/catalog/Product/49553_0-228x228.jpg 315 phone id: 287 316 https://setec.mk/image/cache/catalog/Product/74712_0-228x228.jpg 317 phone id: 288 318 https://setec.mk/image/cache/catalog/Product/48099_0-228x228.jpg 319 phone id: 289 320 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/g10-auroragrey-front.jpg 321 phone id: 290 322 https://setec.mk/image/cache/catalog/Product/52740_0-228x228.jpg 323 phone id: 291 324 https://setec.mk/image/cache/catalog/Product/74998_0-228x228.jpg 325 phone id: 292 326 https://setec.mk/image/cache/catalog/Product/52389_0-228x228.jpg 327 phone id: 293 328 https://www.neptun.mk/2022/06/23/156755-1200-1200.png?width=192 329 phone id: 294 330 https://setec.mk/image/cache/catalog/Product/75793_0-228x228.jpg 331 phone id: 295 332 https://www.neptun.mk/2022/06/23/156729-1200-1200.png?width=192 333 phone id: 296 334 https://setec.mk/image/cache/catalog/Product/74694_0-228x228.jpg 335 phone id: 297 336 https://www.neptun.mk/2021/10/18/746380-1000x1000_4a0ec6bb-6131-439e-a4b4-406e57caf52e.jpg?width=192 337 phone id: 298 338 https://setec.mk/image/cache/catalog/Product/74996_0-228x228.jpg 339 phone id: 299 340 https://www.neptun.mk/2022/03/21/2_50b1868c-30f0-4a9a-a8c5-180a3868aef5.JPG?width=192 341 phone id: 300 342 https://setec.mk/image//var/www/setec/image/catalog/Product/75706_0.jpg 343 phone id: 301 344 https://setec.mk/image/cache/catalog/Product/74997_0-228x228.jpg 345 phone id: 304 346 https://setec.mk/image/cache/catalog/Product/75805_0-228x228.jpg 347 phone id: 305 348 https://www.neptun.mk/2022/03/22/33.JPG?width=192 349 phone id: 306 350 https://setec.mk/image/cache/catalog/Product/75703_0-228x228.jpg 351 phone id: 307 352 https://setec.mk/image/cache/catalog/Product/74704_0-228x228.jpg 353 phone id: 308 354 https://admin.ledikom.mk/uploads/items/368/1644923487xiaomi-mi-11-lite-1-250x300-pad.jpg?v=1 355 phone id: 309 356 https://www.neptun.mk/2022/06/23/156684-1600-1600.png?width=192 357 phone id: 310 358 https://admin.ledikom.mk/uploads/items/3042/1655899106oneplus-nord-ce-5g-1-250x300-pad.jpg?v=1 359 phone id: 313 360 https://www.neptun.mk/2022/03/21/11_e8705b0f-d153-4b36-b5f5-776e49163dbd.JPG?width=192 361 phone id: 314 362 https://www.neptun.mk/2022/05/13/xiaomi-11t-5g-8gb-128gb-dual-sim-blanco41319a91-e898-4122-9dad-0f3115643b9f_65cc4f17-4add-4eea-a64e-49b60f2d45b1.jpg?width=192 363 phone id: 315 364 https://setec.mk/image/cache/catalog/Product/75403_0-228x228.jpg 365 phone id: 316 366 https://admin.ledikom.mk/uploads/items/2756/1651663563xiaomi-12x-1-250x300-pad.jpg?v=1 367 phone id: 318 368 https://admin.ledikom.mk/uploads/items/1562/1651071199xiaomi-12-1-250x300-pad.jpg?v=1 369 phone id: 319 370 https://admin.ledikom.mk/uploads/items/401/1642796375samsung-galaxy-z-flip3-5g-1-250x300-pad.jpg?v=1 371 phone id: 321 372 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/11022022143748download.jpg 373 phone id: 323 374 https://i2.wp.com/mobilezone.mk/wp-content/uploads/2021/08/12-pro-max-blue.png?resize=512%2C600&ssl=1 375 phone id: 325 376 https://i0.wp.com/mobilezone.mk/wp-content/uploads/2021/08/12-mini-blue.png?resize=512%2C600&ssl=1 377 phone id: 326 378 https://i2.wp.com/mobilezone.mk/wp-content/uploads/2021/08/11-pro-black.png?resize=512%2C600&ssl=1 379 phone id: 327 380 https://i0.wp.com/mobilezone.mk/wp-content/uploads/2021/08/11-pro-max-black.png?resize=512%2C600&ssl=1 381 phone id: 328 382 https://admin.ledikom.mk/uploads/items/1481/1649102984apple-iphone-se-2022-1-250x300-pad.jpg?v=1 383 phone id: 329 384 https://admin.ledikom.mk/uploads/items/1479/1647545279samsung-galaxy-s22-5g-1-250x300-pad.jpg?v=1 385 phone id: 330 386 https://admin.ledikom.mk/uploads/items/297/1642703362samsung-galaxy-a01-core-1-250x300-pad.jpg?v=1 387 phone id: 331 388 phone id: 332 389 phone id: 333 390 phone id: 334 391 phone id: 336 392 https://admin.ledikom.mk/uploads/items/319/1642704346samsung-galaxy-s20-fe-1-250x300-pad.jpg?v=1 393 phone id: 337 394 https://setec.mk/image/cache/catalog/Product/73860_0-228x228.jpg 395 phone id: 338 396 https://admin.ledikom.mk/uploads/items/1486/1649685350xiaomi-redmi-9i-1-250x300-pad.jpg?v=1 397 phone id: 340 398 https://setec.mk/image/cache/catalog/Product/74714_0-228x228.jpg 399 phone id: 341 400 https://www.neptun.mk/2021/06/14/xiaomiredminote105g00v2grisadl_a83a542a-c9d1-4475-8fc7-dae3521b9bc6.jpg?width=192 401 phone id: 342 402 https://www.neptun.mk/2022/07/19/51UhkQTNxmL.ACSL1000_37699529-bf74-498e-9d9b-ecc8e6b57976.jpg?width=192 403 phone id: 343 404 https://www.neptun.mk/2022/05/13/222_e9b3e0e4-4026-4d87-9b5f-44f05b306611.JPG?width=192 405 phone id: 344 406 https://admin.ledikom.mk/uploads/items/3044/1656151222xiaomi-12-pro-1-250x300-pad.jpg?v=1 407 phone id: 345 408 phone id: 346 409 phone id: 348 410 phone id: 349 411 phone id: 350 412 phone id: 351 413 phone id: 352 414 https://admin.ledikom.mk/uploads/items/356/1642789488samsung-galaxy-m62-1-250x300-pad.jpg?v=1 415 phone id: 353 416 phone id: 354 417 phone id: 355 418 phone id: 356 419 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/14102020175047ory-unlocked-global-872783_800x.jpg 420 phone id: 357 421 https://mobelix.com.mk/storage/app/uploads/public/613/094/943/thumb_3309_550_800_0_0_crop.png 422 phone id: 358 423 https://www.neptun.mk/2019/11/19/555.jpg_99d86467-c5a7-42e7-8896-2ff76ac4874d.PNG?width=192 424 phone id: 359 425 https://www.neptun.mk/2019/11/19/555.jpg_e9a27a11-7377-40e5-ba21-2c42a6216ed8.PNG?width=192 426 phone id: 360 427 https://www.neptun.mk/2021/10/25/20200514120927alcatel3025x256mbmetallicblue_5968b52f-10cf-408c-96ee-6ebb76a83d0e.jpeg?width=192 428 phone id: 361 429 https://www.neptun.mk/2021/10/25/71qaRJFLH2L.ACSS450_58ea1f14-bd9f-49a4-91e2-2af91b5826a0.jpg?width=192 430 phone id: 362 431 https://www.neptun.mk/2021/03/15/1122_3c24c189-3b4b-4b37-9d43-1232b082244b.png?width=192 432 phone id: 363 433 https://www.neptun.mk/2021/11/21/Alcatel-1S-2021513x599-1_6c7faa25-0939-4db9-b9ec-b80be480509f.png?width=192 434 phone id: 364 435 https://akcija.com.mk/app/img/products/gallery/2022/03/Alcatel_5024D_1S_3GB-32GB_LTE_Dual-Sim_Metallic_Black.webp 436 phone id: 365 437 https://www.neptun.mk/2020/06/03/12_b9efc36f-7581-4ace-a550-007ac853a6cd.jpg?width=192 438 phone id: 366 439 https://www.a1.mk/documents/20126/2333741/Alcatel-1B_Front.png 440 phone id: 367 441 phone id: 368 442 phone id: 369 443 https://www.neptun.mk/2020/08/14/1122_7fa6daf3-975e-4abe-9edb-197b70ffb150.jpeg?width=192 444 phone id: 370 445 https://www.a1.mk/documents/20126/2142278/Alcatel-1-2021.png 446 phone id: 371 447 phone id: 372 448 phone id: 373 449 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/a70problack.jpg 450 phone id: 374 451 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/c20purple.jpg 452 phone id: 375 453 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/doogee_x96_2gb_32gb_rojo_01_l.jpg 454 phone id: 376 455 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/doogee-x96-pro_arenamobiles.jpg 456 phone id: 377 457 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/10112021121646x95black_1.jpg 458 phone id: 378 459 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/x95black_1.jpg 460 phone id: 379 461 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/thumb_548333_default_big.jpg 462 phone id: 380 463 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/doogee_s58_pro_6gb_64gb_05_negro_ad_l.jpg 464 phone id: 381 465 https://www.neptun.mk/2021/07/02/4_6eaa4b73-2e6d-40b3-86c2-6c5940433cbd.JPG?width=192 466 phone id: 382 467 https://www.neptun.mk/2020/11/17/77_55ded608-c4a7-45f6-84e2-1dd826f4db2c.jpg?width=192 468 phone id: 383 469 https://www.neptun.mk/2021/07/02/1_3c75a06b-29ee-459b-8260-3c065616cf65.JPG?width=192 470 phone id: 384 471 https://www.neptun.mk/2021/11/24/Motorola-Edge-20-Pro-128GB-Midnight-Blue-0840023220623-01102021-01-p_6099d602-c2c4-428c-9560-1dd79df3338d.jpg?width=192 472 phone id: 385 473 https://www.a1.mk/documents/20126/1706113/MOTO-G50.png 474 phone id: 386 475 https://www.neptun.mk/2021/11/04/gsmarena004_6a7fd9b3-8102-4bb7-960b-0c72ca683936.jpg?width=192 476 phone id: 387 477 https://www.neptun.mk/2022/06/23/156709-1600-1600.png?width=192 478 phone id: 388 479 https://www.neptun.mk/2022/06/23/157221-1600-auto.png?width=192 480 phone id: 389 481 https://www.neptun.mk/2022/03/21/51u9-q9539L.SL1000_f04a7be5-ad53-445d-9bde-9a33c0ff3f33.jpg?width=192 482 phone id: 390 483 https://www.neptun.mk/2022/03/21/Realme-9-Pro-Plus-Green_d8eec8b7-5912-4dea-b36b-a3f66832abd4.jpg?width=192 484 phone id: 391 485 https://www.neptun.mk/2022/03/21/222_4c36f6d2-1a4b-4e91-a096-21d115330db2.JPG?width=192 486 phone id: 392 487 https://mobelix.com.mk/storage/app/uploads/public/619/e62/78d/thumb_3468_550_800_0_0_crop.png 488 phone id: 393 489 https://www.neptun.mk/2022/03/21/523920-1000x1000_e0d86853-abff-4048-bd07-e6d6ca0915db.jpg?width=192 490 phone id: 394 491 https://www.neptun.mk/2022/03/21/6935117828220-003-1400Wx1400H_90483936-5a39-47cb-b1c8-f9e868d765c8.jpg?width=192 492 phone id: 395 493 https://www.neptun.mk/2019/10/16/hq_c86c98c2-729b-49d5-aab9-216be2fea777.jpg?width=192 494 phone id: 396 495 phone id: 397 496 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/nokia_106.jpg 497 phone id: 398 498 phone id: 399 499 phone id: 400 500 https://www.neptun.mk/2022/07/08/45_7f5afee7-d808-4111-9853-738a7b5993a3.JPG?width=192 501 phone id: 401 502 https://www.neptun.mk/2022/07/21/1234_97e5321e-7ec0-438b-8c9b-0c89acb73b2f.JPG?width=192 503 phone id: 402 504 https://www.neptun.mk/2022/07/08/333_bda690bd-c2a4-4ee4-82c7-3e4001fd1655.JPG?width=192 505 phone id: 403 506 https://www.neptun.mk/2021/12/16/infinix-note-11-pro-8-128-zeleni-mobilni-6-95-quot-octa-core-mediatek-helio-g96-8gb-128gb-64mpx-13mpx-2mpx-dual-simZFNfn4_2d108fb3-756e-4d1b-a41a-afeae6104ac9.jpg?width=192 507 phone id: 404 508 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/max10black_1.jpg 509 phone id: 405 510 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/flex50gtturnedred.jpg 511 phone id: 406 512 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/09142292_name.jpg 513 phone id: 407 514 phone id: 408 515 phone id: 409 516 phone id: 410 517 phone id: 411 518 phone id: 412 519 phone id: 413 520 phone id: 414 521 phone id: 415 522 https://mobelix.com.mk/storage/app/uploads/public/5cd/051/f4c/thumb_1809_550_800_0_0_crop.jpg 523 phone id: 416 524 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/510095mub.jpg 525 phone id: 417 526 phone id: 418 527 phone id: 419 528 phone id: 420 529 phone id: 421 530 https://i0.wp.com/mobilezone.mk/wp-content/uploads/2021/11/Honor-9x-lite-black.png?resize=512%2C600&ssl=1 531 phone id: 422 532 phone id: 423 533 https://www.a1.mk/documents/20126/2117931/Wiko_Y62.png 534 phone id: 424 535 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/21122021152115ilt-in-camera-main-camera-03-mp.jpg 536 phone id: 425 537 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/21122021141255download.jpg 538 phone id: 426 539 phone id: 427 540 phone id: 428 541 phone id: 429 542 phone id: 430 543 phone id: 431 544 phone id: 432 545 phone id: 433 546 phone id: 434 547 phone id: 435 548 phone id: 436 549 phone id: 437 550 phone id: 438 551 phone id: 439 552 phone id: 440 553 https://admin.ledikom.mk/uploads/items/3040/1655892316oppo-a94-5g-1-250x300-pad.jpg?v=1 554 phone id: 441 555 https://admin.ledikom.mk/uploads/items/3041/1655898755oppo-find-x5-lite-5g-1-250x300-pad.jpg?v=1 556 phone id: 442 557 phone id: 443 558 phone id: 444 559 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/11012022150451veteranivplus_1.jpg 560 phone id: 445 561 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/seniorflipxl_1.jpg 562 phone id: 446 563 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/denver-bas-18300m-1.jpg 564 phone id: 447 565 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/23022022105342123.jpg 566 phone id: 448 567 phone id: 449 568 phone id: 450 569 phone id: 451 570 phone id: 452 571 https://d3mrte3vpewnxc.cloudfront.net/img/products/full/09150922_name.jpg 1 Samsung Galaxy A13 2 9990 3 Apple iPhone 13 4 47499 5 Apple iPhone 13 Pro 6 62690 7 Apple iPhone 12 8 32690 9 Samsung Galaxy S22 Ultra 5G 10 60000 11 Apple iPhone 11 12 23490 13 Samsung Galaxy S22 5G 14 43000 15 Samsung Galaxy S21 FE 16 33800 17 Samsung Galaxy A33 5G 18 17490 19 Apple iPhone 13 Pro Max 20 68890 21 Samsung Galaxy A32 22 13900 23 Samsung Galaxy S22+ 5G 24 50150 25 Apple iPhone 14 Pro 26 71890 27 Xiaomi 12 28 28999 29 Samsung Galaxy A53 5G 30 20290 31 Xiaomi Redmi Note 11 32 11990 33 Xiaomi Redmi 9A 34 6490 35 Huawei Nova 9 36 22900 37 Samsung Galaxy A12 38 9500 39 Samsung Galaxy Z Flip 4 40 58400 41 Apple iPhone 14 42 1 43 Apple iPhone 13 Mini 44 42990 45 Samsung Galaxy A52s 46 18500 47 Xiaomi Redmi 10C 48 9990 49 Apple iPhone SE 50 24600 51 Samsung Galaxy A03s 52 6790 53 Samsung Galaxy A22 5G 54 11700 55 Xiaomi Mi 11 Lite 56 18500 57 Samsung Galaxy A23 58 11790 59 Apple iPhone 14 Pro Max 60 99999 61 Samsung Galaxy Z Fold 4 62 98400 63 Samsung Galaxy A03 64 8490 65 Huawei nova Y70 66 13699 67 Samsung Galaxy Z Flip3 5G 68 38990 69 Huawei Nova 8i 70 19999 71 Samsung Galaxy Z Fold 3 5G 72 69990 73 Xiaomi 11 Lite 5G NE 74 24999 75 Xiaomi Redmi Note 11 Pro 76 16590 77 Xiaomi Mi 11T 5G 78 23400 79 Huawei Nova 9 SE 80 22999 81 Xiaomi Redmi 9 82 9399 83 Huawei nova Y90 84 15999 85 Apple iPhone SE (2022) 86 28290 87 Xiaomi Poco X3 88 13999 89 OnePlus Nord N10 5G 90 18999 91 Samsung Galaxy A52 92 18190 93 Xiaomi Redmi Note 10 94 13999 95 Blackview A70 Pro 96 7399 97 Realme C11 98 6999 99 Honor 50 Lite 100 11990 101 Xiaomi Poco F3 102 21500 103 Huawei P50 Pro 104 58400 105 Xiaomi Redmi 9C 106 6990 107 Xiaomi 12X 108 29900 109 Blackview A55 110 5999 111 OnePlus Nord CE 112 26999 113 Vivo Y72 5G 114 18999 115 Xiaomi Mi 11T Pro 5G 116 33800 117 Xiaomi Poco M3 118 12290 119 Vivo V21 5G 120 24999 121 Vivo Y33s 122 15999 123 Samsung Galaxy A02s 124 8890 125 Motorola Moto G31 126 12899 127 Xiaomi Mi 11 Lite 5G NE 128 25999 129 Alcatel 2019G 130 2290 131 Samsung Galaxy S21+ 5G 132 41790 133 Xiaomi Redmi Note 10 5G 134 13490 135 Xiaomi 11T 136 31999 137 Alcatel 1SE 138 6290 139 Alcatel 1066D 140 1299 141 Xiaomi Redmi Note 9 142 9990 143 Xiaomi Redmi Note 11 Pro+ 5G 144 27999 145 Blackview A80 146 6499 147 Motorola Moto G22 148 11299 149 Xiaomi Poco M3 Pro 5G 150 12999 151 Xiaomi Redmi Note 9S 152 11900 153 Blackview A70 154 7299 155 Xiaomi Redmi 9AT 156 6999 157 Doogee X95 158 5999 159 Xiaomi Redmi Note 10 Pro 160 15990 161 Motorola Edge 20 162 30999 163 Motorola Moto G60 164 16999 165 Honor 50 166 23400 167 Apple iPhone 12 Pro Max 168 66500 169 Apple iPhone 11 Pro Max 170 32690 171 Nokia 105 (2017) 172 1490 173 Samsung Galaxy S21 Ultra 5G 174 52290 175 Motorola Moto E7 Power 176 8999 177 Apple iPhone 11 Pro 178 27790 179 Alcatel 1 180 5499 181 Xiaomi Poco X3 Pro 182 15400 183 Xiaomi Redmi Note 9 Pro 184 15499 185 Blackview A60 Pro 186 6299 187 Blackview Oscal C20 188 5249 189 Realme C21Y 190 7999 191 Vivo Y21 192 11899 193 Samsung Galaxy A20e 194 9699 195 Vivo Y21s 196 13999 197 Nokia 3310 198 3399 199 Xiaomi Mi 10 Lite 5G 200 15990 201 Xiaomi Mi Note 10 Lite 202 19700 203 Samsung Galaxy S21 5G 204 38999 205 Xiaomi Mi 11 Ultra 206 53490 207 Motorola Moto G10 208 10299 209 Alcatel 3026X 210 4499 211 Samsung Galaxy S20 FE 212 22690 213 Xiaomi Redmi Note 11S 214 19999 215 Doogee X96 216 7699 217 Alcatel 2053D 218 2999 219 Alcatel 3025X 220 3999 221 Doogee X93 222 5999 223 Vivo Y20s 224 12499 225 Infinix Hot 11 226 10499 227 Infinix Smart 6 228 7999 229 Panasonic KX-TU160 230 3999 231 Xiaomi 12 Pro 232 54150 233 Xiaomi Mi 10T Pro 5G 234 29900 235 Xiaomi Poco X4 Pro 5G 236 17200 237 Apple iPhone 12 Pro 238 61590 239 Google Pixel 6 Pro 240 61500 241 Samsung Galaxy Note 20 242 36900 243 Xiaomi Poco M4 Pro 5G 244 15999 245 OnePlus 10 Pro 5G 246 52290 247 Wiko View 248 5990 249 Samsung Galaxy A72 250 23300 251 Alcatel 2003D 252 2199 253 Xiaomi Redmi Note 10 Pro Max 254 16490 255 Trevi Max 10 256 1599 257 Honor X8 258 16499 259 Nokia 6310 260 5490 261 Xiaomi 11T Pro 262 47999 263 Samsung Galaxy A02 264 8000 265 Samsung Galaxy A40 266 11999 267 Motorola Moto G71 268 18999 269 Samsung Galaxy Note 20 Ultra 5G 270 50390 271 Samsung Galaxy A73 5G 272 27000 273 Xiaomi Redmi Note 10S 274 14999 275 Blackview A60 276 4999 277 Blackview A80 Plus 278 8999 279 Realme C21 280 8999 281 Motorola Moto G51 282 14999 283 Xiaomi Mi 10T Lite 5G 284 15390 285 OnePlus 9 Pro 286 46200 287 Cubot P30 288 9999 289 Cubot Note 20 290 8999 291 Motorola Moto G30 292 13999 293 Asus ROG Phone 5 294 46100 295 Tesla Smartphone 3.4 296 4999 297 Oppo F11 Pro 298 16600 299 Honor View 20 300 36800 301 Honor 70 302 32999 303 Realme 8i 304 15999 305 OnePlus 9 306 30800 307 Samsung Galaxy M12 308 9500 309 Samsung Galaxy A31 310 16999 311 Xiaomi Redmi 9i 312 8890 313 OnePlus 7T Pro McLaren Edition 314 36900 315 OnePlus 7T 316 27700 317 Oppo A9 318 16600 319 Nokia 8110 4G 320 4300 321 Blackberry Porsche Design P9981 322 19000 323 Asus ROG Phone 2 324 32000 325 Xiaomi Redmi Note 9T 5G 326 12290 327 Motorola Edge 20 Pro 328 44999 329 Xiaomi Poco X3 GT 330 17200 331 Nokia 105 (2019) 332 1999 333 Apple iPhone 12 Mini 334 34999 335 Samsung Galaxy Z Fold 2 336 141499 337 Samsung Galaxy M32 338 14100 339 Alcatel 1S 340 6390 341 Doogee X95 Pro 342 7399 343 Doogee S58 Pro 344 12499 345 Motorola Moto G100 346 30999 347 Motorola Moto G200 348 30999 349 Realme 9i 350 16699 351 Realme 9 Pro+ 352 27999 353 Realme GT Master 354 20300 355 Alcatel 1C 356 4499 357 Trevi Flex 50 GT 358 2199 359 Huawei Honor 8X Max 360 12300 361 Huawei Honor 9X Lite 362 11000 363 Oppo A94 5G 364 15390 365 MeanIT Veteran I 366 1599 367 MeanIT Senior Flip XL 368 3399 369 Denver B242 370 2999 371 Asus ROG Phone 3 372 36900 373 Huawei Y Max 374 12300 375 Apple iPhone X 376 15990 377 Xiaomi Redmi Note 11T 5G 378 18500 379 Motorola G60 380 17999 381 OnePlus 8 Pro 382 40000 383 Samsung Galaxy M52 5G 384 21500 385 Xiaomi Mi 12 Pro 5G 386 54100 387 Alcatel 1066G 388 1190 389 Google Pixel 6 390 40000 391 Wiko View Max 392 7990 393 Xiaomi Black Shark 4 394 29990 395 Tcl 20L+ 396 15999 397 Xiaomi Poco F4 GT 398 47999 399 Samsung Galaxy A51 400 18999 401 Samsung Galaxy A50 402 18999 403 Xiaomi Mi A2 Lite 404 8999 405 Xiaomi Mi Play 406 9999 407 Xiaomi Mi 6 408 9999 409 Xiaomi Mi Max 2 410 6999 411 Xiaomi Mi A3 412 8999 413 Samsung Galaxy A30s 414 13999 415 Samsung Galaxy A41 416 16999 417 Alcatel Pixi 4 Power Plus 418 5999 419 Honor X7 420 13999 421 Energizer Energy E20 422 1999 423 Energizer Energy E241S 424 2299 425 Energizer Hardcase H240S 426 3999 427 Energizer Power Max P550S 428 4999 429 Huawei Mate 10 Lite 430 9999 431 Samsung Galaxy M02s 432 9500 433 Xiaomi Mi 10T 5G 434 24500 435 Xiaomi Redmi 8A 436 7400 437 Huawei P30 Pro 438 29500 439 Huawei P40 Lite E 440 9200 441 Apple iPhone XS 442 17890 443 Apple iPhone XS Max 444 21590 445 Nokia C21 446 8999 447 Alcatel 1S (2021) 448 8999 449 Huawei P50 Pocket 450 76900 451 CAT B26 452 5999 453 Cubot J9 454 5299 455 Samsung Galaxy A21s 456 11199 457 Xiaomi Mi A2 458 13799 459 Alcatel 1V 460 4399 461 Trevi Phablet 5Q2 462 4599 463 Energizer Energy E10 464 1299 465 Huawei P20 466 24999 467 Honor 9 Lite 468 7999 469 Huawei Honor 8X 470 16999 471 Honor 10 Lite 472 8499 473 Wiko Power U20 474 8999 475 Wiko Y62 476 6999 477 Vivax Pro M1 478 4499 479 Vivax Fun S10 480 3999 481 Vivax Fun S20 482 4999 483 Vivax Point X2 484 5999 485 Vivax Fly 5 Lite 486 7499 487 Vivax Fly V1 488 8999 489 Vivax Point X502 490 4499 491 Vivax Point X1 492 6999 493 Vivax Fun S1 494 2999 495 Oppo A15s 496 8999 497 Oppo Reno4 Z 5G 498 18999 499 Oppo Reno5 5G 500 24999 501 Oppo Reno4 Lite 502 15999 503 Oppo Find X5 Lite 504 24590 505 Denver B183 506 1499 507 Noa N2 508 7499 509 Noa Sprint 4G 510 5499 511 Samsung Galaxy J7 512 8999 513 Manta MS1701 514 1099 515 Huawei P10 Lite 516 11999 517 Xiaomi Redmi Note 10T 5G 518 12300 519 Nokia 6300 4G 520 4000 521 Tcl 306 522 9999 523 Oppo Find X3 Lite 524 16000 525 Wiko Lenny 5 526 4290 527 Doro 2404 528 4499 529 AllCall Smooth 4G 530 5499 531 Realme C25Y 532 10999 533 Motorola Moto G41 534 16999 535 Honor Magic4 Lite 536 21999 537 Huawei Honor 7A 538 5999 539 Honor 20 Lite 540 11299 541 Panasonic KX-TU155 542 4699 543 Vivax Fly 6 544 5999 545 Tesla Feature 3 546 1599 547 Noa Fresh 4G 548 2999 549 Samsung Galaxy F12 550 9200 551 Nokia 106 552 1999 553 OnePlus Nord 554 22999 555 Infinix Hot 12i 556 9999 557 Doro 1370 558 4999 559 Apple iPhone XR 560 17290 561 Doogee X96 Pro 562 8799 563 Samsung Galaxy F62 564 18400 565 OnePlus 9R 566 27700 567 Alcatel 3080G 568 4499 569 Motorola Moto E20 570 8999 571 AllCall Brother 4G 572 5499 573 Realme 8 574 14999 575 Huawei Honor 7S 576 7599 577 Motorola Moto G50 578 16999 579 Nokia 110 580 2299 581 Motorola Edge 30 582 31999 583 Realme 9 Pro 584 22499 585 Nokia 8 586 14999 587 OnePlus Nord N100 588 10499 -
phonelux_scrappers/phone_total_offers.py
r48f3030 r895cd87 1 import json 1 2 2 3 import psycopg2 4 import requests 3 5 import config_read 4 6 import sys … … 7 9 sys.stdout = open(file_path, "w") 8 10 9 # Call to read the configuration file and connect to database10 cinfo = config_read.get_databaseconfig("postgresdb.config")11 db_connection = psycopg2.connect(12 database=cinfo[0],13 host=cinfo[1],14 user=cinfo[2],15 password=cinfo[3]16 )17 11 18 cur = db_connection.cursor() 19 20 cur.execute('SELECT id, model FROM phones;') 21 phones = cur.fetchall() 12 phones = json.loads(requests.get('http://localhost:8080/phones').text) 22 13 23 14 for phone in phones: 24 cur.execute('SELECT COUNT(*) FROM phone_offers WHERE phone_id='+str(phone[0])+';')25 15 26 total_offers = cur.fetchone()[0] 16 phone_id = str(phone['id']) 17 totaloffers = requests.get('http://localhost:8080/totaloffers/'+str.join('*', phone['model'].split(' '))).text 27 18 28 cur.execute('UPDATE phones SET total_offers='+str(total_offers)+' WHERE id='+str(phone[0])+';') 29 db_connection.commit() 19 print(phone_id+' - '+totaloffers) 30 20 31 32 cur.close() 33 db_connection.close() 21 # UPDATE DATABASE WITH NEW TOTAL OFFERS 22 requests.put('http://localhost:8080/settotaloffers/' + phone_id + '/' + totaloffers) -
phonelux_scrappers/phones_image_setter.py
r48f3030 r895cd87 1 import unicodedata 2 from datetime import datetime 1 import json 2 import requests 3 import classes.phone 4 import sys 3 5 4 import psycopg25 import config_read6 from bs4 import BeautifulSoup7 import requests8 9 import sys10 6 11 7 file_path = 'outputfile.txt' 12 8 sys.stdout = open(file_path, "w") 13 9 14 # Call to read the configuration file and connect to database 15 cinfo = config_read.get_databaseconfig("postgresdb.config") 16 db_connection = psycopg2.connect( 17 database=cinfo[0], 18 host=cinfo[1], 19 user=cinfo[2], 20 password=cinfo[3] 21 ) 22 cur = db_connection.cursor() 10 phones = json.loads(requests.get('http://localhost:8080/phones').text) 11 for phone in phones: 12 phone_id = str(phone['id']) 13 offers = list(json.loads(requests.get('http://localhost:8080/phones/offers/' + phone_id).text)) 23 14 24 cur.execute('SELECT * FROM PHONES ORDER BY id')15 offers = list(filter(lambda offer: offer['image_url'] is not None, offers)) 25 16 26 db_connection.commit() 27 phones = cur.fetchall() 17 image_url = None 28 18 29 for phone in phones: 30 print(phone) 31 phone_id = phone[0] 32 cur.execute('SELECT phone_offers.image_url FROM phone_offers JOIN phones ON' 33 ' phone_offers.phone_id = phones.id WHERE ' 34 'phones.id='+str(phone_id)+' AND phone_offers.image_url IS NOT NULL LIMIT 1') 35 tuple_image = cur.fetchone() 36 if tuple_image is not None: 37 print(tuple_image[0]) 38 cur.execute('UPDATE phones SET image_url = \''+tuple_image[0]+'\' WHERE id='+str(phone_id)); 39 db_connection.commit() 40 else: 41 print('None'); 19 if len(offers) > 0: 20 image_url = offers[0]['image_url'] 42 21 22 phone['image_url'] = image_url 43 23 44 cur.close() 45 db_connection.close() 24 # UPDATE DATABASE WITH NEW IMAGE URLS FOR PHONES 25 headers = {'Content-type': 'application/json'} 26 requests.put('http://localhost:8080/setimageurl/' + phone_id, headers=headers, data=phone['image_url']) -
phonelux_scrappers/scrappers/a1_scrapper.py
r48f3030 r895cd87 1 1 import unicodedata 2 2 from datetime import datetime 3 3 import json 4 4 import psycopg2 5 5 import config_read 6 6 from bs4 import BeautifulSoup 7 7 import requests 8 import sys 9 import unicodedata 8 10 9 import sys 11 from classes.phoneoffer import PhoneOffer 10 12 11 13 file_path = 'outputfile.txt' 12 14 sys.stdout = open(file_path, "w") 13 15 14 # Call to read the configuration file and connect to database15 cinfo = config_read.get_databaseconfig("../postgresdb.config")16 db_connection = psycopg2.connect(17 database=cinfo[0],18 host=cinfo[1],19 user=cinfo[2],20 password=cinfo[3]21 )22 cur = db_connection.cursor()23 24 16 offer_shop = "A1" # offer shop 25 17 last_updated = datetime.now().date() 26 18 is_validated = False 19 20 # A1 phone offers that are already in database 21 22 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/a1').text)) 23 24 database_offers = [] 25 26 for offer in offers: 27 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 28 offer['ram_memory'], 29 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 30 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 31 offer['image_url'], 32 offer['offer_url'], offer['last_updated'], offer['is_validated'], 33 offer['offer_description'], 34 offer['offer_shop_code']) 35 database_offers.append(phoneOffer) 27 36 28 37 a1_url = 'https://www.a1.mk/webshop/mk/phones' … … 34 43 .find_all('div', {'class', 'dvc-idtfr by4'}) 35 44 45 new_offers = [] 46 36 47 for phone in phones: 37 48 brand = phone.get('data-brand').strip() 38 offer_name = brand +" "+phone.get('data-model').strip()49 offer_name = brand + " " + phone.get('data-model').strip() 39 50 40 51 # if brand not in offer_name: … … 77 88 battery = None 78 89 front_camera = None 90 chipset = None 91 offer_description = None 79 92 80 93 for row in table_rows: … … 100 113 front_camera = row.get_text().replace('Предна камера', '').strip() 101 114 102 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name, price, image_url, offer_url,' \ 103 'ram_memory, rom_memory, battery, back_camera, front_camera, color, cpu, ' \ 104 'operating_system, offer_shop_code, last_updated, is_validated)' \ 105 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 106 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, ram_memory, rom_memory, 107 battery, back_camera, front_camera, color, cpu, operating_system, offer_shop_code, 108 last_updated, is_validated) 109 cur.execute(insert_script, insert_value) 110 db_connection.commit() 115 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 116 color, front_camera, back_camera, chipset, battery, operating_system, cpu, image_url, 117 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 111 118 112 cur.close() 113 db_connection.close() 119 for new_offer in new_offers: 120 flag = False 121 flag_price = False 122 offer_id = None 123 124 for old_offer in database_offers: 125 126 if new_offer.offer_shop_code == old_offer.offer_shop_code: 127 flag = True 128 if new_offer.price != old_offer.price: 129 flag_price = True 130 offer_id = old_offer.offer_id 131 132 if flag: 133 # print('ALREADY IN DATABASE') 134 # print(new_offer) 135 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 136 if flag_price: 137 print('PRICE CHANGED!') # CHANGE PRICE 138 print('offer id: ' + str(offer_id)) 139 headers = {'Content-type': 'application/json'} 140 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 141 headers=headers) 142 else: 143 print('ADDED') # ADD OFFER 144 print(new_offer) 145 headers = {'Content-type': 'application/json'} 146 requests.post('http://localhost:8080/phoneoffer/addoffer', headers=headers, data=json.dumps(new_offer.__dict__, 147 default=str)) 148 149 print('------------------------------------') 150 151 for old_offer in database_offers: 152 flag = False 153 for new_offer in new_offers: 154 if old_offer.offer_shop_code == new_offer.offer_shop_code: 155 flag = True 156 157 if not flag: 158 print('OFFER DELETED') 159 print(old_offer) 160 # DELETE OFFER 161 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) -
phonelux_scrappers/scrappers/akcija_scrapper.py
r48f3030 r895cd87 1 import json 1 2 from datetime import datetime 2 3 … … 7 8 import unicodedata 8 9 import sys 10 from classes.phoneoffer import PhoneOffer 9 11 10 # file_path = '../outputfile.txt'11 #sys.stdout = open(file_path, "w")12 file_path = 'outputfile.txt' 13 sys.stdout = open(file_path, "w") 12 14 13 # Call to read the configuration file and connect to database14 cinfo = config_read.get_databaseconfig("../postgresdb.config")15 db_connection = psycopg2.connect(16 database=cinfo[0],17 host=cinfo[1],18 user=cinfo[2],19 password=cinfo[3]20 )21 cur = db_connection.cursor()22 15 23 16 offer_shop = "Akcija" # offer shop 24 17 last_updated = datetime.now().date() 25 18 is_validated = False 19 20 # Akcija phone offers that are already in database 21 22 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/akcija').text)) 23 24 database_offers = [] 25 26 for offer in offers: 27 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 28 offer['ram_memory'], 29 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 30 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 31 offer['image_url'], 32 offer['offer_url'], offer['last_updated'], offer['is_validated'], 33 offer['offer_description'], 34 offer['offer_shop_code']) 35 database_offers.append(phoneOffer) 36 37 new_offers = [] 26 38 27 39 i = 0 … … 51 63 soup2 = BeautifulSoup(response2.text, 'html.parser') 52 64 65 back_camera = None 66 operating_system = None 67 chipset = None 68 battery = None 69 ram_memory = None 70 rom_memory = None 71 cpu = None 72 front_camera = None 73 color = None 74 offer_shop_code = None 75 53 76 specifications = soup2.find('main', {'id': 'content'}) \ 54 77 .find_all('div', {'class', 'container'})[1].find('div', {'class', 'mb-14'}) \ … … 62 85 str(specification.get_text(separator='\n').strip())) + "\n" 63 86 64 insert_script = 'INSERT INTO phone_offers (offer_shop, brand,' \ 65 ' offer_name, price, image_url, offer_url, last_updated, is_validated, offer_description) ' \ 66 'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s);' 67 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, 68 last_updated, is_validated, offer_description) 69 cur.execute(insert_script, insert_value) 70 db_connection.commit() 87 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 88 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 89 image_url, 90 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 71 91 i += 20 72 92 73 cur.close() 74 db_connection.close() 93 for new_offer in new_offers: 94 flag = False 95 flag_price = False 96 offer_id = None 97 98 for old_offer in database_offers: 99 100 if new_offer.offer_name == old_offer.offer_name: 101 flag = True 102 if new_offer.price != old_offer.price: 103 flag_price = True 104 offer_id = old_offer.offer_id 105 106 if flag: 107 # print('ALREADY IN DATABASE') 108 # print(new_offer) 109 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 110 if flag_price: 111 print('PRICE CHANGED!') # CHANGE PRICE 112 print('offer id: ' + str(offer_id)) 113 headers = {'Content-type': 'application/json'} 114 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 115 headers=headers) 116 else: 117 print('ADDED') # ADD OFFER 118 print(new_offer) 119 headers = {'Content-type': 'application/json'} 120 requests.post('http://localhost:8080/phoneoffer/addoffer', 121 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 122 123 print('------------------------------------') 124 125 for old_offer in database_offers: 126 flag = False 127 for new_offer in new_offers: 128 if old_offer.offer_name == new_offer.offer_name: 129 flag = True 130 131 if not flag: 132 print('OFFER DELETED') 133 print(old_offer) 134 # DELETE OFFER 135 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) -
phonelux_scrappers/scrappers/handy_scrapper.py
r48f3030 r895cd87 1 import json 1 2 import unicodedata 2 3 from datetime import datetime … … 9 10 import sys 10 11 12 from classes.phoneoffer import PhoneOffer 13 11 14 file_path = 'outputfile.txt' 12 15 sys.stdout = open(file_path, "w") 13 16 14 # Call to read the configuration file and connect to database15 cinfo = config_read.get_databaseconfig("../postgresdb.config")16 db_connection = psycopg2.connect(17 database=cinfo[0],18 host=cinfo[1],19 user=cinfo[2],20 password=cinfo[3]21 )22 cur = db_connection.cursor()23 17 24 18 offer_shop = "Handy" # offer shop 25 19 last_updated = datetime.now().date() 26 20 is_validated = False 21 22 # Handy phone offers that are already in database 23 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/handy').text)) 24 25 database_offers = [] 26 27 for offer in offers: 28 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 29 offer['ram_memory'], 30 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 31 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 32 offer['image_url'], 33 offer['offer_url'], offer['last_updated'], offer['is_validated'], 34 offer['offer_description'], 35 offer['offer_shop_code']) 36 database_offers.append(phoneOffer) 37 38 new_offers = [] 27 39 28 40 handy_url = 'https://www.handy.mk/telefoni?page=6' … … 44 56 soup2 = BeautifulSoup(response2.text, 'html.parser') 45 57 58 back_camera = None 59 operating_system = None 60 chipset = None 61 battery = None 62 ram_memory = None 63 rom_memory = None 64 cpu = None 65 front_camera = None 66 offer_shop_code = None 67 color = None 68 image_url = None 69 46 70 color_section = soup2.find('section', {'data-hook': 'product-colors-title-section'}) 47 48 color = None49 71 if color_section is not None: 50 temp_colors = color_section.find('fieldset', {'class': 'ColorPickerbase35 63640754__container'})\72 temp_colors = color_section.find('fieldset', {'class': 'ColorPickerbase3548966286__container'})\ 51 73 .find_all('input', {'type': 'radio'}) 52 74 colors_list = [] … … 67 89 offer_description = '\n'.join(specifications) 68 90 69 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name , price, offer_url, ' \ 70 'offer_description, last_updated, is_validated)' \ 71 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s);' 72 insert_value = (offer_shop, brand, offer_name, price, offer_url, offer_description, 73 last_updated, is_validated) 74 cur.execute(insert_script, insert_value) 75 db_connection.commit() 91 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 92 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 93 image_url, 94 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 76 95 77 cur.close() 78 db_connection.close() 96 for new_offer in new_offers: 97 flag = False 98 flag_price = False 99 offer_id = None 100 101 for old_offer in database_offers: 102 103 if new_offer.offer_name == old_offer.offer_name: 104 flag = True 105 if new_offer.price != old_offer.price: 106 flag_price = True 107 offer_id = old_offer.offer_id 108 109 if flag: 110 # print('ALREADY IN DATABASE') 111 # print(new_offer) 112 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 113 if flag_price: 114 print('PRICE CHANGED!') # CHANGE PRICE 115 print('offer id: ' + str(offer_id)) 116 headers = {'Content-type': 'application/json'} 117 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 118 headers=headers) 119 else: 120 print('ADDED') # ADD OFFER 121 print(new_offer) 122 headers = {'Content-type': 'application/json'} 123 requests.post('http://localhost:8080/phoneoffer/addoffer', 124 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 125 126 print('------------------------------------') 127 128 for old_offer in database_offers: 129 flag = False 130 for new_offer in new_offers: 131 if old_offer.offer_name == new_offer.offer_name: 132 flag = True 133 134 if not flag: 135 print('OFFER DELETED') 136 print(old_offer) 137 # DELETE OFFER 138 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) 139 140 -
phonelux_scrappers/scrappers/ledikom_scrapper.py
r48f3030 r895cd87 1 import json 1 2 import unicodedata 2 3 from datetime import datetime 3 4 4 import psycopg2 5 5 import config_read … … 10 10 import sys 11 11 12 from classes.phoneoffer import PhoneOffer 13 12 14 file_path = 'outputfile.txt' 13 15 sys.stdout = open(file_path, "w") 14 15 # Call to read the configuration file and connect to database16 cinfo = config_read.get_databaseconfig("../postgresdb.config")17 db_connection = psycopg2.connect(18 database=cinfo[0],19 host=cinfo[1],20 user=cinfo[2],21 password=cinfo[3]22 )23 cur = db_connection.cursor()24 16 25 17 offer_shop = "Ledikom" # offer shop 26 18 last_updated = datetime.now().date() 27 19 is_validated = False 20 21 # Ledikom phone offers that are already in database 22 23 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/ledikom').text)) 24 25 database_offers = [] 26 27 for offer in offers: 28 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 29 offer['ram_memory'], 30 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 31 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 32 offer['image_url'], 33 offer['offer_url'], offer['last_updated'], offer['is_validated'], 34 offer['offer_description'], 35 offer['offer_shop_code']) 36 database_offers.append(phoneOffer) 37 38 new_offers = [] 28 39 29 40 ledikom_phone_urls = [ … … 65 76 offer_name = ' '.join(temp_offer_name.split()) 66 77 brand = offer_name.split(' ')[0] 67 price = int(phone.find('span', {'class': 'price'}).get_text().replace('ден.', '').replace('.', '').strip()) 78 price = int(phone.find('span', {'class': 'price'}).get_text().replace('ден.', '') 79 .replace('ден', '') 80 .replace('.', '').strip()) 68 81 69 82 driver1 = webdriver.Safari(executable_path='/usr/bin/safaridriver') … … 82 95 rom_memory = None 83 96 ram_memory = None 97 back_camera = None 98 operating_system = None 99 chipset = None 100 battery = None 101 cpu = None 102 front_camera = None 103 offer_shop_code = None 104 offer_description = None 84 105 85 106 if len(specifications) != 0: … … 114 135 color = temp 115 136 116 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name, price, image_url, offer_url,' \ 117 'ram_memory, rom_memory, color, last_updated, is_validated)' \ 118 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 119 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, ram_memory, 120 rom_memory, color, last_updated, is_validated) 121 cur.execute(insert_script, insert_value) 122 db_connection.commit() 137 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 138 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 139 image_url, 140 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 123 141 124 cur.close() 125 db_connection.close() 142 for new_offer in new_offers: 143 flag = False 144 flag_price = False 145 offer_id = None 146 147 for old_offer in database_offers: 148 149 if new_offer.offer_name == old_offer.offer_name: 150 flag = True 151 if new_offer.price != old_offer.price: 152 flag_price = True 153 offer_id = old_offer.offer_id 154 155 if flag: 156 # print('ALREADY IN DATABASE') 157 # print(new_offer) 158 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 159 if flag_price: 160 print('PRICE CHANGED!') # CHANGE PRICE 161 print('offer id: ' + str(offer_id)) 162 headers = {'Content-type': 'application/json'} 163 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 164 headers=headers) 165 else: 166 print('ADDED') # ADD OFFER 167 print(new_offer) 168 headers = {'Content-type': 'application/json'} 169 requests.post('http://localhost:8080/phoneoffer/addoffer', 170 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 171 172 print('------------------------------------') 173 174 for old_offer in database_offers: 175 flag = False 176 for new_offer in new_offers: 177 if old_offer.offer_name == new_offer.offer_name: 178 flag = True 179 180 if not flag: 181 print('OFFER DELETED') 182 print(old_offer) 183 # DELETE OFFER 184 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) -
phonelux_scrappers/scrappers/mobelix_scrapper.py
r48f3030 r895cd87 1 import json 2 import sys 1 3 import unicodedata 2 4 from datetime import datetime … … 8 10 9 11 # import sys 10 # 11 # file_path = 'outputfile.txt' 12 # sys.stdout = open(file_path, "w") 12 from classes.phoneoffer import PhoneOffer 13 13 14 # Call to read the configuration file and connect to database 15 cinfo = config_read.get_databaseconfig("../postgresdb.config") 16 db_connection = psycopg2.connect( 17 database=cinfo[0], 18 host=cinfo[1], 19 user=cinfo[2], 20 password=cinfo[3] 21 ) 22 cur = db_connection.cursor() 14 file_path = 'outputfile.txt' 15 sys.stdout = open(file_path, "w") 23 16 24 17 offer_shop = "Mobelix" # offer shop 25 18 last_updated = datetime.now().date() 26 19 is_validated = False 20 21 # Mobelix phone offers that are already in database 22 23 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/mobelix').text)) 24 25 database_offers = [] 26 27 for offer in offers: 28 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 29 offer['ram_memory'], 30 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 31 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 32 offer['image_url'], 33 offer['offer_url'], offer['last_updated'], offer['is_validated'], 34 offer['offer_description'], 35 offer['offer_shop_code']) 36 database_offers.append(phoneOffer) 37 38 new_offers = [] 27 39 28 40 for i in range(1, 17): … … 77 89 back_camera = '' 78 90 cpu = None 91 offer_shop_code = None 92 offer_description = None 79 93 80 94 for table in tables: … … 120 134 back_camera = None 121 135 122 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name, price, image_url, offer_url,' \ 123 'ram_memory, rom_memory, battery, back_camera, front_camera, color, cpu, chipset, ' \ 124 'operating_system, last_updated, is_validated)' \ 125 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 126 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, ram_memory, rom_memory, 127 battery, back_camera, front_camera, color, cpu, chipset, operating_system, 128 last_updated, is_validated) 129 cur.execute(insert_script, insert_value) 130 db_connection.commit() 136 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 137 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 138 image_url, 139 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 131 140 132 cur.close() 133 db_connection.close() 141 142 for new_offer in new_offers: 143 flag = False 144 flag_price = False 145 offer_id = None 146 147 for old_offer in database_offers: 148 149 if new_offer.offer_name == old_offer.offer_name: 150 flag = True 151 if new_offer.price != old_offer.price: 152 flag_price = True 153 offer_id = old_offer.offer_id 154 155 if flag: 156 # print('ALREADY IN DATABASE') 157 # print(new_offer) 158 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 159 if flag_price: 160 print('PRICE CHANGED!') # CHANGE PRICE 161 print('offer id: ' + str(offer_id)) 162 headers = {'Content-type': 'application/json'} 163 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 164 headers=headers) 165 else: 166 print('ADDED') # ADD OFFER 167 print(new_offer) 168 headers = {'Content-type': 'application/json'} 169 requests.post('http://localhost:8080/phoneoffer/addoffer', 170 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 171 172 print('------------------------------------') 173 174 for old_offer in database_offers: 175 flag = False 176 for new_offer in new_offers: 177 if old_offer.offer_name == new_offer.offer_name: 178 flag = True 179 180 if not flag: 181 print('OFFER DELETED') 182 print(old_offer) 183 # DELETE OFFER 184 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) -
phonelux_scrappers/scrappers/mobigo_scrapper.py
r48f3030 r895cd87 1 import json 2 import unicodedata 1 3 from datetime import datetime 2 4 … … 5 7 from bs4 import BeautifulSoup 6 8 import requests 9 import sys 7 10 8 # import sys 9 # 10 # file_path = 'outputfile.txt' 11 # sys.stdout = open(file_path, "w") 11 from classes.phoneoffer import PhoneOffer 12 12 13 # Call to read the configuration file and connect to database 14 cinfo = config_read.get_databaseconfig("../postgresdb.config") 15 db_connection = psycopg2.connect( 16 database=cinfo[0], 17 host=cinfo[1], 18 user=cinfo[2], 19 password=cinfo[3] 20 ) 21 cur = db_connection.cursor() 13 file_path = 'outputfile.txt' 14 sys.stdout = open(file_path, "w") 22 15 23 16 offer_shop = "Mobi Go" # offer shop 24 17 last_updated = datetime.now().date() 25 18 is_validated = False 19 20 # Mobi Go phone offers that are already in database 21 22 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/mobigo').text)) 23 24 database_offers = [] 25 26 for offer in offers: 27 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 28 offer['ram_memory'], 29 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 30 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 31 offer['image_url'], 32 offer['offer_url'], offer['last_updated'], offer['is_validated'], 33 offer['offer_description'], 34 offer['offer_shop_code']) 35 database_offers.append(phoneOffer) 36 37 new_offers = [] 38 39 26 40 for i in range(1, 6): 27 41 mobigo_url = "https://mobigo.mk/page/" + str(i) + "/" … … 55 69 specifications = soup2.find('table', {'id': 'singlet'}).find_all('tr') 56 70 57 ram_memory = "" 58 rom_memory = "" 59 battery = "" 60 back_camera = "" 61 front_camera = "" 62 chipset = "" 63 operating_system = "" 71 ram_memory = None 72 rom_memory = None 73 battery = None 74 back_camera = None 75 front_camera = None 76 chipset = None 77 operating_system = None 78 cpu = None 79 offer_shop_code = None 80 offer_description = None 81 color = None 64 82 65 83 for specification in specifications: … … 111 129 battery = None 112 130 113 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name, price, image_url, offer_url, ram_memory,' \ 114 ' rom_memory, battery, back_camera, front_camera, chipset, operating_system, last_updated, is_validated)' \ 115 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 116 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, ram_memory, 117 rom_memory, battery, back_camera, front_camera, chipset, operating_system, last_updated, is_validated) 118 cur.execute(insert_script, insert_value) 119 db_connection.commit() 131 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 132 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 133 image_url, 134 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 120 135 121 cur.close() 122 db_connection.close() 136 137 for new_offer in new_offers: 138 flag = False 139 flag_price = False 140 offer_id = None 141 142 for old_offer in database_offers: 143 144 if new_offer.offer_name == old_offer.offer_name: 145 flag = True 146 if new_offer.price != old_offer.price: 147 flag_price = True 148 offer_id = old_offer.offer_id 149 150 if flag: 151 print('ALREADY IN DATABASE') 152 print(new_offer) 153 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 154 if flag_price: 155 print('PRICE CHANGED!') # CHANGE PRICE 156 print('offer id: ' + str(offer_id)) 157 headers = {'Content-type': 'application/json'} 158 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 159 headers=headers) 160 else: 161 print('ADDED') # ADD OFFER 162 print(new_offer) 163 headers = {'Content-type': 'application/json'} 164 requests.post('http://localhost:8080/phoneoffer/addoffer', 165 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 166 167 print('------------------------------------') 168 169 for old_offer in database_offers: 170 flag = False 171 for new_offer in new_offers: 172 if old_offer.offer_name == new_offer.offer_name: 173 flag = True 174 175 if not flag: 176 print('OFFER DELETED') 177 print(old_offer) 178 # DELETE OFFER 179 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) -
phonelux_scrappers/scrappers/mobilezone_scrapper.py
r48f3030 r895cd87 1 import json 1 2 import unicodedata 2 3 from datetime import datetime … … 6 7 from selenium import webdriver 7 8 import requests 9 import sys 8 10 9 import sys 11 from classes.phoneoffer import PhoneOffer 10 12 11 13 file_path = 'outputfile.txt' 12 14 sys.stdout = open(file_path, "w") 13 15 14 # Call to read the configuration file and connect to database15 cinfo = config_read.get_databaseconfig("../postgresdb.config")16 db_connection = psycopg2.connect(17 database=cinfo[0],18 host=cinfo[1],19 user=cinfo[2],20 password=cinfo[3]21 )22 cur = db_connection.cursor()23 24 16 offer_shop = "Mobile Zone" # offer shop 25 17 last_updated = datetime.now().date() 26 18 is_validated = False 19 20 # Mobile Zone phone offers that are already in database 21 22 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/mobilezone').text)) 23 24 database_offers = [] 25 26 for offer in offers: 27 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 28 offer['ram_memory'], 29 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 30 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 31 offer['image_url'], 32 offer['offer_url'], offer['last_updated'], offer['is_validated'], 33 offer['offer_description'], 34 offer['offer_shop_code']) 35 database_offers.append(phoneOffer) 36 37 new_offers = [] 27 38 28 39 for i in range(1, 3): … … 54 65 offer_name = brand + ' ' + offer_name 55 66 56 price = int(unicodedata.normalize('NFKD', phone.find('span', {'class': 'woocommerce-Price-amount amount'}) 57 .find('bdi').get_text().replace(',', '').replace('ден', '').strip())) 67 price_tag = phone.find('span', {'class': 'woocommerce-Price-amount amount'}) 68 price = None 69 70 if price_tag is not None: 71 price = int(unicodedata.normalize('NFKD', price_tag.find('bdi').get_text() 72 .replace(',', '') 73 .replace('ден', '').strip())) 74 else: 75 continue 58 76 59 77 response2 = requests.get(offer_url) … … 65 83 front_camera = None 66 84 rom_memory = None 85 ram_memory = None 86 operating_system = None 87 cpu = None 88 chipset = None 89 offer_description = None 90 offer_shop_code = None 67 91 battery = None 68 92 color = None … … 84 108 color = specification.find('td').get_text().strip() 85 109 110 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 111 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 112 image_url, 113 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 86 114 115 for new_offer in new_offers: 116 flag = False 117 flag_price = False 118 offer_id = None 87 119 88 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name , price, offer_url, image_url, ' \ 89 'rom_memory, battery, color, front_camera, back_camera, last_updated, is_validated)' \ 90 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 91 insert_value = (offer_shop, brand, offer_name, price, offer_url, image_url, rom_memory, battery, color, 92 front_camera, back_camera, last_updated, is_validated) 93 cur.execute(insert_script, insert_value) 94 db_connection.commit() 120 for old_offer in database_offers: 95 121 96 cur.close() 97 db_connection.close() 122 if new_offer.offer_name == old_offer.offer_name: 123 flag = True 124 if new_offer.price != old_offer.price: 125 flag_price = True 126 offer_id = old_offer.offer_id 127 128 if flag: 129 # print('ALREADY IN DATABASE') 130 # print(new_offer) 131 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 132 if flag_price: 133 print('PRICE CHANGED!') # CHANGE PRICE 134 print('offer id: ' + str(offer_id)) 135 headers = {'Content-type': 'application/json'} 136 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 137 headers=headers) 138 else: 139 print('ADDED') # ADD OFFER 140 print(new_offer) 141 headers = {'Content-type': 'application/json'} 142 requests.post('http://localhost:8080/phoneoffer/addoffer', 143 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 144 145 print('------------------------------------') 146 147 for old_offer in database_offers: 148 flag = False 149 for new_offer in new_offers: 150 if old_offer.offer_name == new_offer.offer_name: 151 flag = True 152 153 if not flag: 154 print('OFFER DELETED') 155 print(old_offer) 156 # DELETE OFFER 157 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) -
phonelux_scrappers/scrappers/mobitech_scrapper.py
r48f3030 r895cd87 1 import json 2 import unicodedata 1 3 from datetime import datetime 2 4 … … 5 7 from bs4 import BeautifulSoup 6 8 import requests 9 import sys 7 10 8 # import sys 9 # file_path = 'outputfile.txt' 10 # sys.stdout = open(file_path, "w") 11 from classes.phoneoffer import PhoneOffer 11 12 12 # Call to read the configuration file and connect to database 13 cinfo = config_read.get_databaseconfig("../postgresdb.config") 14 db_connection = psycopg2.connect( 15 database=cinfo[0], 16 host=cinfo[1], 17 user=cinfo[2], 18 password=cinfo[3] 19 ) 20 cur = db_connection.cursor() 13 file_path = 'outputfile.txt' 14 sys.stdout = open(file_path, "w") 15 21 16 22 17 mobitech_url = "https://mobitech.mk/shop/" … … 29 24 30 25 offer_shop = "Mobitech" # offer shop 26 last_updated = datetime.now().date() 31 27 is_validated = False 28 29 # Mobitech phone offers that are already in database 30 31 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/mobitech').text)) 32 33 database_offers = [] 34 35 for offer in offers: 36 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 37 offer['ram_memory'], 38 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 39 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 40 offer['image_url'], 41 offer['offer_url'], offer['last_updated'], offer['is_validated'], 42 offer['offer_description'], 43 offer['offer_shop_code']) 44 database_offers.append(phoneOffer) 45 46 new_offers = [] 32 47 33 48 for phone in phones: … … 40 55 temp_prices = phone.find('div', {'class': 'jet-woo-product-price'}).find_all('bdi') 41 56 price = int(float(temp_prices[len(temp_prices) - 1].get_text().replace("ден", "").replace(",", "").strip())) # price 42 last_updated = datetime.now().date() # offer last_updated date43 57 44 58 response2 = requests.get(offer_url) … … 47 61 specifications = soup2.find_all('h2', {'class': 'elementor-heading-title elementor-size-default'}) 48 62 49 ram_memory = "" 50 rom_memory = "" 51 battery = "" 52 back_camera = "" 53 operating_system = "" 63 ram_memory = None 64 rom_memory = None 65 battery = None 66 back_camera = None 67 front_camera = None 68 operating_system = None 69 chipset = None 70 color = None 71 offer_shop_code = None 72 cpu = None 73 offer_description = None 54 74 55 75 for specification in specifications: … … 62 82 # ram memory 63 83 if specification.get_text().startswith("РАМ Меморија:"): 64 ram_memory = specification.get_text().split("РАМ Меморија:")[1].strip() 84 ram_memory = specification.get_text().split("РАМ Меморија:")[1].replace('RAM', '')\ 85 .replace('Ram', '').strip() 65 86 if ram_memory == "Нема" or ram_memory == "/": 66 87 ram_memory = None … … 84 105 battery = None 85 106 86 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name, price, image_url, offer_url, ram_memory,' \ 87 ' rom_memory, battery, back_camera, last_updated, operating_system, is_validated)' \ 88 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 89 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, ram_memory, 90 rom_memory, battery, back_camera, last_updated, operating_system, is_validated) 91 cur.execute(insert_script, insert_value) 92 db_connection.commit() 107 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 108 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 109 image_url, 110 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 93 111 94 cur.close() 95 db_connection.close() 112 for new_offer in new_offers: 113 flag = False 114 flag_price = False 115 offer_id = None 116 117 for old_offer in database_offers: 118 119 if new_offer.offer_name == old_offer.offer_name: 120 flag = True 121 if new_offer.price != old_offer.price: 122 flag_price = True 123 offer_id = old_offer.offer_id 124 125 if flag: 126 print('ALREADY IN DATABASE') 127 print(new_offer) 128 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 129 if flag_price: 130 print('PRICE CHANGED!') # CHANGE PRICE 131 print('offer id: ' + str(offer_id)) 132 headers = {'Content-type': 'application/json'} 133 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 134 headers=headers) 135 else: 136 print('ADDED') # ADD OFFER 137 print(new_offer) 138 headers = {'Content-type': 'application/json'} 139 requests.post('http://localhost:8080/phoneoffer/addoffer', 140 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 141 142 print('------------------------------------') 143 144 for old_offer in database_offers: 145 flag = False 146 for new_offer in new_offers: 147 if old_offer.offer_name == new_offer.offer_name: 148 flag = True 149 150 if not flag: 151 print('OFFER DELETED') 152 print(old_offer) 153 # DELETE OFFER 154 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) 155 -
phonelux_scrappers/scrappers/neptun_scrapper.py
r48f3030 r895cd87 1 import json 1 2 import unicodedata 2 3 from datetime import datetime … … 9 10 import sys 10 11 12 from classes.phoneoffer import PhoneOffer 13 11 14 file_path = 'outputfile.txt' 12 15 sys.stdout = open(file_path, "w") 13 14 # Call to read the configuration file and connect to database15 cinfo = config_read.get_databaseconfig("../postgresdb.config")16 db_connection = psycopg2.connect(17 database=cinfo[0],18 host=cinfo[1],19 user=cinfo[2],20 password=cinfo[3]21 )22 cur = db_connection.cursor()23 16 24 17 offer_shop = "Neptun" # offer shop … … 26 19 is_validated = False 27 20 21 # Neptun phone offers that are already in database 22 23 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/neptun').text)) 24 25 database_offers = [] 26 27 for offer in offers: 28 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 29 offer['ram_memory'], 30 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 31 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 32 offer['image_url'], 33 offer['offer_url'], offer['last_updated'], offer['is_validated'], 34 offer['offer_description'], 35 offer['offer_shop_code']) 36 database_offers.append(phoneOffer) 37 38 new_offers = [] 39 28 40 for i in range(1, 11): 29 neptun_url = 'https://www.neptun.mk/mobilni_telefoni.nspx?page=' +str(i)41 neptun_url = 'https://www.neptun.mk/mobilni_telefoni.nspx?page=' + str(i) 30 42 31 43 # selenium is used because of the dynamic content of the page … … 72 84 offer_description = specifications_table.get_text(separator='\n').strip() 73 85 86 back_camera = None 74 87 operating_system = None 75 88 chipset = None … … 78 91 rom_memory = None 79 92 cpu = None 93 front_camera = None 94 color = None 95 80 96 for specification in specifications: 81 97 if 'Батерија:' in specification: … … 105 121 operating_system = specification 106 122 107 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name , price, image_url, offer_url,' \ 108 'offer_shop_code, operating_system, battery, chipset, cpu, ram_memory, rom_memory, ' \ 109 'offer_description, last_updated, is_validated)' \ 110 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 111 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, 112 offer_shop_code, operating_system, battery, chipset, cpu, ram_memory, rom_memory, offer_description, 113 last_updated, is_validated) 114 cur.execute(insert_script, insert_value) 115 db_connection.commit() 123 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 124 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 125 image_url, 126 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 116 127 117 cur.close() 118 db_connection.close() 128 for new_offer in new_offers: 129 flag = False 130 flag_price = False 131 offer_id = None 132 133 for old_offer in database_offers: 134 135 if new_offer.offer_shop_code == old_offer.offer_shop_code: 136 flag = True 137 if new_offer.price != old_offer.price: 138 flag_price = True 139 offer_id = old_offer.offer_id 140 141 if flag: 142 # print('ALREADY IN DATABASE') 143 # print(new_offer) 144 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 145 if flag_price: 146 print('PRICE CHANGED!') # CHANGE PRICE 147 print('offer id: ' + str(offer_id)) 148 headers = {'Content-type': 'application/json'} 149 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 150 headers=headers) 151 else: 152 print('ADDED') # ADD OFFER 153 print(new_offer) 154 headers = {'Content-type': 'application/json'} 155 requests.post('http://localhost:8080/phoneoffer/addoffer', 156 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 157 158 print('------------------------------------') 159 160 for old_offer in database_offers: 161 flag = False 162 for new_offer in new_offers: 163 if old_offer.offer_shop_code == new_offer.offer_shop_code: 164 flag = True 165 166 if not flag: 167 print('OFFER DELETED') 168 print(old_offer) 169 # DELETE OFFER 170 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) -
phonelux_scrappers/scrappers/outputfile.txt
r48f3030 r895cd87 1 ADDED 2 {'offer_shop': 'Mobile Zone', 'offer_name': 'Apple iPhone 14 Pro', 'price': 95499, 'ram_memory': None, 'rom_memory': '128GB', 'color': 'Златна, Розева, Сива, Црна', 'front_camera': '12MP', 'back_camera': '48 Mp + 12 Mp + 12 Mp', 'chipset': None, 'battery': '3200mAh', 'operating_system': None, 'cpu': None, 'image_url': 'https://i0.wp.com/mobilezone.mk/wp-content/uploads/2022/09/14-pro-silver.png?resize=600%2C600&ssl=1', 'offer_url': 'https://mobilezone.mk/produkti/iphone-14-pro/', 'last_updated': datetime.date(2022, 10, 1), 'is_validated': False, 'offer_description': None, 'offer_shop_code': None} 3 ------------------------------------ 4 OFFER DELETED 5 {'offer_id': 1179, 'offer_shop': 'Mobile Zone', 'offer_name': 'Samsung s20 FE', 'price': 24699, 'ram_memory': None, 'rom_memory': '128GB', 'color': 'Сина', 'front_camera': None, 'back_camera': None, 'chipset': None, 'battery': None, 'operating_system': None, 'cpu': None, 'image_url': 'https://i2.wp.com/mobilezone.mk/wp-content/uploads/2022/03/Samsung-Galaxy-S20-FE-blue.png?resize=512%2C600&ssl=1', 'offer_url': 'https://mobilezone.mk/produkti/samsung-s20-fe/', 'last_updated': '2022-07-29T22:00:00.000+00:00', 'is_validated': False, 'offer_description': None, 'offer_shop_code': None} 6 OFFER DELETED 7 {'offer_id': 1181, 'offer_shop': 'Mobile Zone', 'offer_name': 'Samsung Z Flip3 5G', 'price': 39999, 'ram_memory': None, 'rom_memory': '128GB', 'color': 'Црна', 'front_camera': None, 'back_camera': None, 'chipset': None, 'battery': None, 'operating_system': None, 'cpu': None, 'image_url': 'https://i2.wp.com/mobilezone.mk/wp-content/uploads/2022/03/11.png?resize=600%2C600&ssl=1', 'offer_url': 'https://mobilezone.mk/produkti/samsung-z-flip3-5g/', 'last_updated': '2022-07-29T22:00:00.000+00:00', 'is_validated': False, 'offer_description': None, 'offer_shop_code': None} 8 OFFER DELETED 9 {'offer_id': 1180, 'offer_shop': 'Mobile Zone', 'offer_name': 'Samsung S21 FE 5G', 'price': 30899, 'ram_memory': None, 'rom_memory': '128GB', 'color': 'Зелена, Црна', 'front_camera': None, 'back_camera': None, 'chipset': None, 'battery': None, 'operating_system': None, 'cpu': None, 'image_url': 'https://i1.wp.com/mobilezone.mk/wp-content/uploads/2022/03/5g.jpg?resize=600%2C600&ssl=1', 'offer_url': 'https://mobilezone.mk/produkti/samsung-s21-fe-5g/', 'last_updated': '2022-07-29T22:00:00.000+00:00', 'is_validated': False, 'offer_description': None, 'offer_shop_code': None} -
phonelux_scrappers/scrappers/setec_scrapper.py
r48f3030 r895cd87 1 import json 1 2 import unicodedata 2 3 from datetime import datetime 3 4 4 import psycopg2 5 5 import config_read 6 6 from bs4 import BeautifulSoup 7 7 import requests 8 import sys 8 9 9 import sys 10 from classes.phoneoffer import PhoneOffer 10 11 11 12 file_path = 'outputfile.txt' 12 13 sys.stdout = open(file_path, "w") 13 14 # Call to read the configuration file and connect to database15 cinfo = config_read.get_databaseconfig("../postgresdb.config")16 db_connection = psycopg2.connect(17 database=cinfo[0],18 host=cinfo[1],19 user=cinfo[2],20 password=cinfo[3]21 )22 cur = db_connection.cursor()23 14 24 15 offer_shop = "Setec" # offer shop … … 26 17 is_validated = False 27 18 28 for i in range(1, 7): 29 setec_url = 'https://setec.mk/index.php?route=product/category&path=10066_10067&page='+str(i) 19 # Setec phone offers that are already in database 20 21 offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/setec').text)) 22 23 database_offers = [] 24 25 for offer in offers: 26 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 27 offer['ram_memory'], 28 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 29 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 30 offer['image_url'], 31 offer['offer_url'], offer['last_updated'], offer['is_validated'], 32 offer['offer_description'], 33 offer['offer_shop_code']) 34 database_offers.append(phoneOffer) 35 36 new_offers = [] 37 38 for i in range(1, 9): 39 setec_url = 'https://setec.mk/index.php?route=product/category&path=10066_10067&page=' + str(i) 30 40 31 41 response1 = requests.get(setec_url) … … 41 51 brand = offer_name.split(' ')[0] 42 52 53 back_camera = None 54 operating_system = None 55 chipset = None 56 battery = None 57 ram_memory = None 58 rom_memory = None 59 cpu = None 60 front_camera = None 61 color = None 62 43 63 if 'Cable' in offer_name or 'AirTag' in offer_name: 44 64 continue … … 49 69 offer_shop_code = phone.find('div', {'class': 'right'}) \ 50 70 .find('div', {'class': 'shifra'}).get_text().replace('Шифра:', '').strip() 51 price = int(phone.find('div', {'class': 'right'}).find('div', {'class': 'price'}). \ 52 find('div', {'class': 'category-price-redovna'}).find('span', {'class': 'price-old-new'}) \ 53 .get_text().replace('Ден.', '').replace(',', '').strip()) 71 72 price_tag = phone.find('div', {'class': 'right'}).find('div', {'class': 'price'}). \ 73 find('div', {'class': 'category-price-redovna'}).find('span', {'class': 'price-old-new'}) 74 75 if price_tag is None: 76 price_tag = phone.find('div', {'class': 'right'}).find('div', {'class': 'price'}). \ 77 find('div', {'class': 'category-price-redovna'}).find('span', {'class': 'cena_za_kesh'}) 78 79 price = int(price_tag.get_text().replace('Ден.', '').replace(',', '').strip()) 54 80 55 81 response2 = requests.get(offer_url) … … 58 84 offer_description = soup2.find('div', {'id': 'tab-description'}).get_text(separator='\n') 59 85 60 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name , price, image_url, offer_url,' \ 61 'offer_shop_code, offer_description, last_updated, is_validated)' \ 62 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 63 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, 64 offer_shop_code, offer_description, last_updated, is_validated) 65 cur.execute(insert_script, insert_value) 66 db_connection.commit() 86 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 87 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 88 image_url, 89 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 67 90 68 cur.close() 69 db_connection.close() 91 for new_offer in new_offers: 92 flag = False 93 flag_price = False 94 offer_id = None 95 96 for old_offer in database_offers: 97 98 if new_offer.offer_shop_code == old_offer.offer_shop_code: 99 flag = True 100 if new_offer.price != old_offer.price: 101 flag_price = True 102 offer_id = old_offer.offer_id 103 104 if flag: 105 # print('ALREADY IN DATABASE') 106 # print(new_offer) 107 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 108 if flag_price: 109 print('PRICE CHANGED!') # CHANGE PRICE 110 print('offer id: ' + str(offer_id)) 111 headers = {'Content-type': 'application/json'} 112 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 113 headers=headers) 114 else: 115 print('ADDED') # ADD OFFER 116 print(new_offer) 117 headers = {'Content-type': 'application/json'} 118 requests.post('http://localhost:8080/phoneoffer/addoffer', 119 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 120 121 print('------------------------------------') 122 123 for old_offer in database_offers: 124 flag = False 125 for new_offer in new_offers: 126 if old_offer.offer_shop_code == new_offer.offer_shop_code: 127 flag = True 128 129 if not flag: 130 print('OFFER DELETED') 131 print(old_offer) 132 # DELETE OFFER 133 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id)) -
phonelux_scrappers/scrappers/tehnomarket_scrapper.py
r48f3030 r895cd87 1 import json 1 2 import unicodedata 2 3 from datetime import datetime … … 6 7 from selenium import webdriver 7 8 import requests 9 import sys 8 10 9 import sys 11 from classes.phoneoffer import PhoneOffer 10 12 11 13 file_path = 'outputfile.txt' 12 14 sys.stdout = open(file_path, "w") 13 15 14 # Call to read the configuration file and connect to database15 cinfo = config_read.get_databaseconfig("../postgresdb.config")16 db_connection = psycopg2.connect(17 database=cinfo[0],18 host=cinfo[1],19 user=cinfo[2],20 password=cinfo[3]21 )22 cur = db_connection.cursor()23 16 24 25 def scrape_function(driver1, i): 17 def scrape_function(driver1, i, new_offers): 26 18 offer_shop = "Tehnomarket" # offer shop 27 19 last_updated = datetime.now().date() … … 59 51 offer_shop_code = details[4].strip() 60 52 53 back_camera = None 54 operating_system = None 55 chipset = None 56 battery = None 57 ram_memory = None 58 rom_memory = None 59 cpu = None 60 front_camera = None 61 color = None 62 61 63 specifications = [] 62 64 for info in soup2.find_all('span', {'class': 'info'}): 63 65 specifications.append(info.get_text()) 64 66 65 print(brand)66 print(offer_name)67 print()68 print()69 70 67 offer_description = '\n'.join(specifications) 71 68 72 insert_script = 'INSERT INTO phone_offers (offer_shop, brand, offer_name, price, image_url, offer_url,' \ 73 'offer_description, offer_shop_code, last_updated, is_validated)' \ 74 ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s);' 75 insert_value = (offer_shop, brand, offer_name, price, image_url, offer_url, offer_description, 76 offer_shop_code, last_updated, is_validated) 77 cur.execute(insert_script, insert_value) 78 db_connection.commit() 69 new_offers.append(PhoneOffer(offer_shop, offer_name, price, ram_memory, rom_memory, 70 color, front_camera, back_camera, chipset, battery, operating_system, cpu, 71 image_url, 72 offer_url, last_updated, is_validated, offer_description, offer_shop_code)) 79 73 else: 80 74 driver1.implicitly_wait(30) 81 scrape_function(driver1, i )75 scrape_function(driver1, i, new_offers) 82 76 77 78 # Tehnomarket phone offers that are already in database 79 80 offers = json.loads( 81 unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/tehnomarket').text)) 82 83 database_offers = [] 84 85 for offer in offers: 86 phoneOffer = PhoneOffer(offer['id'], offer['offer_shop'], offer['offer_name'], offer['price'], 87 offer['ram_memory'], 88 offer['rom_memory'], offer['color'], offer['front_camera'], offer['back_camera'], 89 offer['chipset'], offer['battery'], offer['operating_system'], offer['cpu'], 90 offer['image_url'], 91 offer['offer_url'], offer['last_updated'], offer['is_validated'], 92 offer['offer_description'], 93 offer['offer_shop_code']) 94 database_offers.append(phoneOffer) 95 96 new_offers = [] 83 97 84 98 for i in range(1, 6): … … 90 104 driver1.get(tehnomarket_url) 91 105 92 scrape_function(driver1, i) 106 scrape_function(driver1, i, new_offers) 107 93 108 # closing the driver so the safari instance can pair with another webdriver session 94 109 driver1.close() 95 110 96 cur.close() 97 db_connection.close() 111 for new_offer in new_offers: 112 flag = False 113 flag_price = False 114 offer_id = None 115 116 for old_offer in database_offers: 117 118 if new_offer.offer_shop_code == old_offer.offer_shop_code: 119 flag = True 120 if new_offer.price != old_offer.price: 121 flag_price = True 122 offer_id = old_offer.offer_id 123 124 if flag: 125 # print('ALREADY IN DATABASE') 126 # print(new_offer) 127 # if it's already in database, check PRICE and if it's changed, change it !!!!!! 128 if flag_price: 129 print('PRICE CHANGED!') # CHANGE PRICE 130 print('offer id: ' + str(offer_id)) 131 headers = {'Content-type': 'application/json'} 132 requests.put('http://localhost:8080/phoneoffer/' + str(offer_id) + '/changeprice/' + str(new_offer.price), 133 headers=headers) 134 else: 135 print('ADDED') # ADD OFFER 136 print(new_offer) 137 headers = {'Content-type': 'application/json'} 138 requests.post('http://localhost:8080/phoneoffer/addoffer', 139 headers=headers, data=json.dumps(new_offer.__dict__, default=str)) 140 141 print('------------------------------------') 142 143 for old_offer in database_offers: 144 flag = False 145 for new_offer in new_offers: 146 if old_offer.offer_shop_code == new_offer.offer_shop_code: 147 flag = True 148 149 if not flag: 150 print('OFFER DELETED') 151 print(old_offer) 152 # DELETE OFFER 153 requests.delete('http://localhost:8080/phoneoffer/deleteoffer/' + str(old_offer.offer_id))
Note:
See TracChangeset
for help on using the changeset viewer.