summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.md102
-rw-r--r--data_lib.py202
-rwxr-xr-xgen_md.py86
-rw-r--r--img_previews/14807698519800.jpgbin0 -> 10970 bytes
-rw-r--r--img_previews/14808504339810.jpgbin0 -> 10424 bytes
-rw-r--r--img_previews/15380705_108329376329986_9056356163929568277_n.jpgbin0 -> 5509 bytes
-rw-r--r--img_previews/15392945_108095943019996_4704987487568206392_o.jpgbin0 -> 6181 bytes
-rw-r--r--img_previews/15419693_101260723703518_2805966063874562530_o.jpgbin0 -> 6181 bytes
-rw-r--r--img_previews/15420776_102463640249893_8121435407232672204_n.jpgbin0 -> 6510 bytes
-rw-r--r--img_previews/15439808_102464160249841_2565608228603917605_n.jpgbin0 -> 9728 bytes
-rw-r--r--img_previews/15440412_101456170350640_7176058481132692338_o.jpgbin0 -> 13293 bytes
-rw-r--r--img_previews/15493318_108096099686647_299132289441582339_o.jpgbin0 -> 13918 bytes
-rw-r--r--img_previews/15493591_108095769686680_2393430334213414852_o.jpgbin0 -> 5737 bytes
-rw-r--r--img_previews/15625738_121299665032957_8992237041959485820_o.jpgbin0 -> 6181 bytes
-rw-r--r--img_previews/15675726_121270778369179_7150724639818426602_o.jpgbin0 -> 12772 bytes
-rw-r--r--img_previews/15698340_121264898369767_2550520338482278561_n.jpgbin0 -> 5887 bytes
-rw-r--r--img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpgbin0 -> 5219 bytes
-rw-r--r--img_previews/2.jpgbin0 -> 22318 bytes
-rw-r--r--img_previews/300000.jpgbin0 -> 5688 bytes
-rw-r--r--img_previews/IMG20161201125541.jpgbin0 -> 55084 bytes
-rw-r--r--img_previews/S6304049с.jpgbin0 -> 75675 bytes
-rw-r--r--img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpgbin0 -> 4415 bytes
-rw-r--r--img_previews/oekaki.pngbin0 -> 5102 bytes
-rw-r--r--img_previews/oekaki1.pngbin0 -> 3706 bytes
-rw-r--r--img_previews/oekaki2.pngbin0 -> 4035 bytes
-rw-r--r--img_previews/oekaki3.pngbin0 -> 5491 bytes
-rw-r--r--img_previews/oekaki4.pngbin0 -> 3820 bytes
-rw-r--r--img_previews/oekaki5.pngbin0 -> 4603 bytes
-rw-r--r--img_previews/screen_a2ch.pngbin0 -> 58843 bytes
-rw-r--r--img_previews/акс.jpgbin0 -> 13318 bytes
-rw-r--r--img_previews/акс2.jpgbin0 -> 14726 bytes
-rw-r--r--img_previews/банк.jpgbin0 -> 18836 bytes
-rw-r--r--img_previews/бел.jpgbin0 -> 15877 bytes
-rw-r--r--img_previews/гра.jpgbin0 -> 14726 bytes
-rw-r--r--img_previews/дьявол.jpgbin0 -> 3703 bytes
-rw-r--r--img_previews/зах.jpgbin0 -> 14929 bytes
-rw-r--r--img_previews/зах2.jpgbin0 -> 12249 bytes
-rw-r--r--img_previews/зах3.jpgbin0 -> 19375 bytes
-rw-r--r--img_previews/карта8.jpgbin0 -> 30195 bytes
-rw-r--r--img_previews/косм.jpgbin0 -> 14198 bytes
-rw-r--r--img_previews/косм2.jpgbin0 -> 17096 bytes
-rw-r--r--img_previews/косм3.jpgbin0 -> 14043 bytes
-rw-r--r--img_previews/лел.jpgbin0 -> 17029 bytes
-rw-r--r--img_previews/марш.jpgbin0 -> 6920 bytes
-rw-r--r--img_previews/мовсаев.jpgbin0 -> 6930 bytes
-rw-r--r--img_previews/нав.jpgbin0 -> 7930 bytes
-rw-r--r--img_previews/орб2.jpgbin0 -> 19487 bytes
-rw-r--r--img_previews/орбитальная.jpgbin0 -> 17808 bytes
-rw-r--r--img_previews/панф.jpgbin0 -> 16424 bytes
-rw-r--r--img_previews/парк.jpgbin0 -> 14802 bytes
-rw-r--r--img_previews/уничтожение.jpgbin0 -> 18959 bytes
-rw-r--r--img_previews/шол.jpgbin0 -> 17097 bytes
-rw-r--r--img_previews/штах.jpgbin0 -> 16971 bytes
-rw-r--r--img_previews/щиг.jpgbin0 -> 5286 bytes
-rwxr-xr-xmain.py257
55 files changed, 341 insertions, 306 deletions
diff --git a/data.md b/data.md
index f04d12c..890ee95 100644
--- a/data.md
+++ b/data.md
@@ -1,6 +1,6 @@
**Дата**: 16/11/16
-**Пикрилейтед:** ![](./img/карта8.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/карта8.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-16/res/140183243.html](https://2ch.hk/b/arch/2016-11-16/res/140183243.html)
@@ -24,7 +24,7 @@
---
**Дата**: 18/11/16
-**Пикрилейтед:** ![](./img/орбитальная.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/орбитальная.jpg =300x)
**Источник:** 2ch
@@ -59,7 +59,7 @@
---
**Дата**: 18/11/16
-**Пикрилейтед:** ![](./img/марш.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/марш.jpg =300x)
**Источник:** 2ch
@@ -116,7 +116,7 @@
---
**Дата**: 23/11/16
-**Пикрилейтед:** ![](./img/шол.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/шол.jpg =300x)
**Источник:** 2ch
@@ -162,7 +162,7 @@
---
**Дата**: 24/11/16
-**Пикрилейтед:** ![](./img/oekaki4.png =300x)
+**Пикрилейтед:** ![](./img_previews/oekaki4.png =300x)
**Источник:** 2ch
@@ -175,7 +175,7 @@
---
**Дата**: 25/11/16
-**Пикрилейтед:** ![](./img/oekaki2.png =300x)
+**Пикрилейтед:** ![](./img_previews/oekaki2.png =300x)
**Источник:** 2ch
@@ -188,7 +188,7 @@
---
**Дата**: 25/11/16
-**Пикрилейтед:** ![](./img/oekaki3.png =300x)
+**Пикрилейтед:** ![](./img_previews/oekaki3.png =300x)
**Источник:** 2ch
@@ -201,7 +201,7 @@
---
**Дата**: 25/11/16
-**Пикрилейтед:** ![](./img/зах.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/зах.jpg =300x)
**Источник:** 2ch
@@ -214,7 +214,7 @@
---
**Дата**: 25/11/16
-**Пикрилейтед:** ![](./img/зах2.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/зах2.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-25/res/140833914.html](https://2ch.hk/b/arch/2016-11-25/res/140833914.html)
@@ -227,7 +227,7 @@
---
**Дата**: 25/11/16
-**Пикрилейтед:** ![](./img/зах3.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/зах3.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-25/res/140833914.html](https://2ch.hk/b/arch/2016-11-25/res/140833914.html)
@@ -240,7 +240,7 @@
---
**Дата**: 26/11/16
-**Пикрилейтед:** ![](./img/e9f87d8f6d847fb4b645f1c147fbd743.jpg =300x)![](./img/screen_a2ch.png =300x)![](./img/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg =300x)![](./img_previews/screen_a2ch.png =300x)![](./img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg =300x)
**Источник:** 2ch
@@ -253,7 +253,7 @@
---
**Дата**: 26/11/16
-**Пикрилейтед:** ![](./img/дьявол.jpg =300x)![](./img/марш.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/дьявол.jpg =300x)![](./img_previews/марш.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-26/res/140895323.html](https://2ch.hk/b/arch/2016-11-26/res/140895323.html)
@@ -266,7 +266,7 @@
---
**Дата**: 26/11/16
-**Пикрилейтед:** ![](./img/зах.jpg =300x)![](./img/зах2.jpg =300x)![](./img/зах3.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/зах.jpg =300x)![](./img_previews/зах2.jpg =300x)![](./img_previews/зах3.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-26/res/140907494.html](https://2ch.hk/b/arch/2016-11-26/res/140907494.html)
@@ -279,7 +279,7 @@
---
**Дата**: 27/11/16
-**Пикрилейтед:** ![](./img/бел.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/бел.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-27/res/140962390.html](https://2ch.hk/b/arch/2016-11-27/res/140962390.html)
@@ -292,7 +292,7 @@
---
**Дата**: 27/11/16
-**Пикрилейтед:** ![](./img/банк.jpg =300x)![](./img/марш.jpg =300x)![](./img/щиг.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/банк.jpg =300x)![](./img_previews/марш.jpg =300x)![](./img_previews/щиг.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-27/res/140962390.html](https://2ch.hk/b/arch/2016-11-27/res/140962390.html)
@@ -305,7 +305,7 @@
---
**Дата**: 27/11/16
-**Пикрилейтед:** ![](./img/банк.jpg =300x)![](./img/марш.jpg =300x)![](./img/щиг.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/банк.jpg =300x)![](./img_previews/марш.jpg =300x)![](./img_previews/щиг.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-27/res/140998985.html](https://2ch.hk/b/arch/2016-11-27/res/140998985.html)
@@ -318,7 +318,7 @@
---
**Дата**: 28/11/16
-**Пикрилейтед:** ![](./img/банк.jpg =300x)![](./img/марш.jpg =300x)![](./img/300000.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/банк.jpg =300x)![](./img_previews/марш.jpg =300x)![](./img_previews/300000.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-11-28/res/141041088.html](https://2ch.hk/b/arch/2016-11-28/res/141041088.html)
@@ -342,7 +342,7 @@
---
**Дата**: 29/11/16
-**Пикрилейтед:** ![](./img/нав.jpg =300x)![](./img/косм2.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/нав.jpg =300x)![](./img_previews/косм2.jpg =300x)
**Источник:** 2ch
@@ -355,7 +355,7 @@
---
**Дата**: 29/11/16
-**Пикрилейтед:** ![](./img/марш.jpg =300x)![](./img/шиг.jpg =300x)![](./img/банк.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/марш.jpg =300x)![](./img_previews/шиг.jpg =300x)![](./img_previews/банк.jpg =300x)
**Источник:** 2ch
@@ -368,7 +368,7 @@
---
**Дата**: 30/11/16
-**Пикрилейтед:** ![](./img/oekaki1.png =300x)
+**Пикрилейтед:** ![](./img_previews/oekaki1.png =300x)
**Источник:** 2ch
@@ -381,7 +381,7 @@
---
**Дата**: 1/12/16
-**Пикрилейтед:** ![](./img/косм3.jpg =300x)![](./img/мовсаев.jpg =300x)![](./img/гра.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/косм3.jpg =300x)![](./img_previews/мовсаев.jpg =300x)![](./img_previews/гра.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-12-01/res/141250810.html](https://2ch.hk/b/arch/2016-12-01/res/141250810.html)
@@ -394,7 +394,7 @@
---
**Дата**: 1/12/16
-**Пикрилейтед:** ![](./img/IMG20161201125541.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/IMG20161201125541.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-12-01/res/141265607.html](https://2ch.hk/b/arch/2016-12-01/res/141265607.html)
@@ -407,7 +407,7 @@
---
**Дата**: 2/12/16
-**Пикрилейтед:** ![](./img/марш.jpg =300x)![](./img/орбитальная.jpg =300x)![](./img/S6304049с.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/марш.jpg =300x)![](./img_previews/орбитальная.jpg =300x)![](./img_previews/S6304049с.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-12-02/res/141333665.html](https://2ch.hk/b/arch/2016-12-02/res/141333665.html)
@@ -420,7 +420,7 @@
---
**Дата**: 3/12/16
-**Пикрилейтед:** ![](./img/2.jpg =300x)![](./img/14807698519800.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/2.jpg =300x)![](./img_previews/14807698519800.jpg =300x)
**Источник:** 2ch
@@ -433,7 +433,7 @@
---
**Дата**: 3/12/16
-**Пикрилейтед:** ![](./img/панф.jpg =300x)![](./img/мовсаев.jpg =300x)![](./img/гра.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/панф.jpg =300x)![](./img_previews/мовсаев.jpg =300x)![](./img_previews/гра.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-12-03/res/141389822.html](https://2ch.hk/b/arch/2016-12-03/res/141389822.html)
@@ -459,7 +459,7 @@
---
**Дата**: 4/12/16
-**Пикрилейтед:** ![](./img/oekaki5.png =300x)
+**Пикрилейтед:** ![](./img_previews/oekaki5.png =300x)
**Источник:** 2ch
@@ -494,7 +494,7 @@
---
**Дата**: 4/12/16
-**Пикрилейтед:** ![](./img/14808504339810.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/14808504339810.jpg =300x)
**Ссылки:** [https://life.ru/t/новости/920144/v_mosulie_likvidirovan_dzhikhadi-tolik_kaznivshii_rossiianina_v_ighil](https://life.ru/t/новости/920144/v_mosulie_likvidirovan_dzhikhadi-tolik_kaznivshii_rossiianina_v_ighil)
@@ -509,7 +509,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/косм.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/косм.jpg =300x)
**Источник:** 2ch
@@ -522,7 +522,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/oekaki.png =300x)
+**Пикрилейтед:** ![](./img_previews/oekaki.png =300x)
**Источник:** 2ch
@@ -535,7 +535,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/щиг.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/щиг.jpg =300x)
**Источник:** 2ch
@@ -548,7 +548,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/шол.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/шол.jpg =300x)
**Источник:** 2ch
@@ -561,7 +561,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/орб2.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/орб2.jpg =300x)
**Источник:** 2ch
@@ -574,7 +574,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/мовсаев.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/мовсаев.jpg =300x)
**Источник:** 2ch
@@ -587,7 +587,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/уничтожение.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/уничтожение.jpg =300x)
**Источник:** 2ch
@@ -600,7 +600,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/нав.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/нав.jpg =300x)
**Источник:** 2ch
@@ -624,7 +624,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/лел.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/лел.jpg =300x)
**Источник:** 2ch
@@ -637,7 +637,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/штах.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/штах.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-12-05/res/141550628.html](https://2ch.hk/b/arch/2016-12-05/res/141550628.html)
@@ -650,7 +650,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/марш.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/марш.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-12-05/res/141573309.html](https://2ch.hk/b/arch/2016-12-05/res/141573309.html)
@@ -676,7 +676,7 @@
---
**Дата**: 5/12/16
-**Пикрилейтед:** ![](./img/мовсаев.jpg =300x)![](./img/нав.jpg =300x)![](./img/акс.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/мовсаев.jpg =300x)![](./img_previews/нав.jpg =300x)![](./img_previews/акс.jpg =300x)
**Источник:** 2ch, [https://2ch.hk/b/arch/2016-12-05/res/141552146.html](https://2ch.hk/b/arch/2016-12-05/res/141552146.html)
@@ -689,7 +689,7 @@
---
**Дата**: 6/12/16
-**Пикрилейтед:** ![](./img/мовсаев.jpg =300x)![](./img/гра.jpg =300x)![](./img/акс2.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/мовсаев.jpg =300x)![](./img_previews/гра.jpg =300x)![](./img_previews/акс2.jpg =300x)
**Источник:** 2ch
@@ -724,7 +724,7 @@
---
**Дата**: 8/12/16
-**Пикрилейтед:** ![](./img/15419693_101260723703518_2805966063874562530_o.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/15419693_101260723703518_2805966063874562530_o.jpg =300x)
**Источник:** fb
@@ -737,7 +737,7 @@
---
**Дата**: 8/12/16
-**Пикрилейтед:** ![](./img/15440412_101456170350640_7176058481132692338_o.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/15440412_101456170350640_7176058481132692338_o.jpg =300x)
**Источник:** fb
@@ -750,7 +750,7 @@
---
**Дата**: 8/12/16
-**Пикрилейтед:** ![](./img/парк.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/парк.jpg =300x)
**Источник:** mailru
@@ -776,7 +776,7 @@
---
**Дата**: 9/12/16
-**Пикрилейтед:** ![](./img/15420776_102463640249893_8121435407232672204_n.jpg =300x)![](./img/15439808_102464160249841_2565608228603917605_n.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/15420776_102463640249893_8121435407232672204_n.jpg =300x)![](./img_previews/15439808_102464160249841_2565608228603917605_n.jpg =300x)
**Источник:** fb
@@ -789,7 +789,7 @@
---
**Дата**: 14/12/16
-**Пикрилейтед:** ![](./img/15493591_108095769686680_2393430334213414852_o.jpg =300x)![](./img/15392945_108095943019996_4704987487568206392_o.jpg =300x)![](./img/15493318_108096099686647_299132289441582339_o.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/15493591_108095769686680_2393430334213414852_o.jpg =300x)![](./img_previews/15392945_108095943019996_4704987487568206392_o.jpg =300x)![](./img_previews/15493318_108096099686647_299132289441582339_o.jpg =300x)
**Источник:** fb
@@ -802,7 +802,7 @@
---
**Дата**: 14/12/16
-**Пикрилейтед:** ![](./img/15380705_108329376329986_9056356163929568277_n.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/15380705_108329376329986_9056356163929568277_n.jpg =300x)
**Источник:** fb
@@ -837,7 +837,7 @@ High School on the Right The Flywheel Will Not Allow The Flywheel Will Not Allow
---
**Дата**: 22/12/16
-**Пикрилейтед:** ![](./img/15625738_121299665032957_8992237041959485820_o.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/15625738_121299665032957_8992237041959485820_o.jpg =300x)
**Источник:** fb
@@ -850,7 +850,7 @@ High School on the Right The Flywheel Will Not Allow The Flywheel Will Not Allow
---
**Дата**: 22/12/16
-**Пикрилейтед:** ![](./img/15698340_121264898369767_2550520338482278561_n.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/15698340_121264898369767_2550520338482278561_n.jpg =300x)
**Источник:** fb
@@ -863,7 +863,7 @@ High School on the Right The Flywheel Will Not Allow The Flywheel Will Not Allow
---
**Дата**: 22/12/16
-**Пикрилейтед:** ![](./img/15675726_121270778369179_7150724639818426602_o.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/15675726_121270778369179_7150724639818426602_o.jpg =300x)
**Источник:** fb
@@ -876,7 +876,7 @@ High School on the Right The Flywheel Will Not Allow The Flywheel Will Not Allow
---
**Дата**: 23/12/16
-**Пикрилейтед:** ![](./img/марш.jpg =300x)![](./img/мовсаев.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/марш.jpg =300x)![](./img_previews/мовсаев.jpg =300x)
**Источник:** fb
@@ -889,7 +889,7 @@ High School on the Right The Flywheel Will Not Allow The Flywheel Will Not Allow
---
**Дата**: 23/12/16
-**Пикрилейтед:** ![](./img/марш.jpg =300x)
+**Пикрилейтед:** ![](./img_previews/марш.jpg =300x)
**Источник:** fb
diff --git a/data_lib.py b/data_lib.py
new file mode 100644
index 0000000..7c7859a
--- /dev/null
+++ b/data_lib.py
@@ -0,0 +1,202 @@
+import os
+import json
+import re
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+
+def load_data():
+ with open(os.path.join(CWD, "data.json")) as f:
+ data = json.loads(f.read())
+
+ # ignore placeholders
+ data = list(filter(lambda i: i['text'] != '', data))
+
+ return data
+
+def clean_string(s, remove_junk=False):
+ s = s.replace(')', ') ')
+ s = re.sub(r'(\!|\.)([^\)])', r'\1 \2', s)
+ #s = s.replace('/', ' ')
+ s = s.upper()
+
+ s = re.sub(r'\s+', ' ', s).strip()
+
+ junks = [
+ 'ВОЕННОЕ',
+ 'ВЫШЕСТОЯЩИХ',
+ 'ПРАВО',
+ 'ПРАВИЛАМ ВОЙНЫ',
+ 'ВЫПИСКА',
+ 'КОНТРОЛЬ',
+ 'ИХ',
+ 'ПО',
+ 'НАВЫКИ',
+ 'С ВЫШЕСТОЯЩИМИ',
+ #'ПРИСУТСТВИЕ',
+ #'ЛИНЕЙНО',
+ 'ЗАКОННО!',
+ 'ПОХЛЕБКА',
+ 'СВЯЗЕЙ',
+ 'ЖУЮЩЕГО ХРЯЩИ',
+ 'ИНДЕКСИРОВАН БЕЗУКОРИЗНЕННО',
+ 'ОТКЛАДЫВАЕТСЯ ЛИНЕЙНО',
+ '- ЕГО ВЕЛИЧЕСТВО',
+ 'ГУБЕРНИЯ',
+ 'С ВЫШЕСТОЯЩИМИ КОНТРОЛЬ',
+ 'С ЛОКАЦИИ',
+ #'КАЗНЬ',
+ 'ГУБЕРНИЯ',
+ 'ПРОВЕРКИ',
+ 'УСТАНОВЛЕНО',
+ 'ПОБЕДИТЕЛЕМ',
+ #'СТАЛЬНЫЕ',
+ 'НЕРВЫ',
+ 'ДАРОВАНО',
+ #'ТРАНСПОРТИРОВКА',
+ 'ОДОБРЕНО',
+ 'ПРОЯВЛЕНИЯ',
+ 'УЗАКОНЕНО',
+ 'ИМЕЕТСЯ',
+ 'ЗНАЛ',
+ 'НЕ ПРИМЕЧЕНО',
+ 'НА СЕВЕР',
+ 'ПРИГОВОРИТЬ',
+ 'ШЕСТВУЕМ',
+ 'ДАГОН',
+ 'ДА МЕРЗНУЩИЙ',
+ 'КОФЕ',
+ #'РЕАГИРОВАНИЕ',
+ 'УКАЗАНО',
+ '- ВЫСОКИЙ ТИТУЛ',
+ 'ЗАКАЗ',
+ 'ЧЕРТЫ ЛИЦА',
+
+ # english
+ 'SCHOOL ON THE RIGHT',
+ 'WILL NOT ALLOW',
+ 'FLYWHEEL',
+ 'TRIUMPHANTLY',
+ 'BEING USED',
+ 'NICE',
+ 'UMBRELLA',
+ #'BIOROBOT',
+ 'CONSERVATISM',
+ 'WAS ESTABLISHED',
+ 'WITH A PASSWORD',
+ 'ANT',
+ 'YEAR',
+ 'RECOGNIZED',
+ 'SEARCHED'
+ #'LEGAL',
+ #'FIGHTING'
+ ]
+
+ # только без пробелов
+ junks_words = list(filter(lambda w: ' ' not in w, junks))
+
+ # только с пробелами
+ junks_nwords = list(filter(lambda w: w not in junks_words, junks))
+
+ if remove_junk:
+ s = s.split(' ')
+ s = list(filter(lambda l: re.sub(r'\.|\!$', '', l) not in junks_words, s))
+ s = ' '.join(s)
+
+ for j in junks_nwords:
+ s = s.replace(j, '')
+
+ # хортица - это буква Х
+ s = s.replace('Х О Р Т И Ц А', 'Х_О_Р_Т_И_Ц_А')
+
+ s = re.sub(r'\s+', ' ', s).strip()
+ return s
+
+def decode(s, is_url=False):
+ buf = ''
+ for word in s.split(' '):
+ word = word.strip()
+ if word == '':
+ continue
+
+ if re.match(r'^\d+', word):
+ buf += word
+ elif is_url and word.endswith('://'):
+ buf += word[0]
+ buf += '://'
+ else:
+ letter = word[0]
+ buf += letter
+
+ return buf
+
+def decode2(s):
+ buf = ''
+ for s in re.split(r'[\?\.\!]+', s):
+ s = s.strip()
+ if s == '':
+ continue
+
+ words = s.split(' ')
+
+ letter = words[1][0]
+ buf += letter
+
+ return buf
+
+def decode3(s):
+ buf = ''
+ for s in re.split(r'[\?\.\!]+', s):
+ s = s.strip()
+ s = s.replace(' ', '')
+ s = s.replace('-', '')
+ if not s:
+ continue
+
+ print(s)
+ continue
+
+ s = s.upper()
+
+ if s[0] in ('Ш', 'Щ', 'И'):
+ buf += s[0]
+ elif s[4] == 'Й':
+ buf += s[4]
+ elif s[0] == 'И':
+ buf += 'И'
+ elif s[7] == 'М':
+ buf += 'М'
+ elif s[4] == 'А':
+ buf += 'А'
+ elif s[2] == 'Р':
+ buf += 'Р'
+ elif s[1] == 'У':
+ buf += 'У'
+ elif s[9] == 'Ю':
+ buf += 'Ю'
+ else:
+ buf += '?'
+
+ return buf
+
+
+
+
+
+# s: source
+# t: type
+def decode_auto(s, t, reverse_decoded=False, remove_junk=True):
+ if t == 1:
+ s = clean_string(s, remove_junk=remove_junk)
+ result = decode(s)
+
+ elif t == 2:
+ result = decode2(s)
+
+ elif t == 3:
+ result = decode3(s)
+
+ if reverse_decoded:
+ # reverse string
+ result = result[::-1]
+
+ return result
diff --git a/gen_md.py b/gen_md.py
new file mode 100755
index 0000000..dbf44a2
--- /dev/null
+++ b/gen_md.py
@@ -0,0 +1,86 @@
+#!/usr/bin/python3.4
+import datetime
+import time
+import sys
+import os
+import shutil
+import subprocess
+from pprint import pprint
+from data_lib import load_data, decode_auto
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+
+def sort_data_by_date(item):
+ return int(time.mktime(datetime.datetime.strptime(item['date'], '%d/%m/%y').timetuple()))
+
+def resize(in_path, out_path):
+ subprocess.call(['convert', in_path, '-resize', '250', out_path])
+
+def gen_previews():
+ img_dir = os.path.join(CWD, 'img')
+ img_previews_dir = os.path.join(CWD, 'img_previews')
+ if os.path.exists(img_previews_dir):
+ shutil.rmtree(img_previews_dir)
+
+ os.makedirs(img_previews_dir)
+ for img in os.listdir(img_dir):
+ img_path = os.path.join(img_dir, img)
+ img_preview_path = os.path.join(img_previews_dir, img)
+
+ resize(img_path, img_preview_path)
+
+def main():
+ data = load_data()
+ data = sorted(data, key=sort_data_by_date)
+
+ print("Generating previews (don't forget to git add them)...")
+ gen_previews()
+
+ print("Generating page...")
+
+ buf = []
+ for post in data:
+ cipher_type = post['type'] if 'type' in post else 1
+ decoded_text = decode_auto(post['text'], cipher_type)
+
+ post_buf = ''
+ post_buf += '**Дата**: %s\n\n' % post['date']
+
+ if 'pic' in post and post['pic']:
+ # make sure it is a list
+ pic = post['pic'] if isinstance(post['pic'], list) else [post['pic']]
+
+ pic_buf = []
+ for p in pic:
+ pic_buf.append('![](./img_previews/%s =300x)' % p)
+ post_buf += '**Пикрилейтед:** %s\n\n' % ''.join(pic_buf)
+
+ if 'link' in post:
+ # make sure it is a list
+ link = post['link'] if isinstance(post['link'], list) else [post['link']]
+
+ link_buf = []
+ for l in link:
+ link_buf.append('[%s](%s)' % (l, l))
+ post_buf += '**Ссылки:** %s\n\n' % ', '.join(link_buf)
+
+ if 'source' in post:
+ post_buf += '**Источник:** %s' % post['source']
+ if 'source_link' in post:
+ post_buf += ', [%s](%s)\n\n' % (post['source_link'], post['source_link'])
+ else:
+ post_buf += '\n\n'
+
+ post_buf += '**Шифровка (тип %d)**: \n```\n%s\n```\n\n' % (cipher_type, post['text'])
+ post_buf += '**Расшифровка:** `%s`' % decoded_text
+
+ buf.append(post_buf)
+
+ md = "\n---\n".join(buf)
+ with open(os.path.join(CWD, 'data.md'), 'w') as f:
+ f.write(md)
+
+ print("Done.")
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/img_previews/14807698519800.jpg b/img_previews/14807698519800.jpg
new file mode 100644
index 0000000..a5d890a
--- /dev/null
+++ b/img_previews/14807698519800.jpg
Binary files differ
diff --git a/img_previews/14808504339810.jpg b/img_previews/14808504339810.jpg
new file mode 100644
index 0000000..b6f84b9
--- /dev/null
+++ b/img_previews/14808504339810.jpg
Binary files differ
diff --git a/img_previews/15380705_108329376329986_9056356163929568277_n.jpg b/img_previews/15380705_108329376329986_9056356163929568277_n.jpg
new file mode 100644
index 0000000..24a35f6
--- /dev/null
+++ b/img_previews/15380705_108329376329986_9056356163929568277_n.jpg
Binary files differ
diff --git a/img_previews/15392945_108095943019996_4704987487568206392_o.jpg b/img_previews/15392945_108095943019996_4704987487568206392_o.jpg
new file mode 100644
index 0000000..5660584
--- /dev/null
+++ b/img_previews/15392945_108095943019996_4704987487568206392_o.jpg
Binary files differ
diff --git a/img_previews/15419693_101260723703518_2805966063874562530_o.jpg b/img_previews/15419693_101260723703518_2805966063874562530_o.jpg
new file mode 100644
index 0000000..dea8e8b
--- /dev/null
+++ b/img_previews/15419693_101260723703518_2805966063874562530_o.jpg
Binary files differ
diff --git a/img_previews/15420776_102463640249893_8121435407232672204_n.jpg b/img_previews/15420776_102463640249893_8121435407232672204_n.jpg
new file mode 100644
index 0000000..24e80e3
--- /dev/null
+++ b/img_previews/15420776_102463640249893_8121435407232672204_n.jpg
Binary files differ
diff --git a/img_previews/15439808_102464160249841_2565608228603917605_n.jpg b/img_previews/15439808_102464160249841_2565608228603917605_n.jpg
new file mode 100644
index 0000000..2647d67
--- /dev/null
+++ b/img_previews/15439808_102464160249841_2565608228603917605_n.jpg
Binary files differ
diff --git a/img_previews/15440412_101456170350640_7176058481132692338_o.jpg b/img_previews/15440412_101456170350640_7176058481132692338_o.jpg
new file mode 100644
index 0000000..edb7284
--- /dev/null
+++ b/img_previews/15440412_101456170350640_7176058481132692338_o.jpg
Binary files differ
diff --git a/img_previews/15493318_108096099686647_299132289441582339_o.jpg b/img_previews/15493318_108096099686647_299132289441582339_o.jpg
new file mode 100644
index 0000000..dd38799
--- /dev/null
+++ b/img_previews/15493318_108096099686647_299132289441582339_o.jpg
Binary files differ
diff --git a/img_previews/15493591_108095769686680_2393430334213414852_o.jpg b/img_previews/15493591_108095769686680_2393430334213414852_o.jpg
new file mode 100644
index 0000000..968cd73
--- /dev/null
+++ b/img_previews/15493591_108095769686680_2393430334213414852_o.jpg
Binary files differ
diff --git a/img_previews/15625738_121299665032957_8992237041959485820_o.jpg b/img_previews/15625738_121299665032957_8992237041959485820_o.jpg
new file mode 100644
index 0000000..86ad9af
--- /dev/null
+++ b/img_previews/15625738_121299665032957_8992237041959485820_o.jpg
Binary files differ
diff --git a/img_previews/15675726_121270778369179_7150724639818426602_o.jpg b/img_previews/15675726_121270778369179_7150724639818426602_o.jpg
new file mode 100644
index 0000000..cdc6ea6
--- /dev/null
+++ b/img_previews/15675726_121270778369179_7150724639818426602_o.jpg
Binary files differ
diff --git a/img_previews/15698340_121264898369767_2550520338482278561_n.jpg b/img_previews/15698340_121264898369767_2550520338482278561_n.jpg
new file mode 100644
index 0000000..3264737
--- /dev/null
+++ b/img_previews/15698340_121264898369767_2550520338482278561_n.jpg
Binary files differ
diff --git a/img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg b/img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg
new file mode 100644
index 0000000..5f9bb30
--- /dev/null
+++ b/img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg
Binary files differ
diff --git a/img_previews/2.jpg b/img_previews/2.jpg
new file mode 100644
index 0000000..1b9ba92
--- /dev/null
+++ b/img_previews/2.jpg
Binary files differ
diff --git a/img_previews/300000.jpg b/img_previews/300000.jpg
new file mode 100644
index 0000000..9bdf360
--- /dev/null
+++ b/img_previews/300000.jpg
Binary files differ
diff --git a/img_previews/IMG20161201125541.jpg b/img_previews/IMG20161201125541.jpg
new file mode 100644
index 0000000..8c98f11
--- /dev/null
+++ b/img_previews/IMG20161201125541.jpg
Binary files differ
diff --git a/img_previews/S6304049с.jpg b/img_previews/S6304049с.jpg
new file mode 100644
index 0000000..d4ef9fd
--- /dev/null
+++ b/img_previews/S6304049с.jpg
Binary files differ
diff --git a/img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg b/img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg
new file mode 100644
index 0000000..0dfd957
--- /dev/null
+++ b/img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg
Binary files differ
diff --git a/img_previews/oekaki.png b/img_previews/oekaki.png
new file mode 100644
index 0000000..570e172
--- /dev/null
+++ b/img_previews/oekaki.png
Binary files differ
diff --git a/img_previews/oekaki1.png b/img_previews/oekaki1.png
new file mode 100644
index 0000000..f4846bc
--- /dev/null
+++ b/img_previews/oekaki1.png
Binary files differ
diff --git a/img_previews/oekaki2.png b/img_previews/oekaki2.png
new file mode 100644
index 0000000..d1b2b6c
--- /dev/null
+++ b/img_previews/oekaki2.png
Binary files differ
diff --git a/img_previews/oekaki3.png b/img_previews/oekaki3.png
new file mode 100644
index 0000000..590791d
--- /dev/null
+++ b/img_previews/oekaki3.png
Binary files differ
diff --git a/img_previews/oekaki4.png b/img_previews/oekaki4.png
new file mode 100644
index 0000000..faccd92
--- /dev/null
+++ b/img_previews/oekaki4.png
Binary files differ
diff --git a/img_previews/oekaki5.png b/img_previews/oekaki5.png
new file mode 100644
index 0000000..c699f0d
--- /dev/null
+++ b/img_previews/oekaki5.png
Binary files differ
diff --git a/img_previews/screen_a2ch.png b/img_previews/screen_a2ch.png
new file mode 100644
index 0000000..34f212e
--- /dev/null
+++ b/img_previews/screen_a2ch.png
Binary files differ
diff --git a/img_previews/акс.jpg b/img_previews/акс.jpg
new file mode 100644
index 0000000..6a7e0c2
--- /dev/null
+++ b/img_previews/акс.jpg
Binary files differ
diff --git a/img_previews/акс2.jpg b/img_previews/акс2.jpg
new file mode 100644
index 0000000..1ea3159
--- /dev/null
+++ b/img_previews/акс2.jpg
Binary files differ
diff --git a/img_previews/банк.jpg b/img_previews/банк.jpg
new file mode 100644
index 0000000..d2fb194
--- /dev/null
+++ b/img_previews/банк.jpg
Binary files differ
diff --git a/img_previews/бел.jpg b/img_previews/бел.jpg
new file mode 100644
index 0000000..176bbf3
--- /dev/null
+++ b/img_previews/бел.jpg
Binary files differ
diff --git a/img_previews/гра.jpg b/img_previews/гра.jpg
new file mode 100644
index 0000000..1ea3159
--- /dev/null
+++ b/img_previews/гра.jpg
Binary files differ
diff --git a/img_previews/дьявол.jpg b/img_previews/дьявол.jpg
new file mode 100644
index 0000000..f2a3b4b
--- /dev/null
+++ b/img_previews/дьявол.jpg
Binary files differ
diff --git a/img_previews/зах.jpg b/img_previews/зах.jpg
new file mode 100644
index 0000000..674a313
--- /dev/null
+++ b/img_previews/зах.jpg
Binary files differ
diff --git a/img_previews/зах2.jpg b/img_previews/зах2.jpg
new file mode 100644
index 0000000..8964a27
--- /dev/null
+++ b/img_previews/зах2.jpg
Binary files differ
diff --git a/img_previews/зах3.jpg b/img_previews/зах3.jpg
new file mode 100644
index 0000000..f3a6e86
--- /dev/null
+++ b/img_previews/зах3.jpg
Binary files differ
diff --git a/img_previews/карта8.jpg b/img_previews/карта8.jpg
new file mode 100644
index 0000000..8444753
--- /dev/null
+++ b/img_previews/карта8.jpg
Binary files differ
diff --git a/img_previews/косм.jpg b/img_previews/косм.jpg
new file mode 100644
index 0000000..6d16946
--- /dev/null
+++ b/img_previews/косм.jpg
Binary files differ
diff --git a/img_previews/косм2.jpg b/img_previews/косм2.jpg
new file mode 100644
index 0000000..98027eb
--- /dev/null
+++ b/img_previews/косм2.jpg
Binary files differ
diff --git a/img_previews/косм3.jpg b/img_previews/косм3.jpg
new file mode 100644
index 0000000..c66325a
--- /dev/null
+++ b/img_previews/косм3.jpg
Binary files differ
diff --git a/img_previews/лел.jpg b/img_previews/лел.jpg
new file mode 100644
index 0000000..1f2a3cc
--- /dev/null
+++ b/img_previews/лел.jpg
Binary files differ
diff --git a/img_previews/марш.jpg b/img_previews/марш.jpg
new file mode 100644
index 0000000..a5f5ea9
--- /dev/null
+++ b/img_previews/марш.jpg
Binary files differ
diff --git a/img_previews/мовсаев.jpg b/img_previews/мовсаев.jpg
new file mode 100644
index 0000000..f4bb8d7
--- /dev/null
+++ b/img_previews/мовсаев.jpg
Binary files differ
diff --git a/img_previews/нав.jpg b/img_previews/нав.jpg
new file mode 100644
index 0000000..a00729a
--- /dev/null
+++ b/img_previews/нав.jpg
Binary files differ
diff --git a/img_previews/орб2.jpg b/img_previews/орб2.jpg
new file mode 100644
index 0000000..b53581a
--- /dev/null
+++ b/img_previews/орб2.jpg
Binary files differ
diff --git a/img_previews/орбитальная.jpg b/img_previews/орбитальная.jpg
new file mode 100644
index 0000000..1588cf6
--- /dev/null
+++ b/img_previews/орбитальная.jpg
Binary files differ
diff --git a/img_previews/панф.jpg b/img_previews/панф.jpg
new file mode 100644
index 0000000..71df6e4
--- /dev/null
+++ b/img_previews/панф.jpg
Binary files differ
diff --git a/img_previews/парк.jpg b/img_previews/парк.jpg
new file mode 100644
index 0000000..cce0dff
--- /dev/null
+++ b/img_previews/парк.jpg
Binary files differ
diff --git a/img_previews/уничтожение.jpg b/img_previews/уничтожение.jpg
new file mode 100644
index 0000000..f82228a
--- /dev/null
+++ b/img_previews/уничтожение.jpg
Binary files differ
diff --git a/img_previews/шол.jpg b/img_previews/шол.jpg
new file mode 100644
index 0000000..9b5bee4
--- /dev/null
+++ b/img_previews/шол.jpg
Binary files differ
diff --git a/img_previews/штах.jpg b/img_previews/штах.jpg
new file mode 100644
index 0000000..69eb200
--- /dev/null
+++ b/img_previews/штах.jpg
Binary files differ
diff --git a/img_previews/щиг.jpg b/img_previews/щиг.jpg
new file mode 100644
index 0000000..29bc740
--- /dev/null
+++ b/img_previews/щиг.jpg
Binary files differ
diff --git a/main.py b/main.py
index 14151ed..34c0b33 100755
--- a/main.py
+++ b/main.py
@@ -2,12 +2,7 @@
import argparse
import sys
-import json
import os
-import re
-import time
-import datetime
-from pprint import pprint
try:
from termcolor import cprint
@@ -15,7 +10,8 @@ try:
except ImportError:
colors_supported = False
-CWD = os.path.dirname(os.path.realpath(__file__))
+from data_lib import load_data, decode_auto
+
def print_colored(s, color, fallback_prefix=''):
if colors_supported:
@@ -23,208 +19,7 @@ def print_colored(s, color, fallback_prefix=''):
else:
print(fallback_prefix + s)
-def load_data():
- with open(os.path.join(CWD, "data.json")) as f:
- data = json.loads(f.read())
-
- # ignore placeholders
- data = list(filter(lambda i: i['text'] != '', data))
-
- return data
-
-def clean_string(s, remove_junk=False):
- s = s.replace(')', ') ')
- s = re.sub(r'(\!|\.)([^\)])', r'\1 \2', s)
- #s = s.replace('/', ' ')
- s = s.upper()
-
- s = re.sub(r'\s+', ' ', s).strip()
-
- junks = [
- 'ВОЕННОЕ',
- 'ВЫШЕСТОЯЩИХ',
- 'ПРАВО',
- 'ПРАВИЛАМ ВОЙНЫ',
- 'ВЫПИСКА',
- 'КОНТРОЛЬ',
- 'ИХ',
- 'ПО',
- 'НАВЫКИ',
- 'С ВЫШЕСТОЯЩИМИ',
- #'ПРИСУТСТВИЕ',
- #'ЛИНЕЙНО',
- 'ЗАКОННО!',
- 'ПОХЛЕБКА',
- 'СВЯЗЕЙ',
- 'ЖУЮЩЕГО ХРЯЩИ',
- 'ИНДЕКСИРОВАН БЕЗУКОРИЗНЕННО',
- 'ОТКЛАДЫВАЕТСЯ ЛИНЕЙНО',
- '- ЕГО ВЕЛИЧЕСТВО',
- 'ГУБЕРНИЯ',
- 'С ВЫШЕСТОЯЩИМИ КОНТРОЛЬ',
- 'С ЛОКАЦИИ',
- #'КАЗНЬ',
- 'ГУБЕРНИЯ',
- 'ПРОВЕРКИ',
- 'УСТАНОВЛЕНО',
- 'ПОБЕДИТЕЛЕМ',
- #'СТАЛЬНЫЕ',
- 'НЕРВЫ',
- 'ДАРОВАНО',
- #'ТРАНСПОРТИРОВКА',
- 'ОДОБРЕНО',
- 'ПРОЯВЛЕНИЯ',
- 'УЗАКОНЕНО',
- 'ИМЕЕТСЯ',
- 'ЗНАЛ',
- 'НЕ ПРИМЕЧЕНО',
- 'НА СЕВЕР',
- 'ПРИГОВОРИТЬ',
- 'ШЕСТВУЕМ',
- 'ДАГОН',
- 'ДА МЕРЗНУЩИЙ',
- 'КОФЕ',
- #'РЕАГИРОВАНИЕ',
- 'УКАЗАНО',
- '- ВЫСОКИЙ ТИТУЛ',
- 'ЗАКАЗ',
- 'ЧЕРТЫ ЛИЦА',
-
- # english
- 'SCHOOL ON THE RIGHT',
- 'WILL NOT ALLOW',
- 'FLYWHEEL',
- 'TRIUMPHANTLY',
- 'BEING USED',
- 'NICE',
- 'UMBRELLA',
- #'BIOROBOT',
- 'CONSERVATISM',
- 'WAS ESTABLISHED',
- 'WITH A PASSWORD',
- 'ANT',
- 'YEAR',
- 'RECOGNIZED',
- 'SEARCHED'
- #'LEGAL',
- #'FIGHTING'
- ]
-
- # только без пробелов
- junks_words = list(filter(lambda w: ' ' not in w, junks))
-
- # только с пробелами
- junks_nwords = list(filter(lambda w: w not in junks_words, junks))
-
- if remove_junk:
- s = s.split(' ')
- s = list(filter(lambda l: re.sub(r'\.|\!$', '', l) not in junks_words, s))
- s = ' '.join(s)
-
- for j in junks_nwords:
- s = s.replace(j, '')
-
- # хортица - это буква Х
- s = s.replace('Х О Р Т И Ц А', 'Х_О_Р_Т_И_Ц_А')
-
- s = re.sub(r'\s+', ' ', s).strip()
- return s
-
-def decode(s, is_url=False):
- buf = ''
- for word in s.split(' '):
- word = word.strip()
- if word == '':
- continue
-
- if re.match(r'^\d+', word):
- buf += word
- elif is_url and word.endswith('://'):
- buf += word[0]
- buf += '://'
- else:
- letter = word[0]
- buf += letter
-
- return buf
-
-def decode2(s):
- buf = ''
- for s in re.split(r'[\?\.\!]+', s):
- s = s.strip()
- if s == '':
- continue
-
- words = s.split(' ')
-
- letter = words[1][0]
- buf += letter
-
- return buf
-
-def decode3(s):
- buf = ''
- for s in re.split(r'[\?\.\!]+', s):
- s = s.strip()
- s = s.replace(' ', '')
- s = s.replace('-', '')
- if not s:
- continue
-
- print(s)
- continue
-
- s = s.upper()
-
- if s[0] in ('Ш', 'Щ', 'И'):
- buf += s[0]
- elif s[4] == 'Й':
- buf += s[4]
- elif s[0] == 'И':
- buf += 'И'
- elif s[7] == 'М':
- buf += 'М'
- elif s[4] == 'А':
- buf += 'А'
- elif s[2] == 'Р':
- buf += 'Р'
- elif s[1] == 'У':
- buf += 'У'
- elif s[9] == 'Ю':
- buf += 'Ю'
- else:
- buf += '?'
-
- return buf
-
-
-
-
-
-# s: source
-# t: type
-def decode_auto(s, t, reverse_decoded=False, remove_junk=True):
- if t == 1:
- s = clean_string(s, remove_junk=remove_junk)
- result = decode(s)
-
- elif t == 2:
- result = decode2(s)
-
- elif t == 3:
- result = decode3(s)
- if reverse_decoded:
- # reverse string
- result = result[::-1]
-
- return result
-
-
-def sort_data_by_date(item):
- return int(time.mktime(datetime.datetime.strptime(item['date'], '%d/%m/%y').timetuple()))
-
-
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--decode', action='store_true')
@@ -235,7 +30,6 @@ def main():
parser.add_argument('--is-url', action='store_true')
parser.add_argument('--type', type=int, choices=[1, 2, 3], default=1)
parser.add_argument('--reverse-decoded', action='store_true')
- parser.add_argument('--gen-page', action='store_true')
args = parser.parse_args()
data = load_data()
@@ -289,52 +83,5 @@ def main():
count = len(data)
print("Total texts: %s" % count)
- elif args.gen_page:
- # sort by date
- data = sorted(data, key=sort_data_by_date)
- #pprint(data)
-
- buf = []
- for post in data:
- cipher_type = post['type'] if 'type' in post else 1
- decoded_text = decode_auto(post['text'], cipher_type)
-
- post_buf = ''
- post_buf += '**Дата**: %s\n\n' % post['date']
-
- if 'pic' in post and post['pic']:
- # make sure it is a list
- pic = post['pic'] if isinstance(post['pic'], list) else [post['pic']]
-
- pic_buf = []
- for p in pic:
- pic_buf.append('![](./img/%s =300x)' % p)
- post_buf += '**Пикрилейтед:** %s\n\n' % ''.join(pic_buf)
-
- if 'link' in post:
- # make sure it is a list
- link = post['link'] if isinstance(post['link'], list) else [post['link']]
-
- link_buf = []
- for l in link:
- link_buf.append('[%s](%s)' % (l, l))
- post_buf += '**Ссылки:** %s\n\n' % ', '.join(link_buf)
-
- if 'source' in post:
- post_buf += '**Источник:** %s' % post['source']
- if 'source_link' in post:
- post_buf += ', [%s](%s)\n\n' % (post['source_link'], post['source_link'])
- else:
- post_buf += '\n\n'
-
- post_buf += '**Шифровка (тип %d)**: \n```\n%s\n```\n\n' % (cipher_type, post['text'])
- post_buf += '**Расшифровка:** `%s`' % decoded_text
-
- buf.append(post_buf)
-
- md = "\n---\n".join(buf)
- with open(os.path.join(CWD, 'data.md'), 'w') as f:
- f.write(md)
-
if __name__ == '__main__':
sys.exit(main())