Datasets:
Add detailed dataset card and the scraping pipeline used to build it
Browse files- README.md +416 -15
- scraping/README.md +47 -0
- scraping/crawler.py +330 -0
- scraping/finalize.ipynb +194 -0
README.md
CHANGED
|
@@ -1,4 +1,39 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
dataset_info:
|
| 3 |
features:
|
| 4 |
- name: title
|
|
@@ -19,18 +54,384 @@ dataset_info:
|
|
| 19 |
num_examples: 11771
|
| 20 |
download_size: 32189311
|
| 21 |
dataset_size: 51059386
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- de
|
| 4 |
+
pretty_name: COMPACT-Magazin (compact-online.de)
|
| 5 |
+
size_categories:
|
| 6 |
+
- 10K<n<100K
|
| 7 |
+
task_categories:
|
| 8 |
+
- text-generation
|
| 9 |
+
- text-classification
|
| 10 |
+
- summarization
|
| 11 |
+
- feature-extraction
|
| 12 |
+
tags:
|
| 13 |
+
- alternative-media
|
| 14 |
+
- german
|
| 15 |
+
- journalism
|
| 16 |
+
- magazine
|
| 17 |
+
- media
|
| 18 |
+
- media-bias
|
| 19 |
+
- news
|
| 20 |
+
- news-articles
|
| 21 |
+
- political-extremism-research
|
| 22 |
+
- right-wing
|
| 23 |
+
- web-scraping
|
| 24 |
+
annotations_creators:
|
| 25 |
+
- no-annotation
|
| 26 |
+
language_creators:
|
| 27 |
+
- found
|
| 28 |
+
multilinguality:
|
| 29 |
+
- monolingual
|
| 30 |
+
source_datasets:
|
| 31 |
+
- original
|
| 32 |
+
configs:
|
| 33 |
+
- config_name: default
|
| 34 |
+
data_files:
|
| 35 |
+
- split: train
|
| 36 |
+
path: data/train-*
|
| 37 |
dataset_info:
|
| 38 |
features:
|
| 39 |
- name: title
|
|
|
|
| 54 |
num_examples: 11771
|
| 55 |
download_size: 32189311
|
| 56 |
dataset_size: 51059386
|
| 57 |
+
---
|
| 58 |
+
|
| 59 |
+
# COMPACT-Magazin (compact-online.de)
|
| 60 |
+
|
| 61 |
+
**11 771 German-language news articles** crawled from
|
| 62 |
+
[`www.compact-online.de`](https://www.compact-online.de/) and published as a Hugging Face dataset.
|
| 63 |
+
This is part of the [German Media collection](https://huggingface.co/collections/SinclairSchneider/german-media),
|
| 64 |
+
a set of comparable corpora covering the German media landscape from public-service
|
| 65 |
+
broadcasters to alternative and fringe outlets, all built with the same crawler and the same
|
| 66 |
+
extraction pipeline so that they can be compared and combined directly.
|
| 67 |
+
|
| 68 |
+
> ⚠️ **Research material.** The articles are reproduced verbatim from the publisher's website.
|
| 69 |
+
> Their content expresses the views of that publisher, not of the dataset author.
|
| 70 |
+
|
| 71 |
+
## At a glance
|
| 72 |
+
|
| 73 |
+
| | |
|
| 74 |
+
|---|---|
|
| 75 |
+
| **Source** | [`www.compact-online.de`](https://www.compact-online.de/) |
|
| 76 |
+
| **Rows** | 11 771 |
|
| 77 |
+
| **Columns** | 6 (`title`, `content`, `author`, `description`, `datePublished`, `url`) |
|
| 78 |
+
| **Language** | German (`de`) |
|
| 79 |
+
| **Split** | `train` (single split) |
|
| 80 |
+
| **Format** | Parquet, 1 shard, ≈ 31 MB download / 49 MB in memory |
|
| 81 |
+
| **Perceived partisanship** | 6.0 / 7 → *right of centre* ([medienkompass.org](https://medienkompass.org/deutsche-medienlandschaft/) reader survey) |
|
| 82 |
+
| **Mirror** | [`NLP-UniBW/compact_de`](https://huggingface.co/datasets/NLP-UniBW/compact_de) |
|
| 83 |
+
|
| 84 |
+
```python
|
| 85 |
+
from datasets import load_dataset
|
| 86 |
+
|
| 87 |
+
ds = load_dataset("SinclairSchneider/compact_de", split="train")
|
| 88 |
+
print(ds[0]["title"])
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
## About the source
|
| 92 |
+
|
| 93 |
+
[COMPACT-Magazin](https://www.compact-online.de/) is a German monthly magazine and online
|
| 94 |
+
outlet founded in 2010 by Jürgen Elsässer. The German domestic intelligence service
|
| 95 |
+
(*Bundesamt für Verfassungsschutz*) has classified COMPACT as a confirmed right-wing extremist
|
| 96 |
+
organisation (*gesichert rechtsextremistische Bestrebung*) since 2021. In July 2024 the Federal
|
| 97 |
+
Ministry of the Interior banned the magazine's publishing company; the ban was suspended by the
|
| 98 |
+
Federal Administrative Court (*Bundesverwaltungsgericht*) in August 2024 and overturned by that court
|
| 99 |
+
in June 2025. The dataset is published as **research material** for the study of radical-right
|
| 100 |
+
discourse, propaganda and disinformation — it is not an endorsement of its content.
|
| 101 |
+
|
| 102 |
+
## Perceived political position
|
| 103 |
+
|
| 104 |
+
The German media compass at
|
| 105 |
+
[medienkompass.org](https://medienkompass.org/deutsche-medienlandschaft/) places German
|
| 106 |
+
mainstream and alternative outlets on two axes on the basis of a reader survey
|
| 107 |
+
(*n* ≈ 1 154 participants in total, building on a media map by the think tank
|
| 108 |
+
*polisphere*; the quality axis is adapted from Vanessa Otero's media chart).
|
| 109 |
+
|
| 110 |
+
* **x axis — *Parteilichkeit* (partisanship), 1–7:** `< 3.5` left, `3.5 – 4.5` relatively
|
| 111 |
+
neutral, `> 4.5` right.
|
| 112 |
+
`1` far-left (fake news and conspiracy theories) · `2` left mission (questionable journalistic
|
| 113 |
+
standards) · `3` leaning left · `4` minimal partisan tendency · `5` leaning right ·
|
| 114 |
+
`6` right mission (questionable journalistic standards) · `7` far-right (fake news and
|
| 115 |
+
conspiracy theories).
|
| 116 |
+
* **y axis — *Qualität* (quality), 1–5:** `1` sensationalist / clickbait · `2` basic information ·
|
| 117 |
+
`3` meets high standards · `4` analytical · `5` complex.
|
| 118 |
+
|
| 119 |
+
In that survey, **Compact** is rated:
|
| 120 |
+
|
| 121 |
+
| | Score | Reading |
|
| 122 |
+
|---|---:|---|
|
| 123 |
+
| Partisanship (1–7) | **6.0** | right of centre |
|
| 124 |
+
| Quality (1–5) | **1.8** | on the 1 = clickbait … 5 = complex scale |
|
| 125 |
+
|
| 126 |
+
```
|
| 127 |
+
Parteilichkeit (partisanship): 1 = far left ... 7 = far right
|
| 128 |
+
|
| 129 |
+
1 2 3 4 5 6 7
|
| 130 |
+
|---------|---------|---------|---------|---------|---------|
|
| 131 |
+
^
|
| 132 |
+
Compact = 6.0
|
| 133 |
+
|
| 134 |
+
left <--------------| neutral |--------------> right
|
| 135 |
+
3.5 4.5
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
For context, here is the full survey table, sorted from left to right — the other outlets in
|
| 139 |
+
the collection are directly comparable:
|
| 140 |
+
|
| 141 |
+
| Outlet | Partisanship (1–7) | Quality (1–5) |
|
| 142 |
+
|---|---:|---:|
|
| 143 |
+
| indymedia | 2.0 | 1.7 |
|
| 144 |
+
| Jungle World | 2.3 | 2.3 |
|
| 145 |
+
| junge Welt | 2.4 | 2.3 |
|
| 146 |
+
| neues Deutschland | 2.6 | 2.3 |
|
| 147 |
+
| der Freitag | 2.7 | 2.9 |
|
| 148 |
+
| die Tageszeitung | 2.8 | 2.7 |
|
| 149 |
+
| Vice | 2.8 | 1.8 |
|
| 150 |
+
| NachDenkSeiten | 3.1 | 3.0 |
|
| 151 |
+
| Frankfurter Rundschau | 3.4 | 2.8 |
|
| 152 |
+
| SPON | 3.5 | 2.1 |
|
| 153 |
+
| Spiegel Print | 3.5 | 2.9 |
|
| 154 |
+
| Süddeutsche | 3.5 | 3.3 |
|
| 155 |
+
| WDR | 3.5 | 2.8 |
|
| 156 |
+
| Tagesspiegel | 3.6 | 2.8 |
|
| 157 |
+
| Zeit | 3.6 | 3.5 |
|
| 158 |
+
| ARD | 3.7 | 2.9 |
|
| 159 |
+
| NDR | 3.7 | 2.8 |
|
| 160 |
+
| Deutschlandfunk | 3.8 | 3.5 |
|
| 161 |
+
| Stern | 3.8 | 2.1 |
|
| 162 |
+
| ZDF | 3.8 | 2.8 |
|
| 163 |
+
| MDR | 4.1 | 2.5 |
|
| 164 |
+
| Handelsblatt | 4.3 | 3.3 |
|
| 165 |
+
| NTV | 4.3 | 2.1 |
|
| 166 |
+
| BR | 4.4 | 2.6 |
|
| 167 |
+
| N24 | 4.4 | 2.0 |
|
| 168 |
+
| Wirtschaftswoche | 4.4 | 3.1 |
|
| 169 |
+
| Frankfurter Allgemeine | 4.5 | 3.3 |
|
| 170 |
+
| RTL | 4.5 | 1.5 |
|
| 171 |
+
| Die Welt | 4.8 | 2.5 |
|
| 172 |
+
| Cicero | 4.9 | 3.1 |
|
| 173 |
+
| Focus Online | 4.9 | 1.7 |
|
| 174 |
+
| Deutsche Wirtschafts Nachrichten | 5.0 | 2.2 |
|
| 175 |
+
| MM News | 5.1 | 1.7 |
|
| 176 |
+
| RT Deutsch | 5.1 | 2.0 |
|
| 177 |
+
| Achgut | 5.2 | 2.4 |
|
| 178 |
+
| BILD | 5.2 | 1.3 |
|
| 179 |
+
| Tichys | 5.5 | 2.6 |
|
| 180 |
+
| junge Freiheit | 5.8 | 1.9 |
|
| 181 |
+
| **Compact** ⬅ this dataset | **6.0** | **1.8** |
|
| 182 |
+
|
| 183 |
+
> **How to read these numbers.** They are *perception* data from a self-selected online survey,
|
| 184 |
+
> not a content analysis: participants rated outlets they know, the sample is not
|
| 185 |
+
> representative of the German population, and the site itself describes the project as an early
|
| 186 |
+
> iteration. Treat them as a rough, crowd-sourced orientation — useful for grouping datasets into
|
| 187 |
+
> coarse political blocks, not as ground truth for bias labelling.
|
| 188 |
+
|
| 189 |
+
## Dataset structure
|
| 190 |
+
|
| 191 |
+
Single `train` split with 11 771 rows and the following columns:
|
| 192 |
+
|
| 193 |
+
| Column | Type | Description | Extracted from |
|
| 194 |
+
|---|---|---|---|
|
| 195 |
+
| `title` | `string` | Headline of the article. | `<meta property="og:title">`, with the trailing `" - COMPACT"` removed |
|
| 196 |
+
| `content` | `string` | Full plain-text body of the article. | all `<p>` inside `div.post-content`, space-joined |
|
| 197 |
+
| `author` | `string` | Author(s) as published by the outlet. | `<meta name="author">` |
|
| 198 |
+
| `description` | `string` | Teaser / meta description of the article. | `<meta property="og:description">` |
|
| 199 |
+
| `datePublished` | `string` | Publication timestamp. | `datetime` attribute of `<time class="post-date">` |
|
| 200 |
+
| `url` | `string` | Canonical URL the article was fetched from. | the crawled URL |
|
| 201 |
+
|
| 202 |
+
### Example record
|
| 203 |
+
|
| 204 |
+
```json
|
| 205 |
+
{
|
| 206 |
+
"title": "Joe Biden & Sohn: Korruption, Drogen und Desinformations-Kampagnen",
|
| 207 |
+
"content": "In den USA tobt im Vorfeld der Präsidentschaftswahlen ein digitaler Bürgerkrieg. Darüber und über die Korruptionsskandale über Joe Biden und seinem Sohn berichtete jetzt das russische TV. +++ Brandaktuell zum US-Wahlkampf: Die neue COMPACT 11/2020 – ab Samstag an jedem guten Kiosk. Direkt hier bestellen oder auf Digital+ online lesen. +++ Es folgt ein Bericht der Sendung „Nachrichten der Woche“ au …",
|
| 208 |
+
"author": "COMPACT Redaktion",
|
| 209 |
+
"description": "In den USA tobt im Vorfeld der Präsidentschaftswahlen ein digitaler Bürgerkrieg. Darüber und über die Korruptionsskandale über Joe Biden und seinem Sohn berichtete jetzt das russische TV. +++ Brandaktuell zum US-Wahlkampf: Die neue COMPACT 11/2020 – ab Samstag an jedem guten Kiosk. Direkt hier bestellen oder auf Digital+ online lesen. +++ Es folgt ein Bericht",
|
| 210 |
+
"datePublished": "2020-10-20T12:48:59+02:00",
|
| 211 |
+
"url": "https://www.compact-online.de/joe-biden-sohn-korruption-drogen-und-desinformations-kampagnen/"
|
| 212 |
+
}
|
| 213 |
+
```
|
| 214 |
+
|
| 215 |
+
## Temporal coverage
|
| 216 |
+
|
| 217 |
+
The `datePublished` column could be parsed for **11 754 of 11 771** rows (99.9 %). Those rows span **2019-02-28 → 2025-06-13**.
|
| 218 |
+
|
| 219 |
+
| Year | Articles | |
|
| 220 |
+
|---:|---:|:---|
|
| 221 |
+
| 2019 | 3 | `█` |
|
| 222 |
+
| 2020 | 1 777 | `██████████████████` |
|
| 223 |
+
| 2021 | 1 863 | `███████████████████` |
|
| 224 |
+
| 2022 | 2 348 | `████████████████████████` |
|
| 225 |
+
| 2023 | 2 315 | `████████████████████████` |
|
| 226 |
+
| 2024 | 2 205 | `███████████████████████` |
|
| 227 |
+
| 2025 | 1 243 | `█████████████` |
|
| 228 |
+
|
| 229 |
+
## How the data was collected
|
| 230 |
+
|
| 231 |
+
The whole pipeline is contained in this repository under [`scraping/`](./scraping) and consists
|
| 232 |
+
of two steps: a distributed crawler that walks the site and writes one JSON file per article, and
|
| 233 |
+
a consolidation notebook that merges those files into the dataset you are reading.
|
| 234 |
+
|
| 235 |
+
### 1. Crawling — [`scraping/crawler.py`](./scraping/crawler.py)
|
| 236 |
+
|
| 237 |
+
The crawler is a breadth-first whole-site crawler built on
|
| 238 |
+
[MechanicalSoup](https://mechanicalsoup.readthedocs.io/) and `multiprocessing`:
|
| 239 |
+
|
| 240 |
+
1. **Sharded frontier.** 32 worker processes each own one `multiprocessing.Manager().Queue()`.
|
| 241 |
+
A URL is assigned to a worker by `int(md5(url).hexdigest(), 16) % 32`, so every URL is always
|
| 242 |
+
handled by the same worker and no locking or cross-process deduplication is needed.
|
| 243 |
+
2. **Seed.** The crawl is seeded with a single article URL
|
| 244 |
+
(`https://www.compact-online.de/usa-kennedy-raeumt-auf/`) and discovers
|
| 245 |
+
everything else by following links.
|
| 246 |
+
3. **Link discovery.** Every fetched page is parsed with BeautifulSoup/lxml; all `<a href>` values
|
| 247 |
+
that start with `https://www.compact-online.de/` or with `/` (which are then made absolute) are added to the
|
| 248 |
+
frontier. URLs containing `#` are dropped.
|
| 249 |
+
4. **URL filtering.** Before fetching, a URL is skipped when it contains `/files/`, `/video/`,
|
| 250 |
+
`.jpg`, `.pdf`, `.xml`, `.pptx`, `.shtml` or `.epub`, or when it has fewer than five path segments (which filters out section index pages).
|
| 251 |
+
5. **Fetching.** Each URL gets up to 10 attempts with a 10 s timeout.
|
| 252 |
+
6. **Extraction.** `get_content()` turns the HTML into a record (see below). Only pages with a
|
| 253 |
+
non-empty `content` are written out, as `pages/<flattened-url>.json`.
|
| 254 |
+
7. **Resumability.** Each worker appends every known and every visited URL to
|
| 255 |
+
`data/thread_<id>_pages.txt` and `data/thread_<id>_pages_visited.txt`, and re-reads them on
|
| 256 |
+
start, so an interrupted crawl continues where it stopped. Creating a file named `killall.txt`
|
| 257 |
+
in the working directory stops all workers cleanly.
|
| 258 |
+
|
| 259 |
+
Crawler settings used for this site:
|
| 260 |
+
|
| 261 |
+
- **Worker processes:** 32 (`iNumberOfThreads = 32`)
|
| 262 |
+
- **Retries per URL:** 10, with a 10-second socket timeout per attempt
|
| 263 |
+
- **Proxy pool:** not used — the original crawl connected directly (the published script can still route through proxies via `SCRAPER_PROXIES`, see below)
|
| 264 |
+
- **User-agent rotation:** yes, a random UA per request via `fake_useragent`
|
| 265 |
+
- **Politeness delay:** `time.sleep(random.uniform(1.0, 3.5))` before every request
|
| 266 |
+
- **Bot-challenge handling:** responses containing `#challenge-error-text` or `You don't have permission to access` are discarded and retried after a short pause
|
| 267 |
+
- **Raw HTML dump:** enabled (`raw/`), used for debugging the parser
|
| 268 |
+
|
| 269 |
+
**Paywall handling.** Pages that show the WP-Members notice `div#wpmem_restricted_msg` are treated as members-only and skipped.
|
| 270 |
+
|
| 271 |
+
### 2. Article extraction
|
| 272 |
+
|
| 273 |
+
`get_content()` reads the fields from the page's JSON-LD (`<script type="application/ld+json">`)
|
| 274 |
+
and/or its HTML, as follows:
|
| 275 |
+
|
| 276 |
+
| Field | Source in the page |
|
| 277 |
+
|---|---|
|
| 278 |
+
| `title` | `<meta property="og:title">`, with the trailing `" - COMPACT"` removed |
|
| 279 |
+
| `content` | all `<p>` inside `div.post-content`, space-joined |
|
| 280 |
+
| `author` | `<meta name="author">` |
|
| 281 |
+
| `description` | `<meta property="og:description">` |
|
| 282 |
+
| `datePublished` | `datetime` attribute of `<time class="post-date">` |
|
| 283 |
+
| `url` | the crawled URL |
|
| 284 |
+
|
| 285 |
+
Pages whose `application/ld+json` block fails to parse are skipped entirely —
|
| 286 |
+
on this WordPress installation a broken JSON-LD block reliably indicates an error or interstitial page
|
| 287 |
+
rather than an article.
|
| 288 |
+
|
| 289 |
+
Each article is stored as a JSON file of the shape
|
| 290 |
+
|
| 291 |
+
```json
|
| 292 |
+
{
|
| 293 |
+
"title": "…",
|
| 294 |
+
"content": "…",
|
| 295 |
+
"additional_attributes": { "author": "…", "description": "…", "datePublished": "…", "url": "…" }
|
| 296 |
+
}
|
| 297 |
+
```
|
| 298 |
+
|
| 299 |
+
### 3. Consolidation — [`scraping/finalize.ipynb`](./scraping/finalize.ipynb)
|
| 300 |
+
|
| 301 |
+
1. `glob("pages/*.json")` collects every article file.
|
| 302 |
+
2. The nested records are flattened into one `pandas.DataFrame` column per field.
|
| 303 |
+
3. `df.drop_duplicates(subset=['title'])` removes duplicates — the same article is often reachable
|
| 304 |
+
under several URLs (print/mobile variants, tracking parameters, section mirrors), and the
|
| 305 |
+
headline is the most reliable identity key available.
|
| 306 |
+
4. The frame is written to `compact_de.json` and pushed with
|
| 307 |
+
`datasets.Dataset.from_pandas(df).push_to_hub("SinclairSchneider/compact_de")`.
|
| 308 |
+
|
| 309 |
+
### Dataset-specific notes
|
| 310 |
+
|
| 311 |
+
- The site has no usable `keywords` / `category` markup, so those columns do not exist in this dataset.
|
| 312 |
+
|
| 313 |
+
### Reproducing the crawl
|
| 314 |
+
|
| 315 |
+
```bash
|
| 316 |
+
pip install mechanicalsoup beautifulsoup4 lxml python-dateutil fake-useragent \
|
| 317 |
+
pandas datasets huggingface_hub tqdm
|
| 318 |
+
|
| 319 |
+
mkdir compact_de && cd compact_de
|
| 320 |
+
curl -L -O https://huggingface.co/datasets/SinclairSchneider/compact_de/resolve/main/scraping/crawler.py
|
| 321 |
+
|
| 322 |
+
python crawler.py # writes pages/*.json; `touch killall.txt` to stop
|
| 323 |
+
jupyter notebook finalize.ipynb
|
| 324 |
+
```
|
| 325 |
+
|
| 326 |
+
#### Routing the crawl through your own proxies
|
| 327 |
+
|
| 328 |
+
The original crawl ran behind a pool of forward proxies on a private network. Those addresses are
|
| 329 |
+
infrastructure-specific and have been **removed** from the published script. Instead, `crawler.py`
|
| 330 |
+
reads the `SCRAPER_PROXIES` environment variable: a comma-separated list of proxies, written with
|
| 331 |
+
or without a scheme (`http://` is assumed when none is given). One entry is picked per request, so
|
| 332 |
+
a pool spreads the load across several exits.
|
| 333 |
+
|
| 334 |
+
```bash
|
| 335 |
+
# a single proxy
|
| 336 |
+
export SCRAPER_PROXIES="proxy-a.example.com:3128"
|
| 337 |
+
|
| 338 |
+
# a pool, rotated per request
|
| 339 |
+
export SCRAPER_PROXIES="proxy-a.example.com:3128,proxy-b.example.com:3128"
|
| 340 |
+
|
| 341 |
+
# with an explicit scheme and credentials
|
| 342 |
+
export SCRAPER_PROXIES="http://user:pass@proxy.example.com:3128"
|
| 343 |
+
|
| 344 |
+
# SOCKS, if PySocks is installed
|
| 345 |
+
export SCRAPER_PROXIES="socks5://localhost:9050"
|
| 346 |
+
|
| 347 |
+
# back to a direct connection — this is the default
|
| 348 |
+
unset SCRAPER_PROXIES
|
| 349 |
+
|
| 350 |
+
python crawler.py
|
| 351 |
+
```
|
| 352 |
+
|
| 353 |
+
Internally this becomes `requests`' standard `{'http': …, 'https': …}` proxy mapping; with the
|
| 354 |
+
variable unset the mapping is empty and the crawler connects directly. No credentials, cookies or
|
| 355 |
+
personal data are contained in the published code.
|
| 356 |
+
|
| 357 |
+
**Please crawl responsibly:** respect `robots.txt` and the site's terms of use, keep the
|
| 358 |
+
concurrency far below the 32 workers used here unless you have the site's permission, and prefer
|
| 359 |
+
this published dataset over re-crawling.
|
| 360 |
+
|
| 361 |
+
## Usage
|
| 362 |
+
|
| 363 |
+
```python
|
| 364 |
+
from datasets import load_dataset
|
| 365 |
+
import pandas as pd
|
| 366 |
+
|
| 367 |
+
ds = load_dataset("SinclairSchneider/compact_de", split="train")
|
| 368 |
+
|
| 369 |
+
# stream instead of downloading everything
|
| 370 |
+
stream = load_dataset("SinclairSchneider/compact_de", split="train", streaming=True)
|
| 371 |
+
print(next(iter(stream))["title"])
|
| 372 |
+
|
| 373 |
+
# as a DataFrame
|
| 374 |
+
df = ds.to_pandas()
|
| 375 |
+
df["datePublished"] = pd.to_datetime(df["datePublished"], errors="coerce", utc=True, format="mixed")
|
| 376 |
+
recent = df[df["datePublished"].dt.year >= 2024]
|
| 377 |
+
print(len(recent), "articles from 2024 onwards")
|
| 378 |
+
```
|
| 379 |
+
|
| 380 |
+
Combining several outlets into one comparative corpus:
|
| 381 |
+
|
| 382 |
+
```python
|
| 383 |
+
from datasets import load_dataset, concatenate_datasets
|
| 384 |
+
|
| 385 |
+
outlets = ["SinclairSchneider/compact_de", "SinclairSchneider/tagesschau_de"]
|
| 386 |
+
parts = []
|
| 387 |
+
for name in outlets:
|
| 388 |
+
d = load_dataset(name, split="train").select_columns(["title", "content", "url"])
|
| 389 |
+
parts.append(d.add_column("outlet", [name.split("/")[-1]] * len(d)))
|
| 390 |
+
corpus = concatenate_datasets(parts)
|
| 391 |
+
```
|
| 392 |
+
|
| 393 |
+
## Limitations and biases
|
| 394 |
+
|
| 395 |
+
- **Crawl, not archive.** Coverage is whatever was reachable by following links from the seed URL
|
| 396 |
+
at crawl time. Articles that were deleted, depublished or orphaned before the crawl are missing,
|
| 397 |
+
and old content is covered less densely than recent content.
|
| 398 |
+
- **Free content only.** Paywalled articles were deliberately skipped, so the dataset under-represents long-form and investigative pieces, which are the ones most often placed behind the paywall.
|
| 399 |
+
- **Deduplication by headline.** Two genuinely different articles with an identical headline
|
| 400 |
+
(common for recurring formats such as weather or daily briefings) collapse into one row.
|
| 401 |
+
- **Noisy metadata.** `author`, `category` and `keywords` come straight from the publisher's markup,
|
| 402 |
+
which changed over the years; empty strings are common and category labels are not harmonised
|
| 403 |
+
across outlets.
|
| 404 |
+
- **Editorial perspective.** This is the output of a single outlet. Any model trained on it alone
|
| 405 |
+
inherits that outlet's selection of topics, framing and vocabulary — which is exactly why the
|
| 406 |
+
collection provides the same pipeline across the political spectrum.
|
| 407 |
+
- **No text normalisation.** Bodies are the concatenated paragraphs as published, including
|
| 408 |
+
typographic quotes, soft hyphens and occasional residual boilerplate.
|
| 409 |
+
|
| 410 |
+
## Licensing and intended use
|
| 411 |
+
|
| 412 |
+
The crawling and extraction code in `scraping/` is released for reuse. The **article texts remain
|
| 413 |
+
the copyright of COMPACT / its publisher**; they are reproduced here for non-commercial
|
| 414 |
+
research purposes such as text mining, media-bias research, discourse analysis and language-model
|
| 415 |
+
evaluation. If you intend to use the texts in another setting — redistribution, commercial use,
|
| 416 |
+
or publication of substantial verbatim excerpts — check German copyright law (in particular
|
| 417 |
+
§ 60d UrhG on text and data mining for research) and the publisher's terms of use. If you are a
|
| 418 |
+
rights holder and want content removed, please open a discussion on this repository.
|
| 419 |
+
|
| 420 |
+
## Citation
|
| 421 |
+
|
| 422 |
+
```bibtex
|
| 423 |
+
@misc{compact_de_dataset,
|
| 424 |
+
title = {COMPACT-Magazin (compact-online.de): a corpus of German news articles},
|
| 425 |
+
author = {Schneider, Sinclair},
|
| 426 |
+
year = {2025},
|
| 427 |
+
howpublished = {Hugging Face},
|
| 428 |
+
url = {https://huggingface.co/datasets/SinclairSchneider/compact_de}
|
| 429 |
+
}
|
| 430 |
+
```
|
| 431 |
+
|
| 432 |
+
## See also
|
| 433 |
+
|
| 434 |
+
- The full [German Media collection](https://huggingface.co/collections/SinclairSchneider/german-media)
|
| 435 |
+
- Mirror of this dataset: [`NLP-UniBW/compact_de`](https://huggingface.co/datasets/NLP-UniBW/compact_de)
|
| 436 |
+
- [medienkompass.org — Deutsche Medienlandschaft](https://medienkompass.org/deutsche-medienlandschaft/),
|
| 437 |
+
the source of the perceived-partisanship figures above
|
scraping/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# How this dataset was built
|
| 2 |
+
|
| 3 |
+
| File | Purpose |
|
| 4 |
+
|---|---|
|
| 5 |
+
| [`crawler.py`](./crawler.py) | Distributed whole-site crawler for `www.compact-online.de`. Writes one JSON file per article to `pages/`. |
|
| 6 |
+
| [`finalize.ipynb`](./finalize.ipynb) | Merges `pages/*.json` into a single table, deduplicates it and pushes it to the Hub. |
|
| 7 |
+
|
| 8 |
+
```bash
|
| 9 |
+
pip install mechanicalsoup beautifulsoup4 lxml python-dateutil fake-useragent \
|
| 10 |
+
pandas datasets huggingface_hub tqdm
|
| 11 |
+
|
| 12 |
+
python crawler.py # writes pages/*.json; `touch killall.txt` to stop
|
| 13 |
+
jupyter notebook finalize.ipynb
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
## Using your own proxies
|
| 17 |
+
|
| 18 |
+
The original crawl ran behind a pool of forward proxies on a private network.
|
| 19 |
+
Those addresses have been removed from this published copy. `crawler.py` reads
|
| 20 |
+
the `SCRAPER_PROXIES` environment variable instead — a comma-separated list of
|
| 21 |
+
proxies, with or without a scheme (`http://` is assumed when none is given).
|
| 22 |
+
One entry is picked per request, so a pool spreads the load over several exits.
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
# a single proxy
|
| 26 |
+
export SCRAPER_PROXIES="proxy-a.example.com:3128"
|
| 27 |
+
|
| 28 |
+
# a pool, rotated per request
|
| 29 |
+
export SCRAPER_PROXIES="proxy-a.example.com:3128,proxy-b.example.com:3128"
|
| 30 |
+
|
| 31 |
+
# with an explicit scheme and credentials
|
| 32 |
+
export SCRAPER_PROXIES="http://user:pass@proxy.example.com:3128"
|
| 33 |
+
|
| 34 |
+
# SOCKS, if PySocks is installed
|
| 35 |
+
export SCRAPER_PROXIES="socks5://localhost:9050"
|
| 36 |
+
|
| 37 |
+
# back to a direct connection (the default)
|
| 38 |
+
unset SCRAPER_PROXIES
|
| 39 |
+
|
| 40 |
+
python crawler.py
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
The scripts contain no credentials, cookies or personal data.
|
| 44 |
+
|
| 45 |
+
Please crawl responsibly: honour `robots.txt` and the site's terms of use, keep
|
| 46 |
+
concurrency well below the 32 workers used here unless you have the operator's
|
| 47 |
+
permission, and prefer the published dataset over re-crawling.
|
scraping/crawler.py
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Whole-site crawler for www.compact-online.de (COMPACT).
|
| 3 |
+
|
| 4 |
+
This is the exact script that produced the Hugging Face dataset
|
| 5 |
+
https://huggingface.co/datasets/SinclairSchneider/compact_de — see that dataset card for a
|
| 6 |
+
step-by-step description of the pipeline.
|
| 7 |
+
|
| 8 |
+
Overview
|
| 9 |
+
--------
|
| 10 |
+
* 32 worker processes share the URL frontier; a URL is routed to a worker by
|
| 11 |
+
``int(md5(url).hexdigest(), 16) % 32`` so that no locking is required.
|
| 12 |
+
* The crawl is seeded with one article URL and discovers everything else by
|
| 13 |
+
following links below ``https://www.compact-online.de/``.
|
| 14 |
+
* ``get_content()`` turns an article page into a record; pages with an empty
|
| 15 |
+
body are dropped. Each surviving article is written to
|
| 16 |
+
``pages/<flattened-url>.json``.
|
| 17 |
+
* Known and visited URLs are appended to ``data/thread_<id>_pages*.txt``, so an
|
| 18 |
+
interrupted crawl resumes where it left off. Create a file named
|
| 19 |
+
``killall.txt`` in the working directory to stop all workers cleanly.
|
| 20 |
+
|
| 21 |
+
Usage
|
| 22 |
+
-----
|
| 23 |
+
pip install mechanicalsoup beautifulsoup4 lxml python-dateutil fake-useragent
|
| 24 |
+
python crawler.py
|
| 25 |
+
|
| 26 |
+
Set ``SCRAPER_PROXIES`` (comma separated ``host:port`` list) to route requests
|
| 27 |
+
through your own forward proxies; see the note further down. The private proxy
|
| 28 |
+
addresses used in the original crawl have been removed from this published copy.
|
| 29 |
+
|
| 30 |
+
Please crawl responsibly: honour robots.txt and the site's terms of use, and
|
| 31 |
+
lower the worker count unless you have the operator's permission.
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
import hashlib
|
| 35 |
+
import multiprocessing
|
| 36 |
+
import mechanicalsoup
|
| 37 |
+
|
| 38 |
+
from bs4 import BeautifulSoup
|
| 39 |
+
import re
|
| 40 |
+
import json
|
| 41 |
+
import os
|
| 42 |
+
import io
|
| 43 |
+
import time
|
| 44 |
+
import random
|
| 45 |
+
from fake_useragent import UserAgent
|
| 46 |
+
|
| 47 |
+
from dateutil.parser import parse
|
| 48 |
+
|
| 49 |
+
base_url = "https://www.compact-online.de/"
|
| 50 |
+
|
| 51 |
+
# --- Proxy configuration ---------------------------------------------------
|
| 52 |
+
# The original crawl was executed behind a pool of forward proxies located on a
|
| 53 |
+
# private network. Those addresses are infrastructure specific and have been
|
| 54 |
+
# removed from this published copy of the script.
|
| 55 |
+
#
|
| 56 |
+
# Set the environment variable SCRAPER_PROXIES to a comma separated list of
|
| 57 |
+
# proxies to send the crawl through your own pool. Entries may be written with
|
| 58 |
+
# or without a scheme ("http://" is assumed when none is given). Each request
|
| 59 |
+
# picks one entry from the pool, so several entries spread the load over
|
| 60 |
+
# several exits. Leave the variable unset or empty to connect directly - that
|
| 61 |
+
# is the default and what most of the crawls in this collection used.
|
| 62 |
+
#
|
| 63 |
+
# Examples:
|
| 64 |
+
#
|
| 65 |
+
# # a single proxy
|
| 66 |
+
# export SCRAPER_PROXIES="proxy-a.example.com:3128"
|
| 67 |
+
#
|
| 68 |
+
# # a pool, rotated per request
|
| 69 |
+
# export SCRAPER_PROXIES="proxy-a.example.com:3128,proxy-b.example.com:3128"
|
| 70 |
+
#
|
| 71 |
+
# # with an explicit scheme and credentials
|
| 72 |
+
# export SCRAPER_PROXIES="http://user:pass@proxy.example.com:3128"
|
| 73 |
+
#
|
| 74 |
+
# # SOCKS also works if PySocks is installed
|
| 75 |
+
# export SCRAPER_PROXIES="socks5://localhost:9050"
|
| 76 |
+
#
|
| 77 |
+
# # back to a direct connection
|
| 78 |
+
# unset SCRAPER_PROXIES
|
| 79 |
+
#
|
| 80 |
+
# python crawler.py
|
| 81 |
+
def _load_proxy_pool():
|
| 82 |
+
"""Read the SCRAPER_PROXIES environment variable into a list of proxy URLs."""
|
| 83 |
+
pool = []
|
| 84 |
+
for entry in os.environ.get("SCRAPER_PROXIES", "").split(","):
|
| 85 |
+
entry = entry.strip()
|
| 86 |
+
if not entry:
|
| 87 |
+
continue
|
| 88 |
+
if "://" not in entry:
|
| 89 |
+
entry = "http://" + entry
|
| 90 |
+
pool.append(entry)
|
| 91 |
+
return pool
|
| 92 |
+
|
| 93 |
+
PROXY_POOL = _load_proxy_pool()
|
| 94 |
+
|
| 95 |
+
def log(number, url):
|
| 96 |
+
if not os.path.isdir("log"):
|
| 97 |
+
os.mkdir("log")
|
| 98 |
+
with open("log"+os.sep+"thread_"+str(number)+".txt", "w") as f:
|
| 99 |
+
f.write(url)
|
| 100 |
+
|
| 101 |
+
def error(number, url):
|
| 102 |
+
if not os.path.isdir("error"):
|
| 103 |
+
os.mkdir("error")
|
| 104 |
+
with open("error"+os.sep+"thread_"+str(number)+".txt", "w") as f:
|
| 105 |
+
f.write(url)
|
| 106 |
+
|
| 107 |
+
def raw(number, url, page_str):
|
| 108 |
+
if not os.path.isdir("raw"):
|
| 109 |
+
os.mkdir("raw")
|
| 110 |
+
with open("raw"+os.sep+"thread_"+str(number)+".txt", "w") as f:
|
| 111 |
+
f.write(url)
|
| 112 |
+
f.write(page_str)
|
| 113 |
+
|
| 114 |
+
def get_content(url, page_str):
|
| 115 |
+
additional_attributes = {
|
| 116 |
+
'author':'',
|
| 117 |
+
'description':'',
|
| 118 |
+
'datePublished':'',
|
| 119 |
+
'url':'',
|
| 120 |
+
}
|
| 121 |
+
dict_return = {'content':'', 'title':'', 'additional_attributes': additional_attributes}
|
| 122 |
+
if page_str == "":
|
| 123 |
+
return dict_return
|
| 124 |
+
|
| 125 |
+
page_bs = BeautifulSoup(page_str, "lxml")
|
| 126 |
+
|
| 127 |
+
paidMarker = True if page_bs.find("div", {'id':'wpmem_restricted_msg'}) != None else False
|
| 128 |
+
if paidMarker == True:
|
| 129 |
+
return dict_return
|
| 130 |
+
|
| 131 |
+
try:
|
| 132 |
+
if page_bs.find("script", {'type':'application/ld+json'}) != None:
|
| 133 |
+
_ = json.loads(page_bs.find("script", {'type':'application/ld+json'}).text)
|
| 134 |
+
except:
|
| 135 |
+
print("Error in JSON, skip page")
|
| 136 |
+
return dict_return
|
| 137 |
+
|
| 138 |
+
title = page_bs.find("meta", {'property':'og:title'}).get('content', '').replace(" - COMPACT", "") if page_bs.find("meta", {'property':'og:title'}) != None else ""
|
| 139 |
+
content = " ".join([x.text for x in page_bs.find("div", {'class':'post-content'}).find_all("p")]) if page_bs.find("div", {'class':'post-content'}) != None else ""
|
| 140 |
+
author = page_bs.find("meta", {'name':'author'}).get('content', '') if page_bs.find("meta", {'name':'author'}) != None else ""
|
| 141 |
+
description = page_bs.find("meta", {'property':'og:description'}).get('content', '') if page_bs.find("meta", {'property':'og:description'}) != None else ""
|
| 142 |
+
datePublished = page_bs.find("time", {'class':'post-date'}).get('datetime', '') if page_bs.find("time", {'class':'post-date'}) != None else ""
|
| 143 |
+
|
| 144 |
+
additional_attributes = {
|
| 145 |
+
'author':author,
|
| 146 |
+
'description':description,
|
| 147 |
+
'datePublished':datePublished,
|
| 148 |
+
'url':url,
|
| 149 |
+
}
|
| 150 |
+
dict_return = {'content':content, 'title':title, 'additional_attributes': additional_attributes}
|
| 151 |
+
return dict_return
|
| 152 |
+
|
| 153 |
+
def get_urls(page_str):
|
| 154 |
+
return_urls = set()
|
| 155 |
+
page_bs = BeautifulSoup(page_str, "lxml")
|
| 156 |
+
for tag in page_bs.findAll("a", href=True):
|
| 157 |
+
url = tag.get("href", '')
|
| 158 |
+
if "#" in url:
|
| 159 |
+
continue
|
| 160 |
+
if url.startswith(base_url):
|
| 161 |
+
return_urls.add(url)
|
| 162 |
+
if url.startswith("/"):
|
| 163 |
+
url = base_url + url
|
| 164 |
+
return_urls.add(url)
|
| 165 |
+
return return_urls
|
| 166 |
+
|
| 167 |
+
def readSavedData(iId, sPageset, sPagesetVisited):
|
| 168 |
+
if not os.path.isdir("data"):
|
| 169 |
+
os.mkdir("data")
|
| 170 |
+
if os.path.isfile("data/thread_"+str(iId)+"_pages.txt"):
|
| 171 |
+
with io.open("data/thread_"+str(iId)+"_pages.txt", "r", encoding="utf-8") as f:
|
| 172 |
+
for line in f:
|
| 173 |
+
if "#" in line:
|
| 174 |
+
continue
|
| 175 |
+
line = line.replace("\n", "")
|
| 176 |
+
if line != "":
|
| 177 |
+
sPageset.add(line)
|
| 178 |
+
|
| 179 |
+
if os.path.isfile("data/thread_"+str(iId)+"_pages_visited.txt"):
|
| 180 |
+
with io.open("data/thread_"+str(iId)+"_pages_visited.txt", "r", encoding="utf-8") as f:
|
| 181 |
+
for line in f:
|
| 182 |
+
if "#" in line:
|
| 183 |
+
continue
|
| 184 |
+
line = line.replace("\n", "")
|
| 185 |
+
if line != "":
|
| 186 |
+
sPagesetVisited.add(line)
|
| 187 |
+
|
| 188 |
+
def addStartChannel(sPage, iNumberOfThreads, lQueues):
|
| 189 |
+
iIndex = int(hashlib.md5(sPage.encode("utf")).hexdigest(),16)%iNumberOfThreads
|
| 190 |
+
lQueues[iIndex].put(sPage)
|
| 191 |
+
|
| 192 |
+
def getNextPage(lQueues, iId, sPageset, sPagesetVisited):
|
| 193 |
+
while True:
|
| 194 |
+
if os.path.isfile("killall.txt"):
|
| 195 |
+
return None
|
| 196 |
+
|
| 197 |
+
while not lQueues[iId].empty():
|
| 198 |
+
sPage = lQueues[iId].get()
|
| 199 |
+
iLenBefore = len(sPageset)
|
| 200 |
+
sPageset.add(sPage)
|
| 201 |
+
iLenAfter = len(sPageset)
|
| 202 |
+
if iLenBefore != iLenAfter:
|
| 203 |
+
with io.open("data/thread_"+str(iId)+"_pages.txt", "a", encoding="utf-8") as f:
|
| 204 |
+
if sPage != "" and sPage != "\t":
|
| 205 |
+
f.write(sPage + "\n")
|
| 206 |
+
sPagesetToVisit = sPageset - sPagesetVisited
|
| 207 |
+
|
| 208 |
+
if len(sPagesetToVisit) != 0:
|
| 209 |
+
sPage = list(sPagesetToVisit)[0]
|
| 210 |
+
return sPage
|
| 211 |
+
else:
|
| 212 |
+
print("Thread " + str(iId) + " is waiting")
|
| 213 |
+
time.sleep(3)
|
| 214 |
+
|
| 215 |
+
def addPagesToVisit(sPages, iNumberOfThreads, lQueues):
|
| 216 |
+
for sPage in sPages:
|
| 217 |
+
if sPage != "":
|
| 218 |
+
iIndex = int(hashlib.md5(sPage.encode("utf")).hexdigest(), 16) % iNumberOfThreads
|
| 219 |
+
lQueues[iIndex].put(sPage)
|
| 220 |
+
|
| 221 |
+
def addVisitedPages(sPage, sPagesetsetVisited, iId):
|
| 222 |
+
iLenBefore = len(sPagesetsetVisited)
|
| 223 |
+
sPagesetsetVisited.add(sPage)
|
| 224 |
+
iLenAfter = len(sPagesetsetVisited)
|
| 225 |
+
if iLenBefore != iLenAfter:
|
| 226 |
+
with io.open("data/thread_"+str(iId)+"_pages_visited.txt", "a", encoding="utf-8") as f:
|
| 227 |
+
if sPage != "":
|
| 228 |
+
f.write(sPage+"\n")
|
| 229 |
+
|
| 230 |
+
def crawler(iId, iNumberOfThreads, lQueues):
|
| 231 |
+
sPageset = set()
|
| 232 |
+
sPagesetVisited = set()
|
| 233 |
+
readSavedData(iId, sPageset, sPagesetVisited)
|
| 234 |
+
|
| 235 |
+
while True:
|
| 236 |
+
sPage = getNextPage(lQueues, iId, sPageset, sPagesetVisited)
|
| 237 |
+
if sPage is None:
|
| 238 |
+
break
|
| 239 |
+
if "#" in sPage:
|
| 240 |
+
continue
|
| 241 |
+
|
| 242 |
+
if (not "/files/" in sPage) and \
|
| 243 |
+
(not "/video/" in sPage) and \
|
| 244 |
+
(not ".jpg" in sPage) and \
|
| 245 |
+
(not ".pdf" in sPage) and \
|
| 246 |
+
(not ".xml" in sPage) and \
|
| 247 |
+
(not ".pptx" in sPage) and \
|
| 248 |
+
(not ".shtml" in sPage) and \
|
| 249 |
+
len(sPage.split('/')) > 4 and \
|
| 250 |
+
(not ".epub" in sPage):
|
| 251 |
+
|
| 252 |
+
log(iId, sPage)
|
| 253 |
+
for i in range(10):
|
| 254 |
+
try:
|
| 255 |
+
lproxies = PROXY_POOL
|
| 256 |
+
proxy = lproxies[int((int(time.time())/1)+3)%len(lproxies)] if lproxies else None
|
| 257 |
+
proxies = {'https': proxy, 'http': proxy} if proxy else {}
|
| 258 |
+
browser = mechanicalsoup.StatefulBrowser()
|
| 259 |
+
ua = UserAgent()
|
| 260 |
+
browser.set_user_agent(ua.random)
|
| 261 |
+
browser.session.proxies = proxies
|
| 262 |
+
|
| 263 |
+
time.sleep(random.uniform(1.0, 3.5))
|
| 264 |
+
|
| 265 |
+
browser.open(sPage, timeout=10.0)
|
| 266 |
+
page = browser.get_current_page()
|
| 267 |
+
page_str = str(page)
|
| 268 |
+
if "#challenge-error-text" in page_str:
|
| 269 |
+
print("error, we will wait a moment and continue")
|
| 270 |
+
time.sleep(1)
|
| 271 |
+
continue
|
| 272 |
+
if "You don't have permission to access" in page_str:
|
| 273 |
+
print("error, we will wait a moment and continue")
|
| 274 |
+
time.sleep(1)
|
| 275 |
+
continue
|
| 276 |
+
raw(iId, sPage, page_str)
|
| 277 |
+
break
|
| 278 |
+
except:
|
| 279 |
+
print(sPage)
|
| 280 |
+
print("retry")
|
| 281 |
+
browser.close()
|
| 282 |
+
continue
|
| 283 |
+
|
| 284 |
+
browser.close()
|
| 285 |
+
else:
|
| 286 |
+
page_str = ""
|
| 287 |
+
|
| 288 |
+
try:
|
| 289 |
+
content = get_content(sPage, page_str)
|
| 290 |
+
except:
|
| 291 |
+
error(iId, sPage)
|
| 292 |
+
|
| 293 |
+
if content['content'] != '':
|
| 294 |
+
file_path = sPage.replace(base_url+"/", "").replace("/", "_")[-200:]
|
| 295 |
+
file_path = "pages/"+file_path
|
| 296 |
+
file_path = file_path[:-1] if file_path.endswith("_") else file_path
|
| 297 |
+
file_path = file_path+".json"
|
| 298 |
+
content_json = json.dumps(content)
|
| 299 |
+
with open(file_path, "w", encoding = "utf-8") as f:
|
| 300 |
+
f.write(content_json)
|
| 301 |
+
else:
|
| 302 |
+
pass
|
| 303 |
+
|
| 304 |
+
sPages = get_urls(page_str)
|
| 305 |
+
addPagesToVisit(sPages, iNumberOfThreads, lQueues)
|
| 306 |
+
addVisitedPages(sPage, sPagesetVisited, iId)
|
| 307 |
+
|
| 308 |
+
print("Thread: " + str(iId) + " chanels visited: " + str(len(sPagesetVisited)) + " channels to visit: " + str(len(sPageset - sPagesetVisited)))
|
| 309 |
+
|
| 310 |
+
def main():
|
| 311 |
+
if not os.path.isdir("pages"):
|
| 312 |
+
os.mkdir("pages")
|
| 313 |
+
|
| 314 |
+
iNumberOfThreads = 32
|
| 315 |
+
lQueues = []
|
| 316 |
+
mgr = multiprocessing.Manager()
|
| 317 |
+
for i in range(iNumberOfThreads):
|
| 318 |
+
qQueue = mgr.Queue()
|
| 319 |
+
lQueues.append(qQueue)
|
| 320 |
+
|
| 321 |
+
lIds = range(0, iNumberOfThreads)
|
| 322 |
+
lNumberOfThreads = [iNumberOfThreads] * iNumberOfThreads
|
| 323 |
+
llQueues = [lQueues] * iNumberOfThreads
|
| 324 |
+
addStartChannel("https://www.compact-online.de/usa-kennedy-raeumt-auf/", iNumberOfThreads, lQueues)
|
| 325 |
+
lArguments = list(zip(lIds, lNumberOfThreads, llQueues))
|
| 326 |
+
with multiprocessing.Pool(processes=iNumberOfThreads) as pool:
|
| 327 |
+
pool.starmap(crawler, lArguments)
|
| 328 |
+
|
| 329 |
+
if __name__ == "__main__":
|
| 330 |
+
main()
|
scraping/finalize.ipynb
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# `COMPACT-Magazin (compact-online.de)` — consolidation notebook\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"This notebook is the second half of the pipeline behind\n",
|
| 10 |
+
"[`SinclairSchneider/compact_de`](https://huggingface.co/datasets/SinclairSchneider/compact_de).\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"`crawler.py` writes one JSON file per article into `pages/`. This notebook\n",
|
| 13 |
+
"\n",
|
| 14 |
+
"1. reads every `pages/*.json`,\n",
|
| 15 |
+
"2. flattens the nested records into one `pandas` column per field,\n",
|
| 16 |
+
"3. drops duplicate articles by headline (`drop_duplicates(subset=['title'])`),\n",
|
| 17 |
+
"4. writes `compact_de.json` and pushes the result to the Hugging Face Hub.\n",
|
| 18 |
+
"\n",
|
| 19 |
+
"Outputs have been cleared before publication.\n",
|
| 20 |
+
""
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"cell_type": "code",
|
| 25 |
+
"execution_count": null,
|
| 26 |
+
"metadata": {},
|
| 27 |
+
"outputs": [],
|
| 28 |
+
"source": [
|
| 29 |
+
"import glob\n",
|
| 30 |
+
"import json\n",
|
| 31 |
+
"import pandas as pd\n",
|
| 32 |
+
"from datasets import Dataset\n",
|
| 33 |
+
"import huggingface_hub\n",
|
| 34 |
+
"from dateutil.parser import parse\n",
|
| 35 |
+
"from tqdm import tqdm"
|
| 36 |
+
]
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"cell_type": "code",
|
| 40 |
+
"execution_count": null,
|
| 41 |
+
"metadata": {},
|
| 42 |
+
"outputs": [],
|
| 43 |
+
"source": [
|
| 44 |
+
"with open(\"pages/https:__www.compact-online.de_zynische-innenministerin-pflicht-zum-impf-abo-ist-kein-zwang.json\", \"r\", encoding=\"utf-8\") as f:\n",
|
| 45 |
+
" json_input = f.read()\n",
|
| 46 |
+
" dict_input_example = json.loads(json_input)"
|
| 47 |
+
]
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"cell_type": "code",
|
| 51 |
+
"execution_count": null,
|
| 52 |
+
"metadata": {},
|
| 53 |
+
"outputs": [],
|
| 54 |
+
"source": [
|
| 55 |
+
"dict_input_example"
|
| 56 |
+
]
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"cell_type": "code",
|
| 60 |
+
"execution_count": null,
|
| 61 |
+
"metadata": {},
|
| 62 |
+
"outputs": [],
|
| 63 |
+
"source": [
|
| 64 |
+
"json_files = glob.glob(\"pages/*.json\")\n",
|
| 65 |
+
"len(json_files)"
|
| 66 |
+
]
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"cell_type": "code",
|
| 70 |
+
"execution_count": null,
|
| 71 |
+
"metadata": {},
|
| 72 |
+
"outputs": [],
|
| 73 |
+
"source": [
|
| 74 |
+
"title = []\n",
|
| 75 |
+
"content = []\n",
|
| 76 |
+
"author = []\n",
|
| 77 |
+
"description = []\n",
|
| 78 |
+
"datePublished = []\n",
|
| 79 |
+
"url = []\n",
|
| 80 |
+
"for file in tqdm(json_files):\n",
|
| 81 |
+
" with open(file, \"r\") as f:\n",
|
| 82 |
+
" d = json.loads(f.read())\n",
|
| 83 |
+
" title.append(d['title'])\n",
|
| 84 |
+
" content.append(d['content'])\n",
|
| 85 |
+
" author.append(d['additional_attributes']['author'])\n",
|
| 86 |
+
" description.append(d['additional_attributes']['description'])\n",
|
| 87 |
+
" datePublished.append(d['additional_attributes']['datePublished'])\n",
|
| 88 |
+
" url.append(d['additional_attributes']['url'])"
|
| 89 |
+
]
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"cell_type": "code",
|
| 93 |
+
"execution_count": null,
|
| 94 |
+
"metadata": {},
|
| 95 |
+
"outputs": [],
|
| 96 |
+
"source": [
|
| 97 |
+
"df = pd.DataFrame(\n",
|
| 98 |
+
" {\n",
|
| 99 |
+
" 'title': title,\n",
|
| 100 |
+
" 'content': content,\n",
|
| 101 |
+
" 'author': author,\n",
|
| 102 |
+
" 'description': description,\n",
|
| 103 |
+
" 'datePublished': datePublished,\n",
|
| 104 |
+
" 'url': url,\n",
|
| 105 |
+
" }\n",
|
| 106 |
+
")"
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"cell_type": "code",
|
| 111 |
+
"execution_count": null,
|
| 112 |
+
"metadata": {},
|
| 113 |
+
"outputs": [],
|
| 114 |
+
"source": [
|
| 115 |
+
"df"
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"cell_type": "code",
|
| 120 |
+
"execution_count": null,
|
| 121 |
+
"metadata": {},
|
| 122 |
+
"outputs": [],
|
| 123 |
+
"source": [
|
| 124 |
+
"df = df.drop_duplicates(subset=['title'])"
|
| 125 |
+
]
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"cell_type": "code",
|
| 129 |
+
"execution_count": null,
|
| 130 |
+
"metadata": {},
|
| 131 |
+
"outputs": [],
|
| 132 |
+
"source": [
|
| 133 |
+
"df = df.reset_index(drop=True)"
|
| 134 |
+
]
|
| 135 |
+
},
|
| 136 |
+
{
|
| 137 |
+
"cell_type": "code",
|
| 138 |
+
"execution_count": null,
|
| 139 |
+
"metadata": {},
|
| 140 |
+
"outputs": [],
|
| 141 |
+
"source": [
|
| 142 |
+
"df"
|
| 143 |
+
]
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"cell_type": "code",
|
| 147 |
+
"execution_count": null,
|
| 148 |
+
"metadata": {},
|
| 149 |
+
"outputs": [],
|
| 150 |
+
"source": [
|
| 151 |
+
"df.to_json(\"compact_de.json\")"
|
| 152 |
+
]
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"cell_type": "code",
|
| 156 |
+
"execution_count": null,
|
| 157 |
+
"metadata": {},
|
| 158 |
+
"outputs": [],
|
| 159 |
+
"source": [
|
| 160 |
+
"ds = Dataset.from_pandas(df)"
|
| 161 |
+
]
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"cell_type": "code",
|
| 165 |
+
"execution_count": null,
|
| 166 |
+
"metadata": {},
|
| 167 |
+
"outputs": [],
|
| 168 |
+
"source": [
|
| 169 |
+
"ds.push_to_hub(\"SinclairSchneider/compact_de\")"
|
| 170 |
+
]
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"cell_type": "code",
|
| 174 |
+
"execution_count": null,
|
| 175 |
+
"metadata": {},
|
| 176 |
+
"outputs": [],
|
| 177 |
+
"source": [
|
| 178 |
+
"ds.push_to_hub(\"NLP-UniBW/compact_de\")"
|
| 179 |
+
]
|
| 180 |
+
}
|
| 181 |
+
],
|
| 182 |
+
"metadata": {
|
| 183 |
+
"kernelspec": {
|
| 184 |
+
"display_name": "Python 3",
|
| 185 |
+
"language": "python",
|
| 186 |
+
"name": "python3"
|
| 187 |
+
},
|
| 188 |
+
"language_info": {
|
| 189 |
+
"name": "python"
|
| 190 |
+
}
|
| 191 |
+
},
|
| 192 |
+
"nbformat": 4,
|
| 193 |
+
"nbformat_minor": 5
|
| 194 |
+
}
|