Changeset 895cd87


Ignore:
Timestamp:
10/01/22 22:55:27 (2 years ago)
Author:
Marko <Marko@…>
Branches:
master
Children:
fd5b100
Parents:
48f3030
Message:

Refactored code

Location:
phonelux_scrappers
Files:
4 added
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • phonelux_scrappers/lowest_price_setter.py

    r48f3030 r895cd87  
    1 
     1import json
    22import psycopg2
     3import requests
    34import config_read
    4 
    55import sys
    66
     
    88sys.stdout = open(file_path, "w")
    99
    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()
     10phones = json.loads(requests.get('http://localhost:8080/phones').text)
    2311
    2412for 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'])
    3015
    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)
    3522
    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
     1Samsung Galaxy A13
     29990
     3Apple iPhone 13
     447499
     5Apple iPhone 13 Pro
     662690
     7Apple iPhone 12
     832690
     9Samsung Galaxy S22 Ultra 5G
     1060000
     11Apple iPhone 11
     1223490
     13Samsung Galaxy S22 5G
     1443000
     15Samsung Galaxy S21 FE
     1633800
     17Samsung Galaxy A33 5G
     1817490
     19Apple iPhone 13 Pro Max
     2068890
     21Samsung Galaxy A32
     2213900
     23Samsung Galaxy S22+ 5G
     2450150
     25Apple iPhone 14 Pro
     2671890
     27Xiaomi 12
     2828999
     29Samsung Galaxy A53 5G
     3020290
     31Xiaomi Redmi Note 11
     3211990
     33Xiaomi Redmi 9A
     346490
     35Huawei Nova 9
     3622900
     37Samsung Galaxy A12
     389500
     39Samsung Galaxy Z Flip 4
     4058400
     41Apple iPhone 14
     421
     43Apple iPhone 13 Mini
     4442990
     45Samsung Galaxy A52s
     4618500
     47Xiaomi Redmi 10C
     489990
     49Apple iPhone SE
     5024600
     51Samsung Galaxy A03s
     526790
     53Samsung Galaxy A22 5G
     5411700
     55Xiaomi Mi 11 Lite
     5618500
     57Samsung Galaxy A23
     5811790
     59Apple iPhone 14 Pro Max
     6099999
     61Samsung Galaxy Z Fold 4
     6298400
     63Samsung Galaxy A03
     648490
     65Huawei nova Y70
     6613699
     67Samsung Galaxy Z Flip3 5G
     6838990
     69Huawei Nova 8i
     7019999
     71Samsung Galaxy Z Fold 3 5G
     7269990
     73Xiaomi 11 Lite 5G NE
     7424999
     75Xiaomi Redmi Note 11 Pro
     7616590
     77Xiaomi Mi 11T 5G
     7823400
     79Huawei Nova 9 SE
     8022999
     81Xiaomi Redmi 9
     829399
     83Huawei nova Y90
     8415999
     85Apple iPhone SE (2022)
     8628290
     87Xiaomi Poco X3
     8813999
     89OnePlus Nord N10 5G
     9018999
     91Samsung Galaxy A52
     9218190
     93Xiaomi Redmi Note 10
     9413999
     95Blackview A70 Pro
     967399
     97Realme C11
     986999
     99Honor 50 Lite
     10011990
     101Xiaomi Poco F3
     10221500
     103Huawei P50 Pro
     10458400
     105Xiaomi Redmi 9C
     1066990
     107Xiaomi 12X
     10829900
     109Blackview A55
     1105999
     111OnePlus Nord CE
     11226999
     113Vivo Y72 5G
     11418999
     115Xiaomi Mi 11T Pro 5G
     11633800
     117Xiaomi Poco M3
     11812290
     119Vivo V21 5G
     12024999
     121Vivo Y33s
     12215999
     123Samsung Galaxy A02s
     1248890
     125Motorola Moto G31
     12612899
     127Xiaomi Mi 11 Lite 5G NE
     12825999
     129Alcatel 2019G
     1302290
     131Samsung Galaxy S21+ 5G
     13241790
     133Xiaomi Redmi Note 10 5G
     13413490
     135Xiaomi 11T
     13631999
     137Alcatel 1SE
     1386290
     139Alcatel 1066D
     1401299
     141Xiaomi Redmi Note 9
     1429990
     143Xiaomi Redmi Note 11 Pro+ 5G
     14427999
     145Blackview A80
     1466499
     147Motorola Moto G22
     14811299
     149Xiaomi Poco M3 Pro 5G
     15012999
     151Xiaomi Redmi Note 9S
     15211900
     153Blackview A70
     1547299
     155Xiaomi Redmi 9AT
     1566999
     157Doogee X95
     1585999
     159Xiaomi Redmi Note 10 Pro
     16015990
     161Motorola Edge 20
     16230999
     163Motorola Moto G60
     16416999
     165Honor 50
     16623400
     167Apple iPhone 12 Pro Max
     16866500
     169Apple iPhone 11 Pro Max
     17032690
     171Nokia 105 (2017)
     1721490
     173Samsung Galaxy S21 Ultra 5G
     17452290
     175Motorola Moto E7 Power
     1768999
     177Apple iPhone 11 Pro
     17827790
     179Alcatel 1
     1805499
     181Xiaomi Poco X3 Pro
     18215400
     183Xiaomi Redmi Note 9 Pro
     18415499
     185Blackview A60 Pro
     1866299
     187Blackview Oscal C20
     1885249
     189Realme C21Y
     1907999
     191Vivo Y21
     19211899
     193Samsung Galaxy A20e
     1949699
     195Vivo Y21s
     19613999
     197Nokia 3310
     1983399
     199Xiaomi Mi 10 Lite 5G
     20015990
     201Xiaomi Mi Note 10 Lite
     20219700
     203Samsung Galaxy S21 5G
     20438999
     205Xiaomi Mi 11 Ultra
     20653490
     207Motorola Moto G10
     20810299
     209Alcatel 3026X
     2104499
     211Samsung Galaxy S20 FE
     21222690
     213Xiaomi Redmi Note 11S
     21419999
     215Doogee X96
     2167699
     217Alcatel 2053D
     2182999
     219Alcatel 3025X
     2203999
     221Doogee X93
     2225999
     223Vivo Y20s
     22412499
     225Infinix Hot 11
     22610499
     227Infinix Smart 6
     2287999
     229Panasonic KX-TU160
     2303999
     231Xiaomi 12 Pro
     23254150
     233Xiaomi Mi 10T Pro 5G
     23429900
     235Xiaomi Poco X4 Pro 5G
     23617200
     237Apple iPhone 12 Pro
     23861590
     239Google Pixel 6 Pro
     24061500
     241Samsung Galaxy Note 20
     24236900
     243Xiaomi Poco M4 Pro 5G
     24415999
     245OnePlus 10 Pro 5G
     24652290
     247Wiko View
     2485990
     249Samsung Galaxy A72
     25023300
     251Alcatel 2003D
     2522199
     253Xiaomi Redmi Note 10 Pro Max
     25416490
     255Trevi Max 10
     2561599
     257Honor X8
     25816499
     259Nokia 6310
     2605490
     261Xiaomi 11T Pro
     26247999
     263Samsung Galaxy A02
     2648000
     265Samsung Galaxy A40
     26611999
     267Motorola Moto G71
     26818999
     269Samsung Galaxy Note 20 Ultra 5G
     27050390
     271Samsung Galaxy A73 5G
     27227000
     273Xiaomi Redmi Note 10S
     27414999
     275Blackview A60
     2764999
     277Blackview A80 Plus
     2788999
     279Realme C21
     2808999
     281Motorola Moto G51
     28214999
     283Xiaomi Mi 10T Lite 5G
     28415390
     285OnePlus 9 Pro
     28646200
     287Cubot P30
     2889999
     289Cubot Note 20
     2908999
     291Motorola Moto G30
     29213999
     293Asus ROG Phone 5
     29446100
     295Tesla Smartphone 3.4
     2964999
     297Oppo F11 Pro
     29816600
     299Honor View 20
     30036800
     301Honor 70
     30232999
     303Realme 8i
     30415999
     305OnePlus 9
     30630800
     307Samsung Galaxy M12
     3089500
     309Samsung Galaxy A31
     31016999
     311Xiaomi Redmi 9i
     3128890
     313OnePlus 7T Pro McLaren Edition
     31436900
     315OnePlus 7T
     31627700
     317Oppo A9
     31816600
     319Nokia 8110 4G
     3204300
     321Blackberry Porsche Design P9981
     32219000
     323Asus ROG Phone 2
     32432000
     325Xiaomi Redmi Note 9T 5G
     32612290
     327Motorola Edge 20 Pro
     32844999
     329Xiaomi Poco X3 GT
     33017200
     331Nokia 105 (2019)
     3321999
     333Apple iPhone 12 Mini
     33434999
     335Samsung Galaxy Z Fold 2
     336141499
     337Samsung Galaxy M32
     33814100
     339Alcatel 1S
     3406390
     341Doogee X95 Pro
     3427399
     343Doogee S58 Pro
     34412499
     345Motorola Moto G100
     34630999
     347Motorola Moto G200
     34830999
     349Realme 9i
     35016699
     351Realme 9 Pro+
     35227999
     353Realme GT Master
     35420300
     355Alcatel 1C
     3564499
     357Trevi Flex 50 GT
     3582199
     359Huawei Honor 8X Max
     36012300
     361Huawei Honor 9X Lite
     36211000
     363Oppo A94 5G
     36415390
     365MeanIT Veteran I
     3661599
     367MeanIT Senior Flip XL
     3683399
     369Denver B242
     3702999
     371Asus ROG Phone 3
     37236900
     373Huawei Y Max
     37412300
     375Apple iPhone X
     37615990
     377Xiaomi Redmi Note 11T 5G
     37818500
     379Motorola G60
     38017999
     381OnePlus 8 Pro
     38240000
     383Samsung Galaxy M52 5G
     38421500
     385Xiaomi Mi 12 Pro 5G
     38654100
     387Alcatel 1066G
     3881190
     389Google Pixel 6
     39040000
     391Wiko View Max
     3927990
     393Xiaomi Black Shark 4
     39429990
     395Tcl 20L+
     39615999
     397Xiaomi Poco F4 GT
     39847999
     399Samsung Galaxy A51
     40018999
     401Samsung Galaxy A50
     40218999
     403Xiaomi Mi A2 Lite
     4048999
     405Xiaomi Mi Play
     4069999
     407Xiaomi Mi 6
     4089999
     409Xiaomi Mi Max 2
     4106999
     411Xiaomi Mi A3
     4128999
     413Samsung Galaxy A30s
     41413999
     415Samsung Galaxy A41
     41616999
     417Alcatel Pixi 4 Power Plus
     4185999
     419Honor X7
     42013999
     421Energizer Energy E20
     4221999
     423Energizer Energy E241S
     4242299
     425Energizer Hardcase H240S
     4263999
     427Energizer Power Max P550S
     4284999
     429Huawei Mate 10 Lite
     4309999
     431Samsung Galaxy M02s
     4329500
     433Xiaomi Mi 10T 5G
     43424500
     435Xiaomi Redmi 8A
     4367400
     437Huawei P30 Pro
     43829500
     439Huawei P40 Lite E
     4409200
     441Apple iPhone XS
     44217890
     443Apple iPhone XS Max
     44421590
     445Nokia C21
     4468999
     447Alcatel 1S (2021)
     4488999
     449Huawei P50 Pocket
     45076900
     451CAT B26
     4525999
     453Cubot J9
     4545299
     455Samsung Galaxy A21s
     45611199
     457Xiaomi Mi A2
     45813799
     459Alcatel 1V
     4604399
     461Trevi Phablet 5Q2
     4624599
     463Energizer Energy E10
     4641299
     465Huawei P20
     46624999
     467Honor 9 Lite
     4687999
     469Huawei Honor 8X
     47016999
     471Honor 10 Lite
     4728499
     473Wiko Power U20
     4748999
     475Wiko Y62
     4766999
     477Vivax Pro M1
     4784499
     479Vivax Fun S10
     4803999
     481Vivax Fun S20
     4824999
     483Vivax Point X2
     4845999
     485Vivax Fly 5 Lite
     4867499
     487Vivax Fly V1
     4888999
     489Vivax Point X502
     4904499
     491Vivax Point X1
     4926999
     493Vivax Fun S1
     4942999
     495Oppo A15s
     4968999
     497Oppo Reno4 Z 5G
     49818999
     499Oppo Reno5 5G
     50024999
     501Oppo Reno4 Lite
     50215999
     503Oppo Find X5 Lite
     50424590
     505Denver B183
     5061499
     507Noa N2
     5087499
     509Noa Sprint 4G
     5105499
     511Samsung Galaxy J7
     5128999
     513Manta MS1701
     5141099
     515Huawei P10 Lite
     51611999
     517Xiaomi Redmi Note 10T 5G
     51812300
     519Nokia 6300 4G
     5204000
     521Tcl 306
     5229999
     523Oppo Find X3 Lite
     52416000
     525Wiko Lenny 5
     5264290
     527Doro 2404
     5284499
     529AllCall Smooth 4G
     5305499
     531Realme C25Y
     53210999
     533Motorola Moto G41
     53416999
     535Honor Magic4 Lite
     53621999
     537Huawei Honor 7A
     5385999
     539Honor 20 Lite
     54011299
     541Panasonic KX-TU155
     5424699
     543Vivax Fly 6
     5445999
     545Tesla Feature 3
     5461599
     547Noa Fresh 4G
     5482999
     549Samsung Galaxy F12
     5509200
     551Nokia 106
     5521999
     553OnePlus Nord
     55422999
     555Infinix Hot 12i
     5569999
     557Doro 1370
     5584999
     559Apple iPhone XR
     56017290
     561Doogee X96 Pro
     5628799
     563Samsung Galaxy F62
     56418400
     565OnePlus 9R
     56627700
     567Alcatel 3080G
     5684499
     569Motorola Moto E20
     5708999
     571AllCall Brother 4G
     5725499
     573Realme 8
     57414999
     575Huawei Honor 7S
     5767599
     577Motorola Moto G50
     57816999
     579Nokia 110
     5802299
     581Motorola Edge 30
     58231999
     583Realme 9 Pro
     58422499
     585Nokia 8
     58614999
     587OnePlus Nord N100
     58810499
  • phonelux_scrappers/phone_total_offers.py

    r48f3030 r895cd87  
     1import json
    12
    23import psycopg2
     4import requests
    35import config_read
    46import sys
     
    79sys.stdout = open(file_path, "w")
    810
    9 # Call to read the configuration file and connect to database
    10 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 )
    1711
    18 cur = db_connection.cursor()
    19 
    20 cur.execute('SELECT id, model FROM phones;')
    21 phones = cur.fetchall()
     12phones = json.loads(requests.get('http://localhost:8080/phones').text)
    2213
    2314for phone in phones:
    24     cur.execute('SELECT COUNT(*) FROM phone_offers WHERE phone_id='+str(phone[0])+';')
    2515
    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
    2718
    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)
    3020
    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
     1import json
     2import requests
     3import classes.phone
     4import sys
    35
    4 import psycopg2
    5 import config_read
    6 from bs4 import BeautifulSoup
    7 import requests
    8 
    9 import sys
    106
    117file_path = 'outputfile.txt'
    128sys.stdout = open(file_path, "w")
    139
    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()
     10phones = json.loads(requests.get('http://localhost:8080/phones').text)
     11for phone in phones:
     12    phone_id = str(phone['id'])
     13    offers = list(json.loads(requests.get('http://localhost:8080/phones/offers/' + phone_id).text))
    2314
    24 cur.execute('SELECT * FROM PHONES ORDER BY id')
     15    offers = list(filter(lambda offer: offer['image_url'] is not None, offers))
    2516
    26 db_connection.commit()
    27 phones = cur.fetchall()
     17    image_url = None
    2818
    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']
    4221
     22    phone['image_url'] = image_url
    4323
    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  
    11import unicodedata
    22from datetime import datetime
    3 
     3import json
    44import psycopg2
    55import config_read
    66from bs4 import BeautifulSoup
    77import requests
     8import sys
     9import unicodedata
    810
    9 import sys
     11from classes.phoneoffer import PhoneOffer
    1012
    1113file_path = 'outputfile.txt'
    1214sys.stdout = open(file_path, "w")
    1315
    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()
    23 
    2416offer_shop = "A1"  # offer shop
    2517last_updated = datetime.now().date()
    2618is_validated = False
     19
     20# A1 phone offers that are already in database
     21
     22offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/a1').text))
     23
     24database_offers = []
     25
     26for 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)
    2736
    2837a1_url = 'https://www.a1.mk/webshop/mk/phones'
     
    3443    .find_all('div', {'class', 'dvc-idtfr by4'})
    3544
     45new_offers = []
     46
    3647for phone in phones:
    3748    brand = phone.get('data-brand').strip()
    38     offer_name = brand+" "+phone.get('data-model').strip()
     49    offer_name = brand + " " + phone.get('data-model').strip()
    3950
    4051    # if brand not in offer_name:
     
    7788    battery = None
    7889    front_camera = None
     90    chipset = None
     91    offer_description = None
    7992
    8093    for row in table_rows:
     
    100113            front_camera = row.get_text().replace('Предна камера', '').strip()
    101114
    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))
    111118
    112 cur.close()
    113 db_connection.close()
     119for 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
     149print('------------------------------------')
     150
     151for 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  
     1import json
    12from datetime import datetime
    23
     
    78import unicodedata
    89import sys
     10from classes.phoneoffer import PhoneOffer
    911
    10 # file_path = '../outputfile.txt'
    11 # sys.stdout = open(file_path, "w")
     12file_path = 'outputfile.txt'
     13sys.stdout = open(file_path, "w")
    1214
    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()
    2215
    2316offer_shop = "Akcija"  # offer shop
    2417last_updated = datetime.now().date()
    2518is_validated = False
     19
     20# Akcija phone offers that are already in database
     21
     22offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/akcija').text))
     23
     24database_offers = []
     25
     26for 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
     37new_offers = []
    2638
    2739i = 0
     
    5163        soup2 = BeautifulSoup(response2.text, 'html.parser')
    5264
     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
    5376        specifications = soup2.find('main', {'id': 'content'}) \
    5477            .find_all('div', {'class', 'container'})[1].find('div', {'class', 'mb-14'}) \
     
    6285                                                       str(specification.get_text(separator='\n').strip())) + "\n"
    6386
    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))
    7191    i += 20
    7292
    73 cur.close()
    74 db_connection.close()
     93for 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
     123print('------------------------------------')
     124
     125for 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  
     1import json
    12import unicodedata
    23from datetime import datetime
     
    910import sys
    1011
     12from classes.phoneoffer import PhoneOffer
     13
    1114file_path = 'outputfile.txt'
    1215sys.stdout = open(file_path, "w")
    1316
    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()
    2317
    2418offer_shop = "Handy"  # offer shop
    2519last_updated = datetime.now().date()
    2620is_validated = False
     21
     22# Handy phone offers that are already in database
     23offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/handy').text))
     24
     25database_offers = []
     26
     27for 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
     38new_offers = []
    2739
    2840handy_url = 'https://www.handy.mk/telefoni?page=6'
     
    4456    soup2 = BeautifulSoup(response2.text, 'html.parser')
    4557
     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
    4670    color_section = soup2.find('section', {'data-hook': 'product-colors-title-section'})
    47 
    48     color = None
    4971    if color_section is not None:
    50         temp_colors = color_section.find('fieldset', {'class': 'ColorPickerbase3563640754__container'})\
     72        temp_colors = color_section.find('fieldset', {'class': 'ColorPickerbase3548966286__container'})\
    5173            .find_all('input', {'type': 'radio'})
    5274        colors_list = []
     
    6789    offer_description = '\n'.join(specifications)
    6890
    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))
    7695
    77 cur.close()
    78 db_connection.close()
     96for 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
     126print('------------------------------------')
     127
     128for 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  
     1import json
    12import unicodedata
    23from datetime import datetime
    3 
    44import psycopg2
    55import config_read
     
    1010import sys
    1111
     12from classes.phoneoffer import PhoneOffer
     13
    1214file_path = 'outputfile.txt'
    1315sys.stdout = open(file_path, "w")
    14 
    15 # Call to read the configuration file and connect to database
    16 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()
    2416
    2517offer_shop = "Ledikom"  # offer shop
    2618last_updated = datetime.now().date()
    2719is_validated = False
     20
     21# Ledikom phone offers that are already in database
     22
     23offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/ledikom').text))
     24
     25database_offers = []
     26
     27for 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
     38new_offers = []
    2839
    2940ledikom_phone_urls = [
     
    6576        offer_name = ' '.join(temp_offer_name.split())
    6677        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())
    6881
    6982        driver1 = webdriver.Safari(executable_path='/usr/bin/safaridriver')
     
    8295        rom_memory = None
    8396        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
    84105
    85106        if len(specifications) != 0:
     
    114135            color = temp
    115136
    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))
    123141
    124 cur.close()
    125 db_connection.close()
     142for 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
     172print('------------------------------------')
     173
     174for 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  
     1import json
     2import sys
    13import unicodedata
    24from datetime import datetime
     
    810
    911# import sys
    10 #
    11 # file_path = 'outputfile.txt'
    12 # sys.stdout = open(file_path, "w")
     12from classes.phoneoffer import PhoneOffer
    1313
    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()
     14file_path = 'outputfile.txt'
     15sys.stdout = open(file_path, "w")
    2316
    2417offer_shop = "Mobelix"  # offer shop
    2518last_updated = datetime.now().date()
    2619is_validated = False
     20
     21# Mobelix phone offers that are already in database
     22
     23offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/mobelix').text))
     24
     25database_offers = []
     26
     27for 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
     38new_offers = []
    2739
    2840for i in range(1, 17):
     
    7789        back_camera = ''
    7890        cpu = None
     91        offer_shop_code = None
     92        offer_description = None
    7993
    8094        for table in tables:
     
    120134            back_camera = None
    121135
    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))
    131140
    132 cur.close()
    133 db_connection.close()
     141
     142for 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
     172print('------------------------------------')
     173
     174for 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  
     1import json
     2import unicodedata
    13from datetime import datetime
    24
     
    57from bs4 import BeautifulSoup
    68import requests
     9import sys
    710
    8 # import sys
    9 #
    10 # file_path = 'outputfile.txt'
    11 # sys.stdout = open(file_path, "w")
     11from classes.phoneoffer import PhoneOffer
    1212
    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()
     13file_path = 'outputfile.txt'
     14sys.stdout = open(file_path, "w")
    2215
    2316offer_shop = "Mobi Go"  # offer shop
    2417last_updated = datetime.now().date()
    2518is_validated = False
     19
     20# Mobi Go phone offers that are already in database
     21
     22offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/mobigo').text))
     23
     24database_offers = []
     25
     26for 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
     37new_offers = []
     38
     39
    2640for i in range(1, 6):
    2741    mobigo_url = "https://mobigo.mk/page/" + str(i) + "/"
     
    5569        specifications = soup2.find('table', {'id': 'singlet'}).find_all('tr')
    5670
    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
    6482
    6583        for specification in specifications:
     
    111129                    battery = None
    112130
    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))
    120135
    121 cur.close()
    122 db_connection.close()
     136
     137for 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
     167print('------------------------------------')
     168
     169for 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  
     1import json
    12import unicodedata
    23from datetime import datetime
     
    67from selenium import webdriver
    78import requests
     9import sys
    810
    9 import sys
     11from classes.phoneoffer import PhoneOffer
    1012
    1113file_path = 'outputfile.txt'
    1214sys.stdout = open(file_path, "w")
    1315
    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()
    23 
    2416offer_shop = "Mobile Zone"  # offer shop
    2517last_updated = datetime.now().date()
    2618is_validated = False
     19
     20# Mobile Zone phone offers that are already in database
     21
     22offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/mobilezone').text))
     23
     24database_offers = []
     25
     26for 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
     37new_offers = []
    2738
    2839for i in range(1, 3):
     
    5465            offer_name = brand + ' ' + offer_name
    5566
    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
    5876
    5977        response2 = requests.get(offer_url)
     
    6583        front_camera = None
    6684        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
    6791        battery = None
    6892        color = None
     
    84108                color = specification.find('td').get_text().strip()
    85109
     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))
    86114
     115for new_offer in new_offers:
     116    flag = False
     117    flag_price = False
     118    offer_id = None
    87119
    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:
    95121
    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
     145print('------------------------------------')
     146
     147for 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  
     1import json
     2import unicodedata
    13from datetime import datetime
    24
     
    57from bs4 import BeautifulSoup
    68import requests
     9import sys
    710
    8 # import sys
    9 # file_path = 'outputfile.txt'
    10 # sys.stdout = open(file_path, "w")
     11from classes.phoneoffer import PhoneOffer
    1112
    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()
     13file_path = 'outputfile.txt'
     14sys.stdout = open(file_path, "w")
     15
    2116
    2217mobitech_url = "https://mobitech.mk/shop/"
     
    2924
    3025offer_shop = "Mobitech"  # offer shop
     26last_updated = datetime.now().date()
    3127is_validated = False
     28
     29# Mobitech phone offers that are already in database
     30
     31offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/mobitech').text))
     32
     33database_offers = []
     34
     35for 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
     46new_offers = []
    3247
    3348for phone in phones:
     
    4055    temp_prices = phone.find('div', {'class': 'jet-woo-product-price'}).find_all('bdi')
    4156    price = int(float(temp_prices[len(temp_prices) - 1].get_text().replace("ден", "").replace(",", "").strip())) # price
    42     last_updated = datetime.now().date()  # offer last_updated date
    4357
    4458    response2 = requests.get(offer_url)
     
    4761    specifications = soup2.find_all('h2', {'class': 'elementor-heading-title elementor-size-default'})
    4862
    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
    5474
    5575    for specification in specifications:
     
    6282        # ram memory
    6383        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()
    6586            if ram_memory == "Нема" or ram_memory == "/":
    6687                ram_memory = None
     
    84105                battery = None
    85106
    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))
    93111
    94 cur.close()
    95 db_connection.close()
     112for 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
     142print('------------------------------------')
     143
     144for 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  
     1import json
    12import unicodedata
    23from datetime import datetime
     
    910import sys
    1011
     12from classes.phoneoffer import PhoneOffer
     13
    1114file_path = 'outputfile.txt'
    1215sys.stdout = open(file_path, "w")
    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()
    2316
    2417offer_shop = "Neptun"  # offer shop
     
    2619is_validated = False
    2720
     21# Neptun phone offers that are already in database
     22
     23offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/neptun').text))
     24
     25database_offers = []
     26
     27for 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
     38new_offers = []
     39
    2840for 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)
    3042
    3143    # selenium is used because of the dynamic content of the page
     
    7284        offer_description = specifications_table.get_text(separator='\n').strip()
    7385
     86        back_camera = None
    7487        operating_system = None
    7588        chipset = None
     
    7891        rom_memory = None
    7992        cpu = None
     93        front_camera = None
     94        color = None
     95
    8096        for specification in specifications:
    8197            if 'Батерија:' in specification:
     
    105121                operating_system = specification
    106122
    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))
    116127
    117 cur.close()
    118 db_connection.close()
     128for 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
     158print('------------------------------------')
     159
     160for 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  
     1ADDED
     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------------------------------------
     4OFFER 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}
     6OFFER 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}
     8OFFER 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  
     1import json
    12import unicodedata
    23from datetime import datetime
    3 
    44import psycopg2
    55import config_read
    66from bs4 import BeautifulSoup
    77import requests
     8import sys
    89
    9 import sys
     10from classes.phoneoffer import PhoneOffer
    1011
    1112file_path = 'outputfile.txt'
    1213sys.stdout = open(file_path, "w")
    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()
    2314
    2415offer_shop = "Setec"  # offer shop
     
    2617is_validated = False
    2718
    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
     21offers = json.loads(unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/setec').text))
     22
     23database_offers = []
     24
     25for 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
     36new_offers = []
     37
     38for i in range(1, 9):
     39    setec_url = 'https://setec.mk/index.php?route=product/category&path=10066_10067&page=' + str(i)
    3040
    3141    response1 = requests.get(setec_url)
     
    4151        brand = offer_name.split(' ')[0]
    4252
     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
    4363        if 'Cable' in offer_name or 'AirTag' in offer_name:
    4464            continue
     
    4969        offer_shop_code = phone.find('div', {'class': 'right'}) \
    5070            .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())
    5480
    5581        response2 = requests.get(offer_url)
     
    5884        offer_description = soup2.find('div', {'id': 'tab-description'}).get_text(separator='\n')
    5985
    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))
    6790
    68 cur.close()
    69 db_connection.close()
     91for 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
     121print('------------------------------------')
     122
     123for 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  
     1import json
    12import unicodedata
    23from datetime import datetime
     
    67from selenium import webdriver
    78import requests
     9import sys
    810
    9 import sys
     11from classes.phoneoffer import PhoneOffer
    1012
    1113file_path = 'outputfile.txt'
    1214sys.stdout = open(file_path, "w")
    1315
    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()
    2316
    24 
    25 def scrape_function(driver1, i):
     17def scrape_function(driver1, i, new_offers):
    2618    offer_shop = "Tehnomarket"  # offer shop
    2719    last_updated = datetime.now().date()
     
    5951            offer_shop_code = details[4].strip()
    6052
     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
    6163            specifications = []
    6264            for info in soup2.find_all('span', {'class': 'info'}):
    6365                specifications.append(info.get_text())
    6466
    65             print(brand)
    66             print(offer_name)
    67             print()
    68             print()
    69 
    7067            offer_description = '\n'.join(specifications)
    7168
    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))
    7973    else:
    8074        driver1.implicitly_wait(30)
    81         scrape_function(driver1, i)
     75        scrape_function(driver1, i, new_offers)
    8276
     77
     78# Tehnomarket phone offers that are already in database
     79
     80offers = json.loads(
     81    unicodedata.normalize('NFKD', requests.get('http://localhost:8080/phoneoffer/shop/tehnomarket').text))
     82
     83database_offers = []
     84
     85for 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
     96new_offers = []
    8397
    8498for i in range(1, 6):
     
    90104    driver1.get(tehnomarket_url)
    91105
    92     scrape_function(driver1, i)
     106    scrape_function(driver1, i, new_offers)
     107
    93108    # closing the driver so the safari instance can pair with another webdriver session
    94109    driver1.close()
    95110
    96 cur.close()
    97 db_connection.close()
     111for 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
     141print('------------------------------------')
     142
     143for 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.