mcdonalds_scraper 1.3.0

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.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, "812421");
  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.3.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]
23
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, other

Primary library: package:mcdonalds_scraper/mcdonalds_scraper.dart with components: io.

Health issues and suggestions

Document public APIs. (-0.66 points)

85 out of 86 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.

Format lib/src/mcdonalds_scraper_base.dart.

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
dio ^2.1.10 2.1.13
html ^0.14.0+2 0.14.0+2
path ^1.4.1 1.6.4
Transitive dependencies
charcode 1.1.2
cookie_jar 1.0.1
csslib 0.16.1
source_span 1.5.5
term_glyph 1.1.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0