0

当我使用 python find sdk 通过 eBay 搜索列表时,我通常会得到包含两个或多个我没有搜索的项目的列表的结果。一个例子:

request1 = {
        'keywords': "Iphone x 64gb", # I am searching for Listings of an iPhone x 64gb
        'itemFilter': [
            {'name': 'Condition', 'value': 'Used'},
            {'name': 'currency', 'value': 'CAD'},
            {'name': 'minPrice', 'value': 100.0}
        ],
        'paginationInput': {
            'entriesPerPage': 100,
            'pageNumber': 13
        },
        'sortOrder': 'BestMatch'
}

 api = find_connect(config_file='ebay.yml',  siteid="EBAY-ENCA")
 resp = api.execute('FindPopularItems', request1).dict() # Change from XML to dictionary
 parse_response(reps) # send the dictionary of listings to be parsed

当我查看从 API 请求返回的一些列表时,我可以得到类似这样的信息

itemId: 303279232871
title: Apple iPhone X Smartphone 64GB 256GB AT&T Sprint T-Mobile Verizon or Unlocked
globalId: EBAY-US
subtitle: 30-Day Warranty - Free Charger & Cable - Easy Returns!
primaryCategory: {'categoryId': '9355', 'categoryName': 'Cell Phones & Smartphones'}
galleryURL: https://thumbs4.ebaystatic.com/pict/303279232871404000000001_2.jpg
viewItemURL: https://www.ebay.ca/itm/Apple-iPhone-X-Smartphone-64GB-256GB-AT-T-Sprint-T-Mobile-Verizon-Unlocked-/303279232871?var=602277420740
paymentMethod: PayPal
autoPay: true
postalCode: 660**
location: USA
country: US
shippingInfo: {'shippingServiceCost': {'_currencyId': 'CAD', 'value': '23.83'}, 'shippingType': 'Flat', 'shipToLocations': 'Worldwide'}
sellingStatus: {'currentPrice': {'_currencyId': 'USD', 'value': '309.0'}, 'convertedCurrentPrice': {'_currencyId': 'CAD', 'value': '436.46'}, 'sellingState': 'Active', 'timeLeft': 'P21DT20H28M35S'}
listingInfo: {'bestOfferEnabled': 'false', 'buyItNowAvailable': 'false', 'startTime': '2019-09-09T14:07:31.000Z', 'endTime': '2020-05-09T14:07:31.000Z', 'listingType': 'FixedPrice', 'gift': 'false', 'watchCount': '18'}
galleryPlusPictureURL: https://galleryplus.ebayimg.com/ws/web/303279232871_1_3459_1_00000001.jpg
condition: {'conditionId': '2500', 'conditionDisplayName': 'Seller refurbished'}
isMultiVariationListing: true # **This means that it is a multi variation listing**
topRatedListing: false

这是价格不同的 Iphone x 64gb 和 256gb 的列表。甚至可能有超过 2 件不同价格的商品(客户可能想要,但它是用过的或新的等)。但是,我不只是想从我的数据集中丢弃它,因为 eBay 的 API 最多只返回 10000 个列表,并且每天只允许 5000 次调用(数据仍然相关)。如何从列表中过滤每个单独的项目?

4

1 回答 1

0

我能想到的应该有帮助的一件事是,如果您按方面而不是使用关键字进行查询。下面的示例查找具有“64 GB”存储空间的“iphone x”结果。方面过滤必须在适当的类别内完成。这也假设卖家已经使用结构化数据创建了列表。

api_request = {
    'keywords': "Iphone x", 
    'itemFilter': [
        {'name': 'Condition', 'value': 'Used'},
        {'name': 'currency', 'value': 'CAD'},
        {'name': 'minPrice', 'value': 100.0}
    ],
    'aspectFilter': [
        {
            'aspectName': 'Storage Capacity',
            'aspectValueName': '16 GB',
        }
    ],
    'categoryId': 9355,
    'outputSelector': [
        'AspectHistogram',
    ],
    'paginationInput': {
        'entriesPerPage': 100,
        'pageNumber': 1
    },
    'sortOrder': 'BestMatch'
}
于 2020-04-21T15:13:26.020 回答