Socket
Socket
Sign inDemoInstall

amazon-track

Package Overview
Dependencies
66
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

9

lib/track.js

@@ -16,2 +16,11 @@ var login = require('./login.js'),

var tracking = {
id: $('.carrierRelatedInfo-trackingId-text').text().trim().split(' ').pop() || 'awaiting shipment',
carrier: (() => {
var id = $('.carrierRelatedInfo-trackingId-text').text().trim().split(' ').pop();
if (id.match(/\b(1Z ?[0-9A-Z]{3} ?[0-9A-Z]{3} ?[0-9A-Z]{2} ?[0-9A-Z]{4} ?[0-9A-Z]{3} ?[0-9A-Z]|[\dT]\d\d\d ?\d\d\d\d ?\d\d\d)\b/)) return 'UPS';
if (id.match(/(\b96\d{20}\b)|(\b\d{15}\b)|(\b\d{12}\b)/) || id.match(/\b((98\d\d\d\d\d?\d\d\d\d|98\d\d) ?\d\d\d\d ?\d\d\d\d( ?\d\d\d)?)\b/) || id.match(/^[0-9]{15}$/)) return 'FedEx';
if (id.match(/(\b\d{30}\b)|(\b91\d+\b)|(\b\d{20}\b)/) || id.match(/^E\D{1}\d{9}\D{2}$|^9\d{15,21}$/) || id.match(/^91[0-9]+$/) || id.match(/^[A-Za-z]{2}[0-9]+US$/)) return 'USPS';
if (id.match(/^TBA[0-9]{12}$/)) return 'AZ Logistics - US';
return 'unknown carrier';
})(),
primaryStatus: $('#primaryStatus').text().trim() || 'Status Unavailable',

@@ -18,0 +27,0 @@ secondaryStatus: $('#secondaryStatus').text().trim() || '',

5

package.json
{
"name": "amazon-track",
"version": "1.0.0",
"version": "1.0.1",
"description": "Provides a simple API to track shipped Amazon.com orders. Useful for orders shipped with Amazon Logistics (TBA), since Amazon hasn't made tracking for these shipments publicly available",
"homepage": "https://github.com/Poootaatoooo/amazon-track",
"main": "index.js",

@@ -12,5 +13,5 @@ "scripts": {

"cheerio": "^1.0.0-rc.2",
"request": "^2.83.0",
"request": "^2.87.0",
"request-promise": "^4.2.2"
}
}

89

README.md
# amazon-track
##### A (currently proof-of-concept) library that gets tracking data for shipped Amazon.com orders.
---
##### [My demo app](https://lgtr.herokuapp.com) consists of a react.js frontend and an express + mongodb api which utilizes this library and employs a 30-minute cache for each order. The first time an order is processed through the app, the amazon order id must be used (eg. 113-4758617-1911455). After that,
---
Mainly intended for Amazon-sourcing dropshippers wanting to provide trackable info on AMZL/TBA orders, either for letting buyers track their orders, or for a better chance at winning unreceived item cases.
---
#### WARNING!
The login mechanism can break *very* easily, as there's no captcha solution like deathbycaptcha implemented yet.
This will definitely be addressed in the near future, and shouldn't be hard to put in at all. I've been somewhat busy lately though, so don't take my word on this.
#### Notice
Feel free to implement it yourself and create a pull request though!
There's no captcha solution like deathbycaptcha or endcaptcha implemented yet, and this project most likely won't be maintained any further than it currently is.
---
*For ease and simplicity, orders are tracked by their 17-digit Amazon order number, not the tracking number.*
Login will silently fail if Amazon prompts with a captcha or if the email/pword combo is incorrect.
**_Even without being logged in_** Amazon still let's you track orders. The only difference is that you won't be able to see the delivery address (as of right now Amazon returns `['Amazon Customer']`), and you also won't be able to get a delivery photo, even if available.
## Also, this library can only track single shipment orders. It's not currently equipped to provide tracking for multiple shipments (ie. if half the items come from a different warehouse).
_For ease and simplicity, orders are tracked by their 17-digit Amazon order number, not the tracking number._
Examples of valid inputs are listed below.
* `113-9830073-7117051`
* `11280886168828263`
* `# 112-0678238-4659427`
* `hahaha~xd1 dg1325_=+%78dfxfgs#F$hgh1483 \ \ \ .__1aaaa#HB^&abcdefg61805`
- `113-9830073-7117051`
- `11280886168828263`
- `# 112-0678238-4659427`
- `hahaha~xd1 dg1325_=+%78dfxfgs#F$hgh1483 \ \ \ .__1aaaa#HB^&abcdefg61805`

@@ -27,3 +37,5 @@ The order number is stripped of all non-numerical characters before being tracked.

---
### Usage
```

@@ -41,12 +53,13 @@ //var track = require('amazon-track');

```
```
{ primaryStatus: 'Delivered Friday, February 9',
secondaryStatus: 'Your package was delivered.',
milestoneMessage: 'Delivered',
exceptionSource: false,
exceptionExplanation: false,
deliveredAddress:
[ 'Firstname Lastname',
'1234 SESAME STREET',
'SAINT PETERSBURG, FL 33708-3528' ],
{ primaryStatus: 'Delivered Friday, February 9',
secondaryStatus: 'Your package was delivered.',
milestoneMessage: 'Delivered',
exceptionSource: false,
exceptionExplanation: false,
deliveredAddress:
[ 'Firstname Lastname',
'1234 SESAME STREET',
'SAINT PETERSBURG, FL 33708-3528' ],
deliveryPhoto: 'https://us-prod-temp.s3.amazonaws.com/imageId-b4b0be08-baa1-7034-14eb-0ca

@@ -56,23 +69,23 @@ ee635492a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20180214T080911Z&X-Amz-SignedHeaders=

%2Faws4_request&X-Amz-Signature=b4da2566cc3fa15f6baff8b60bc49d80d09fa47864e399442a17bd9de5c
437a7',
events:
[ { date: 'Friday, February 9',
events:
[ { time: '2:36 PM',
message: 'Delivered',
location: 'Saint Petersburg, US' },
{ time: '11:50 AM',
message: 'Out for delivery',
location: 'St. Petersburg, US' },
{ time: '2:33 AM',
message: 'Package arrived at a carrier facility',
location: 'St. Petersburg, US' } ] },
{ date: 'Thursday, February 8',
events:
[ { time: '',
message: 'Package has left seller facility and is in transit to carrier',
location: '' } ] } ] }
437a7',
events:
[ { date: 'Friday, February 9',
events:
[ { time: '2:36 PM',
message: 'Delivered',
location: 'Saint Petersburg, US' },
{ time: '11:50 AM',
message: 'Out for delivery',
location: 'St. Petersburg, US' },
{ time: '2:33 AM',
message: 'Package arrived at a carrier facility',
location: 'St. Petersburg, US' } ] },
{ date: 'Thursday, February 8',
events:
[ { time: '',
message: 'Package has left seller facility and is in transit to carrier',
location: '' } ] } ] }
RUNTIME: 3.185s
RUNTIME: 3.185s
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc