GithubHelp home page GithubHelp logo

apmnt / postalservice-python Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.57 MB

Python library for scraping second hand Japanese websites for easier access to the search results.

Home Page: https://pypi.org/project/postalservice/

License: MIT License

Python 98.64% Jupyter Notebook 1.36%
mercari rakuma yjp fril

postalservice-python's Introduction

Postal Service Python Library

Mercari Fril YJP PyPI version

Python library for scraping second hand Japanese websites for easier access to the search results. Useful for creating datasets, notification systems, or web APIs. Targets the website API if available, or parses the HTML response.

Features

  • Mercari, Fril scraping
  • Filter by keyword and size
  • Built in asynchronous requests for fast html scraping
  • Unit tested locally and with Github Actions workflow

Installation

postalservice is available on PyPI as postalservice

pip install postalservice

One shot example

from postalservice import MercariService

mercari = MercariService()

# The `get_search_results` method returns a `SearchResults` object
searchresults = mercari.get_search_results({'keyword':'comme des garcons', 'size':'XL'})

# When you print the `SearchResults` object, it outputs a well-formatted JSON string
print(searchresults)

Output:

[
    {
        "id": "m65906652855",
        "title": "ルイスレザー ジュンヤワタナベ JUNYA WATANABE MAN ライダース",
        "price": 120000.0,
        "size": "L",
        "url": "https://jp.mercari.com/item/m65906652855",
        "img": [
            "https://static.mercdn.net/c!/w=240,f=webp/thumb/photos/m65906652855_1.jpg?1705291813"
        ]
    },
    # ... more items
]

Main methods of all service classes

BaseService is an abstract base class that defines the interface for a service. All services implement this and therefore have all these class methods:

  • get_search_results(params: dict) -> SearchResults: Fetches data synchronously using the provided parameters, parses the response, and returns the results as SearchResults object.

  • get_search_results_async(params: dict) -> SearchResults: Fetches data asynchronously using the provided parameters, parses the response (asynchronously, if needed), and returns the results as SearchResults object.

todo

  • Rakuten support
  • General improvements to structure of the library
  • Support for multiple sizes for sites where only one size is possible to select at a time

postalservice-python's People

Contributors

apmnt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.