# polvora/open-anywhere-for-shazam architecture

> Architecture diagram of the GitHub repository polvora/open-anywhere-for-shazam, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/polvora/open-anywhere-for-shazam
- Repository: https://github.com/polvora/open-anywhere-for-shazam

## Overview

This browser extension adds search links for YouTube, YouTube Music, and Spotify to Shazam song pages. Its workflow detects song-page navigation, extracts artist and title from the page DOM, builds localized search buttons, and injects them into the page; URL and DOM observers keep the buttons current as Shazam’s single-page app changes. The runtime is implemented in one content script, so the graph reflects its internal stages rather than implying separate modules. External service links are opened by the user; no service API or data collection is involved.

Main entry points: [`content.js`](https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js) (Song extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Page Enhancement"]
  node_navigation["Navigation watcher<br/>[content.js]"]
  node_songdata["Song extraction<br/>[content.js]"]
  node_buttonbuild["Search buttons<br/>[content.js]"]
  node_injection["Page injection<br/>[content.js]"]
end

node_user(("Shazam visitor"))
node_shazam["Shazam song page"]
node_youtube["YouTube search"]
node_ytmusic["YouTube Music search"]
node_spotify["Spotify search"]

node_user -->|"views"| node_shazam
node_navigation -->|"triggers on song page"| node_songdata
node_shazam -->|"provides page DOM"| node_songdata
node_songdata -->|"provides artist and title"| node_buttonbuild
node_buttonbuild -->|"builds link elements"| node_injection
node_injection -->|"adds buttons"| node_shazam
node_user -->|"opens search"| node_youtube
node_user -->|"opens search"| node_ytmusic
node_user -->|"opens search"| node_spotify

click node_navigation "https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js"
click node_songdata "https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js"
click node_buttonbuild "https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js"
click node_injection "https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_navigation,node_songdata,node_buttonbuild,node_injection toneBlue
class node_user,node_shazam,node_youtube,node_ytmusic,node_spotify toneIndigo
```

## Components

### Page Enhancement

- [Navigation watcher](https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js): `content.js`
- [Song extraction](https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js): `content.js`
- [Search buttons](https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js): `content.js`
- [Page injection](https://github.com/polvora/open-anywhere-for-shazam/blob/main/content.js): `content.js`

### Other components

- **Shazam visitor**
- **Shazam song page**
- **YouTube search**
- **YouTube Music search**
- **Spotify search**

## Connections

- Shazam visitor → Shazam song page: views (evidence: `README.md`)
- Navigation watcher → Song extraction: triggers on song page (evidence: `content.js`)
- Shazam song page → Song extraction: provides page DOM (evidence: `content.js`)
- Song extraction → Search buttons: provides artist and title (evidence: `content.js`)
- Search buttons → Page injection: builds link elements (evidence: `content.js`)
- Page injection → Shazam song page: adds buttons (evidence: `content.js`)
- Shazam visitor → YouTube search: opens search (evidence: `README.md`)
- Shazam visitor → YouTube Music search: opens search (evidence: `README.md`)
- Shazam visitor → Spotify search: opens search (evidence: `README.md`)
