From 02fba0726b24034f69029c652a97c4903282536e Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Thu, 24 Jun 2021 20:29:13 -0700 Subject: [PATCH] added erowid experiences URL --- README.md | 3 ++- scrape.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 52e1bea..e2653a3 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,12 @@ Script to merge data from PsychonautWiki API + pages and TripSit factsheets into | Property | Type | Description | Source | | ------------------------- | ------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- | | `url` | `string` | Substance page URL | PsychonautWiki if exists, TripSit factsheet otherwise | +| `experiences_url` | `null` \| `string` | Erowid Experience Vault page URL | TripSit | | `name` | `string` | Substance Name | shortest display name of PsychonautWiki page header and TripSit API's `pretty_name` | | `aliases` | `string[]` | List of aliases (lowercase) | Both | | `aliasesStr` | `string` | Comma-separated list of aliases (for fuzzy searching) | Both | | `summary` | `string` | Substance summary | TripSit | -| `reagents` | `string` | Reagent test kit reactions | TripSit | +| `reagents` | `null` \| `string` | Reagent test kit reactions | TripSit | | `classes` | `null` \| `Dictionary` | Substance classifications | PsychonautWiki | | `classes.chemical` | `string[]` | Chemical classifications | PsychonautWiki | | `classes.psychoactive` | `string[]` | Psychoactive classifications | PsychonautWiki | diff --git a/scrape.py b/scrape.py index c3166ca..0581b30 100644 --- a/scrape.py +++ b/scrape.py @@ -357,6 +357,9 @@ for name in all_substance_names: # url will always exist for psychonautwiki substance, so tripsit substance must exist if url is None url = pw_substance.get( 'url') or f"https://drugs.tripsit.me/{ts_substance['name']}" + + ts_links = ts_substance.get('links', {}) + experiences_url = ts_links.get('experiences') # pick display name from available substances found from both datasets names = list(filter(lambda n: n is not None and len(n) > 0, [ @@ -486,6 +489,7 @@ for name in all_substance_names: substance_data.append({ 'url': url, + 'experiences_url': experiences_url, 'name': name, 'aliases': list(aliases), 'aliasesStr': ','.join(aliases),