mcdonalds_scraper 1.4.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 43

Used to scrape McDonald's PeopleStuff for MySchedule

Created from templates made available by Stagehand under a BSD-style license.

Usage #

A simple usage example:

import 'package:mcdonalds_scraper/mcdonalds_scraper.dart';
import 'dart:io';

Future<Map<String, String>> getCredentials() async {
  var config = File('credentials.txt');
  var contents;

  // Put each line of the file into its own string.
  contents = await config.readAsLines();
  
  return {"employeeId": contents[0], "password": contents[1]};
}

main() async {

  Map<String, String> creds = await getCredentials();

  var scraper = Scraper();
  await scraper.login(creds["employeeId"], creds["password"]);
  var htmlData = await scraper.scrapeHtml();
  var allPersonData = await scraper.extractPersonData(htmlData);
  var taskData = await scraper.extractTaskData(htmlData, DateTime.parse("2019-08-10 20:18:04Z"));
  var personData = scraper.extractSinglePersonData(allPersonData, creds["employeeId"]);
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

All notable changes to this project will be documented in this file. See commit history for more details

1.4.0 #

  • Add support for getting historic clock data.

1.3.0 #

  • Add support for checking shifts that run at the same time.

1.2.1 (2019-08-13)

  • Optimise advance scraping and fix auth bug.

1.2.0 (2019-08-12)

  • Scrape weeks in the future.

1.1.0 (2019-08-10)

  • Add function to view scheduled dates.

1.0.2 (2019-08-08)

  • Refix CHANGELOG.md

1.0.1 (2019-08-08)

  • General maintenance for dart pub

1.0.0 #

  • Initial version, created by Stagehand

example/mcdonalds_scraper_example.dart

import 'package:mcdonalds_scraper/mcdonalds_scraper.dart';
import 'dart:io';

Future<Map<String, String>> getCredentials() async {
  var config = File('credentials.txt');
  var contents;

  // Put each line of the file into its own string.
  contents = await config.readAsLines();

  return {"employeeId": contents[0], "password": contents[1]};
}

main() async {
  Map<String, String> creds = await getCredentials();

  var scraper = Scraper();
  await scraper.login(creds["employeeId"], creds["password"]);
  var htmlData = await scraper.scrapeHtml();
  var allPersonData = await scraper.extractPersonData(htmlData);
  var taskData = await scraper.extractTaskData(
      htmlData, DateTime.parse("2019-08-10 20:18:04Z"));
  var personData = scraper.extractSinglePersonData(allPersonData, creds["employeeId"]);
  var clockData = await scraper.scrapeHistoricClocks(personId: personData.employee.personId, currentWeek: 37, genShiftId: 71937);
  var concurrent = scraper.concurrentShifts(allPersonData, personData.shifts[0]);
  var weekData = scraper.extractAvailableWeeks(htmlData);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mcdonalds_scraper: ^1.4.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mcdonalds_scraper/mcdonalds_scraper.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
43
Learn more about scoring.

We analyzed this package on Jan 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health issues and suggestions

Document public APIs. (-0.71 points)

103 out of 104 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/model.dart. (-2.48 points)

Analysis of lib/src/model.dart reported 5 hints:

line 243 col 16: The value of the local variable 'a' isn't used.

line 247 col 13: The value of the local variable 'i' isn't used.

line 276 col 5: The label 'hourlyPaidEmployee' isn't used.

line 277 col 5: The label 'employeeOnContract' isn't used.

line 278 col 5: The label 'onLeaveInThisWeek' isn't used.

Format lib/src/mcdonalds_scraper_base.dart.

Run dartfmt to format lib/src/mcdonalds_scraper_base.dart.

Maintenance issues and suggestions

Support latest dependencies. (-30 points)

The version constraint in pubspec.yaml does not support the latest published versions for 3 dependencies (dio, intl, xml2json).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
dio ^2.1.10 2.2.2 3.0.8
html ^0.14.0+2 0.14.0+3
intl 0.16.0 0.16.0 0.16.1
path ^1.4.1 1.6.4
xml2json 4.0.0 4.0.0 4.1.1
Transitive dependencies
charcode 1.1.2
collection 1.14.12
convert 2.1.1
cookie_jar 1.0.1
csslib 0.16.1
meta 1.1.8
petitparser 3.0.0
source_span 1.6.0
term_glyph 1.1.0
typed_data 1.1.6
xml 3.7.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0