Giter Site home page Giter Site logo

jays-aliex-importer's Introduction

Jay's Aliexpress WooCommerce Importer

This code is in alpha and should not be considered stable. This was designed as a proof of concept. I may at some point continue to develop on this code, but for now, it will stay in alpha. Feel free to fork it and do as you please.

Description

This plugin allows you, the user, to import an Aliexpress product directly from their website. To do this, it creates an API where one doesn't exist by utilizing website scraping and transformations.

( See the full JSON output - formatted of course )

To be clear, this is not created with an API - I created the API with the HTML content from the page, as well as a few inline JS requests that were observed during the page loading transactions. ( Network inspector is your friend. )

WooCommerce Import Functionality

The idea behind creating a sort of API interface to read from was for ease of use to import content to just about any platform be it WooCommerce, Shopify, etc... Essentially the API aspect could be easily decoupled into it's own library whereas it could then be used for just about anything. It's a scraper after all!

This plugin leverages the WooCommerce export form with a bit of added javascript and removed text to keep a consistent WooCommerce experience. I admit, I copied the HTML ๐Ÿ˜„

What this plugin does NOT do

There are many TODO's here, to be fair, I just wanted to see how difficult it would be to create an API from a scraped HTML page. But enough of that, here's what the intent was, but I never got to it!

  • Import product updates on a regular basis
  • Import Images ( data is saved to product meta with the intent to process on save )
  • Import Variations ( data is saved to product meta with the intent to process on save )
  • Import Categories ( Aliexpress categories may differ from your WordPress store )

A couple gotcha's when I was working on this

  1. Aliexpress does NOT like the default WordPress header given from wp_remote_get() - Faking the headers allows a request to happen normally.
  2. Shipping information is loaded asynchronously from an external API - to which you have to provide request parameters to get the data for the specific item.
  3. Description is loaded asynchronously as well from an external API, it's not readily available.
  4. Product variations had to be scraped from a JavaScript variable, learning to read that using DomDocument ( DiDom library in this case ) was interesting.

On the plus side, I learned a lot about creating an API object from an HTML source. Hope you will to. If you use this, please ping me on twitter @plugish - would love to see what you create!

If you'd like to buy me a beer, I won't turn you down!

( A WordPress plugin by Jay Wood )

jays-aliex-importer's People

Contributors

jaywood 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.