You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.ipynb
+17-1Lines changed: 17 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
"cells": [
3
3
{
4
4
"cell_type": "markdown",
5
+
"id": "b9abc78e",
5
6
"metadata": {},
6
7
"source": [
7
8
"# PlaywrightNB\n",
@@ -11,20 +12,23 @@
11
12
},
12
13
{
13
14
"cell_type": "markdown",
15
+
"id": "d5d27c1c",
14
16
"metadata": {},
15
17
"source": [
16
18
"`PlaywrightNB` provides some little quality-of-life helpers for interactive use of the wonderful [Playwright](https://playwright.dev/python/) library. It's likely to be particularly of interest to folks using Jupyter."
17
19
]
18
20
},
19
21
{
20
22
"cell_type": "markdown",
23
+
"id": "0377fe14",
21
24
"metadata": {},
22
25
"source": [
23
26
"## Install"
24
27
]
25
28
},
26
29
{
27
30
"cell_type": "markdown",
31
+
"id": "a09b5d72",
28
32
"metadata": {},
29
33
"source": [
30
34
"```\n",
@@ -34,6 +38,7 @@
34
38
},
35
39
{
36
40
"cell_type": "markdown",
41
+
"id": "ca411f8a",
37
42
"metadata": {},
38
43
"source": [
39
44
"## Overview"
@@ -42,6 +47,7 @@
42
47
{
43
48
"cell_type": "code",
44
49
"execution_count": null,
50
+
"id": "e25bc855",
45
51
"metadata": {},
46
52
"outputs": [],
47
53
"source": [
@@ -51,6 +57,7 @@
51
57
},
52
58
{
53
59
"cell_type": "markdown",
60
+
"id": "e9cf8278",
54
61
"metadata": {},
55
62
"source": [
56
63
"`playwrightnb` provide two main functions: `read_page_async(url)`, and `read_page(url)`. They are identical except the 1st is async.\n",
@@ -63,6 +70,7 @@
63
70
{
64
71
"cell_type": "code",
65
72
"execution_count": null,
73
+
"id": "fb247968",
66
74
"metadata": {},
67
75
"outputs": [],
68
76
"source": [
@@ -72,6 +80,7 @@
72
80
},
73
81
{
74
82
"cell_type": "markdown",
83
+
"id": "c0ca0667",
75
84
"metadata": {},
76
85
"source": [
77
86
"Use `h2md` to convert the HTML to markdown:"
@@ -80,6 +89,7 @@
80
89
{
81
90
"cell_type": "code",
82
91
"execution_count": null,
92
+
"id": "9f85abbe",
83
93
"metadata": {},
84
94
"outputs": [
85
95
{
@@ -100,6 +110,7 @@
100
110
},
101
111
{
102
112
"cell_type": "markdown",
113
+
"id": "20a86a0e",
103
114
"metadata": {},
104
115
"source": [
105
116
"In the case where you want to grab some particular element using a CSS selector, use `url2md` to read the page, find the selector, and convert to markdown. E.g, for accessing Discord's JS-rendered docs:"
@@ -108,6 +119,7 @@
108
119
{
109
120
"cell_type": "code",
110
121
"execution_count": null,
122
+
"id": "6c468fca",
111
123
"metadata": {},
112
124
"outputs": [],
113
125
"source": [
@@ -119,6 +131,7 @@
119
131
{
120
132
"cell_type": "code",
121
133
"execution_count": null,
134
+
"id": "a2567e8e",
122
135
"metadata": {},
123
136
"outputs": [
124
137
{
@@ -141,13 +154,15 @@
141
154
},
142
155
{
143
156
"cell_type": "markdown",
157
+
"id": "2a766a9a",
144
158
"metadata": {},
145
159
"source": [
146
160
"If you don't need JS-rendering or other fanciness, use `get2md` instead, which uses `httpx.get` instead of playwright."
0 commit comments