Skip to content

Commit

Permalink
🚚 Moving this around
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigrunixia authored and Sigrunixia committed Oct 29, 2024
1 parent fa9a10c commit dadff84
Show file tree
Hide file tree
Showing 20 changed files with 217 additions and 21 deletions.
8 changes: 8 additions & 0 deletions .obsidian/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trashOption": "local",
"useMarkdownLinks": true,
"showUnsupportedFiles": true,
"attachmentFolderPath": "attachments",
"newLinkFormat": "absolute",
"alwaysUpdateLinks": true
}
9 changes: 9 additions & 0 deletions .obsidian/publish.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"siteId": "50a07676da5ee54e41ba0aac1f7228a5",
"host": "publish-01.obsidian.md",
"included": [
"Images",
"Templates"
],
"excluded": []
}
149 changes: 149 additions & 0 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"main": {
"id": "8e1d48202794cf0a",
"type": "split",
"children": [
{
"id": "eb9424b01c4f04c5",
"type": "tabs",
"children": [
{
"id": "b2b952aa8aa8d889",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Clipper-guides/Obsidian Web Clipper Template Guide for YouTube with transcript.md",
"mode": "source",
"source": true
},
"icon": "lucide-file",
"title": "Obsidian Web Clipper Template Guide for YouTube with transcript"
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "7e1f64d90d2f0be5",
"type": "split",
"children": [
{
"id": "af8692a51ba62b01",
"type": "tabs",
"children": [
{
"id": "824d72818c1a2ef6",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
},
"icon": "lucide-folder-closed",
"title": "Files"
}
},
{
"id": "c35b17159c9c1852",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
},
"icon": "lucide-search",
"title": "Search"
}
}
]
}
],
"direction": "horizontal",
"width": 529.5
},
"right": {
"id": "46591d736a70e1ca",
"type": "split",
"children": [
{
"id": "e4abfcbde703b809",
"type": "tabs",
"children": [
{
"id": "a21f22f16a3b9f7d",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true
},
"icon": "lucide-tags",
"title": "Tags"
}
},
{
"id": "f3ba9dae9896cf36",
"type": "leaf",
"state": {
"type": "outline",
"state": {
"file": "Clipper-guides/Obsidian Web Clipper Template Guide for YouTube with transcript.md"
},
"icon": "lucide-list",
"title": "Outline of Obsidian Web Clipper Template Guide for YouTube with transcript"
}
},
{
"id": "1f8544728520a8ae",
"type": "leaf",
"state": {
"type": "all-properties",
"state": {
"sortOrder": "frequency",
"showSearch": false,
"searchQuery": ""
},
"icon": "lucide-archive",
"title": "All properties"
}
}
]
}
],
"direction": "horizontal",
"width": 300,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"canvas:Create new canvas": false,
"daily-notes:Open today's daily note": false,
"templates:Insert template": false,
"command-palette:Open command palette": false,
"publish:Publish changes...": false
}
},
"active": "b2b952aa8aa8d889",
"lastOpenFiles": [
"Template-guides/Youtube/YouTube-with-transcript.md",
"README.md",
"Resources/Learning-about-CSS-selectors.md",
"Meta/Sample-template-guide.md",
"Meta",
"Clipper-guides/Obsidian Web Clipper Template Guide for YouTube with transcript.md",
"Clipper-guides/Obsidian Web Clipper Template Guide for GitHub Releases.md",
"Resources/Obsidian-web-Clipper.md",
"Template-guides/Youtube"
]
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

## About

To extract content from **GitHub Releases** using [[Obsidian Web Clipper]], we can use [selector variables](https://github.com/obsidianmd/obsidian-clipper?tab=readme-ov-file#selector-variables), to extract only the **release information** content.
To extract content from **GitHub Releases** using [[Resources/Obsidian-web-Clipper]], we can use [selector variables](https://github.com/obsidianmd/obsidian-clipper?tab=readme-ov-file#selector-variables), to extract only the **release information** content.

> [!TIP]
> [[Learning about CSS Selectors]]
> [[Resources/Learning-about-CSS-selectors]]
## TLDR

Expand All @@ -20,23 +20,23 @@ Let's use the release notes for Obsidian Web Clipper 0.9.3 as an example.
Source page: https://github.com/obsidianmd/obsidian-clipper/releases/tag/0.9.3

Rendering the page directly in the browser, usually results in something like:
![[20241020125032-github-releases.png]]
![[Images/20241020125032-github-releases.png]]

In this example, we want to extract only the text from the 0.9.3 release notes, meaning content from both headings "New" and "Improved".

### Inspecting the web page for elements to target

To find the respective elements to extract (using selector variables), we can use the [developer tools](https://developer.chrome.com/docs/devtools/open) in the browser, then search for the relevant content, usually by pressing e.g. `Cmd + Option + I` (macOS), or `F12`. Another quick way to inspect the elements, is simply right clicking click the elements we want to use (selector or selectorHtml)

![[20241020130646-github-releases-inspect.png]]
![[Images/20241020130646-github-releases-inspect.png]]

Notice that if we "hover" the "New" part in the developer tools, the browser dynamically highlights the parts we select in the developer tools.

![[20241020130900-github-releases-h2.png]]
![[Images/20241020130900-github-releases-h2.png]]

If we then hover over the `div` (one level up from `<h2>New<h2>`), we can see that this is the part we actually want to clip. In this case, it seems that the class selector `.markdown-body` can be used to extract the content we need (again, see [[Learning about CSS Selectors]] for a more deepdive on the different class selectors)
If we then hover over the `div` (one level up from `<h2>New<h2>`), we can see that this is the part we actually want to clip. In this case, it seems that the class selector `.markdown-body` can be used to extract the content we need (again, see [[Resources/Learning-about-CSS-selectors]] for a more deepdive on the different class selectors)

![[20241020131050-github-releases-markdown-body.png]]
![[Images/20241020131050-github-releases-markdown-body.png]]


### Testing
Expand All @@ -58,8 +58,8 @@ In short:
> [!NOTE]
> Note that we here use `selectorHtml`, as it sometimes result in better content clipping, especially for code blocks, and special formatting
![[20241020132115-clipper-selectorHtml-markdown-body.png]]
![[Images/20241020132115-clipper-selectorHtml-markdown-body.png]]

Trying to use the clipper with the new template, it should result in something like below:

![[20241020132715-github-releases-side-by-side.png]]
![[Images/20241020132715-github-releases-side-by-side.png]]
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

> [!NOTE]
> See template example [[YouTube with transcript]]
> See template example [Youtube with transcript](Template-guides/Youtube/YouTube-with-transcript.md)
## About

To extract content from **YouTube** videos using [[Obsidian Web Clipper]], we can use a combination of **schema** and [selector variables](https://github.com/obsidianmd/obsidian-clipper?tab=readme-ov-file#selector-variables), to extract:
To extract content from **YouTube** videos using [[Resources/Obsidian-web-Clipper]], we can use a combination of **schema** and [selector variables](https://github.com/obsidianmd/obsidian-clipper?tab=readme-ov-file#selector-variables), to extract:
- video **upload date**, using `schema:@VideoObject:uploadDate`
- video **duration** (in seconds), using `schema:@VideoObject:duration`
- video **description**, using `{{schema:@VideoObject:description}}`
- video **transcript**, using `selectorHtml:.ytd-transcript-segment-list-renderer`

> [!TIP]
> [[Learning about CSS Selectors]]
> [[Resources/Learning-about-CSS-selectors]]

## Example details
Expand All @@ -23,20 +23,20 @@ Source video: https://www.youtube.com/watch?v=g2_XEDoPF4s

To be able to extract the transcript, we also need to first open the transcript box, by pressing "more" and then "Show transcript"

![[20241021093336-youtube-more.png]]
![[Images/20241021093336-youtube-more.png]]

![[20241021093412-youtube-show-transcript.png]]
![[Images/20241021093412-youtube-show-transcript.png]]

Transcript should then load (if available), e.g.

![[20241021093438-youtube-transcript.png]]
![[Images/20241021093438-youtube-transcript.png]]
## Inspect the web page for elements to target

First, we can check what **page variables** [[Obsidian Web Clipper]] is able to automatically "detect" for us, by selecting `...` in the extension.
First, we can check what **page variables** [[Resources/Obsidian-web-Clipper]] is able to automatically "detect" for us, by selecting `...` in the extension.

If we scroll down, we see a lot of possible page variables. In this example, I've highlighted a few we will try to extract later.

![[20241021093848-youtube-page-variables.png]]
![[Images/20241021093848-youtube-page-variables.png]]

> [!NOTE]
> Notice that `description` (text) and `uploadDate` (combined with **date filter**) can be used "as is", but that the `duration` (in seconds here) includes both a prefix and suffix, around the actual seconds part (PT**1039**S). Of course these prefixes and suffixes can have valid use cases (e.g. to indicate that it's time, and in seconds, etc.), but if we only want to extract the seconds part, meaning removing the prefix (PT) and suffix (S), we could use the **replace filter** to basically replace "something" with "something else", or in this case, replace "something" with "nothing".
Expand Down
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
## Description of the template
---
aliases: Sample template guide
description: Enter your template description here
publish: true
cover:
permalink: meta/sample-template-guide
tags: Meta
---

%% Delete all markdown comments when done %%

%% Add your image. It should be in `.webp` format. ![IMAGE ALT TEXT](IMAGE HERE) %%

## Description

%% What does it do? Edit this in your PR %%
%% Need a completed example? See [YouTube with transcript](Template-guides/Youtube/YouTube-with-transcript.md) %%

%% Add your image. It should be in `.webp` format. %%

![IMAGE ALT TEXT](IMAGE HERE)


##

### Related resources
%% Add a link to the guide and .json download, if any. Erase if there is none. %%
**Related guide(s)**: `[Sample template](/Guides/sample-template.md)`
%% Add a link to the .json download. Erase if there is none. %%
**Download the `.json`**: `[sample-templayte.json](sample-template.json)`

You can also copy the codeblock below to paste into Obsidian Clipper with the following steps.
Expand All @@ -18,6 +37,8 @@ You can also copy the codeblock below to paste into Obsidian Clipper with the fo
6. Paste the `.json` content into the Json template area.
7. Select import.

## Template codeblock

%% Paste your .json contents in the json codeblock below %%
```json
{
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Obsidian Web Clipper templates
This is a community collection of templates for the official [Obsidian Web Clipper extension](https://github.com/obsidianmd/obsidian-clipper). We are still under construction.

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
---
aliases: Youtube with Transcript
description:
publish: true
cover:
permalink: youtube/youtube-with-transcript
tags:
---

Related guide: [[Obsidian Web Clipper Template Guide for YouTube with transcript]]
Related guide: [[Clipper-guides/Obsidian Web Clipper Template Guide for YouTube with transcript]]

This template should be able to extract:
- video **upload date**, using `schema:@VideoObject:uploadDate`
Expand Down

0 comments on commit dadff84

Please sign in to comment.