From 86af59be43f19cc612de9a13d1de6a0c03d7102f Mon Sep 17 00:00:00 2001 From: rusinthread Date: Fri, 6 Jan 2017 20:19:52 +0300 Subject: use image previews on data.md page --- data.md | 102 ++++---- data_lib.py | 202 ++++++++++++++++ gen_md.py | 86 +++++++ img_previews/14807698519800.jpg | Bin 0 -> 10970 bytes img_previews/14808504339810.jpg | Bin 0 -> 10424 bytes ...80705_108329376329986_9056356163929568277_n.jpg | Bin 0 -> 5509 bytes ...92945_108095943019996_4704987487568206392_o.jpg | Bin 0 -> 6181 bytes ...19693_101260723703518_2805966063874562530_o.jpg | Bin 0 -> 6181 bytes ...20776_102463640249893_8121435407232672204_n.jpg | Bin 0 -> 6510 bytes ...39808_102464160249841_2565608228603917605_n.jpg | Bin 0 -> 9728 bytes ...40412_101456170350640_7176058481132692338_o.jpg | Bin 0 -> 13293 bytes ...493318_108096099686647_299132289441582339_o.jpg | Bin 0 -> 13918 bytes ...93591_108095769686680_2393430334213414852_o.jpg | Bin 0 -> 5737 bytes ...25738_121299665032957_8992237041959485820_o.jpg | Bin 0 -> 6181 bytes ...75726_121270778369179_7150724639818426602_o.jpg | Bin 0 -> 12772 bytes ...98340_121264898369767_2550520338482278561_n.jpg | Bin 0 -> 5887 bytes img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg | Bin 0 -> 5219 bytes img_previews/2.jpg | Bin 0 -> 22318 bytes img_previews/300000.jpg | Bin 0 -> 5688 bytes img_previews/IMG20161201125541.jpg | Bin 0 -> 55084 bytes "img_previews/S6304049\321\201.jpg" | Bin 0 -> 75675 bytes img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg | Bin 0 -> 4415 bytes img_previews/oekaki.png | Bin 0 -> 5102 bytes img_previews/oekaki1.png | Bin 0 -> 3706 bytes img_previews/oekaki2.png | Bin 0 -> 4035 bytes img_previews/oekaki3.png | Bin 0 -> 5491 bytes img_previews/oekaki4.png | Bin 0 -> 3820 bytes img_previews/oekaki5.png | Bin 0 -> 4603 bytes img_previews/screen_a2ch.png | Bin 0 -> 58843 bytes "img_previews/\320\260\320\272\321\201.jpg" | Bin 0 -> 13318 bytes "img_previews/\320\260\320\272\321\2012.jpg" | Bin 0 -> 14726 bytes .../\320\261\320\260\320\275\320\272.jpg" | Bin 0 -> 18836 bytes "img_previews/\320\261\320\265\320\273.jpg" | Bin 0 -> 15877 bytes "img_previews/\320\263\321\200\320\260.jpg" | Bin 0 -> 14726 bytes ...64\321\214\321\217\320\262\320\276\320\273.jpg" | Bin 0 -> 3703 bytes "img_previews/\320\267\320\260\321\205.jpg" | Bin 0 -> 14929 bytes "img_previews/\320\267\320\260\321\2052.jpg" | Bin 0 -> 12249 bytes "img_previews/\320\267\320\260\321\2053.jpg" | Bin 0 -> 19375 bytes .../\320\272\320\260\321\200\321\202\320\2608.jpg" | Bin 0 -> 30195 bytes .../\320\272\320\276\321\201\320\274.jpg" | Bin 0 -> 14198 bytes .../\320\272\320\276\321\201\320\2742.jpg" | Bin 0 -> 17096 bytes .../\320\272\320\276\321\201\320\2743.jpg" | Bin 0 -> 14043 bytes "img_previews/\320\273\320\265\320\273.jpg" | Bin 0 -> 17029 bytes .../\320\274\320\260\321\200\321\210.jpg" | Bin 0 -> 6920 bytes ...76\320\262\321\201\320\260\320\265\320\262.jpg" | Bin 0 -> 6930 bytes "img_previews/\320\275\320\260\320\262.jpg" | Bin 0 -> 7930 bytes "img_previews/\320\276\321\200\320\2612.jpg" | Bin 0 -> 19487 bytes ...60\320\273\321\214\320\275\320\260\321\217.jpg" | Bin 0 -> 17808 bytes .../\320\277\320\260\320\275\321\204.jpg" | Bin 0 -> 16424 bytes .../\320\277\320\260\321\200\320\272.jpg" | Bin 0 -> 14802 bytes ...76\320\266\320\265\320\275\320\270\320\265.jpg" | Bin 0 -> 18959 bytes "img_previews/\321\210\320\276\320\273.jpg" | Bin 0 -> 17097 bytes .../\321\210\321\202\320\260\321\205.jpg" | Bin 0 -> 16971 bytes "img_previews/\321\211\320\270\320\263.jpg" | Bin 0 -> 5286 bytes main.py | 257 +-------------------- 55 files changed, 341 insertions(+), 306 deletions(-) create mode 100644 data_lib.py create mode 100755 gen_md.py create mode 100644 img_previews/14807698519800.jpg create mode 100644 img_previews/14808504339810.jpg create mode 100644 img_previews/15380705_108329376329986_9056356163929568277_n.jpg create mode 100644 img_previews/15392945_108095943019996_4704987487568206392_o.jpg create mode 100644 img_previews/15419693_101260723703518_2805966063874562530_o.jpg create mode 100644 img_previews/15420776_102463640249893_8121435407232672204_n.jpg create mode 100644 img_previews/15439808_102464160249841_2565608228603917605_n.jpg create mode 100644 img_previews/15440412_101456170350640_7176058481132692338_o.jpg create mode 100644 img_previews/15493318_108096099686647_299132289441582339_o.jpg create mode 100644 img_previews/15493591_108095769686680_2393430334213414852_o.jpg create mode 100644 img_previews/15625738_121299665032957_8992237041959485820_o.jpg create mode 100644 img_previews/15675726_121270778369179_7150724639818426602_o.jpg create mode 100644 img_previews/15698340_121264898369767_2550520338482278561_n.jpg create mode 100644 img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg create mode 100644 img_previews/2.jpg create mode 100644 img_previews/300000.jpg create mode 100644 img_previews/IMG20161201125541.jpg create mode 100644 "img_previews/S6304049\321\201.jpg" create mode 100644 img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg create mode 100644 img_previews/oekaki.png create mode 100644 img_previews/oekaki1.png create mode 100644 img_previews/oekaki2.png create mode 100644 img_previews/oekaki3.png create mode 100644 img_previews/oekaki4.png create mode 100644 img_previews/oekaki5.png create mode 100644 img_previews/screen_a2ch.png create mode 100644 "img_previews/\320\260\320\272\321\201.jpg" create mode 100644 "img_previews/\320\260\320\272\321\2012.jpg" create mode 100644 "img_previews/\320\261\320\260\320\275\320\272.jpg" create mode 100644 "img_previews/\320\261\320\265\320\273.jpg" create mode 100644 "img_previews/\320\263\321\200\320\260.jpg" create mode 100644 "img_previews/\320\264\321\214\321\217\320\262\320\276\320\273.jpg" create mode 100644 "img_previews/\320\267\320\260\321\205.jpg" create mode 100644 "img_previews/\320\267\320\260\321\2052.jpg" create mode 100644 "img_previews/\320\267\320\260\321\2053.jpg" create mode 100644 "img_previews/\320\272\320\260\321\200\321\202\320\2608.jpg" create mode 100644 "img_previews/\320\272\320\276\321\201\320\274.jpg" create mode 100644 "img_previews/\320\272\320\276\321\201\320\2742.jpg" create mode 100644 "img_previews/\320\272\320\276\321\201\320\2743.jpg" create mode 100644 "img_previews/\320\273\320\265\320\273.jpg" create mode 100644 "img_previews/\320\274\320\260\321\200\321\210.jpg" create mode 100644 "img_previews/\320\274\320\276\320\262\321\201\320\260\320\265\320\262.jpg" create mode 100644 "img_previews/\320\275\320\260\320\262.jpg" create mode 100644 "img_previews/\320\276\321\200\320\2612.jpg" create mode 100644 "img_previews/\320\276\321\200\320\261\320\270\321\202\320\260\320\273\321\214\320\275\320\260\321\217.jpg" create mode 100644 "img_previews/\320\277\320\260\320\275\321\204.jpg" create mode 100644 "img_previews/\320\277\320\260\321\200\320\272.jpg" create mode 100644 "img_previews/\321\203\320\275\320\270\321\207\321\202\320\276\320\266\320\265\320\275\320\270\320\265.jpg" create mode 100644 "img_previews/\321\210\320\276\320\273.jpg" create mode 100644 "img_previews/\321\210\321\202\320\260\321\205.jpg" create mode 100644 "img_previews/\321\211\320\270\320\263.jpg" 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 Binary files /dev/null and b/img_previews/14807698519800.jpg differ diff --git a/img_previews/14808504339810.jpg b/img_previews/14808504339810.jpg new file mode 100644 index 0000000..b6f84b9 Binary files /dev/null and b/img_previews/14808504339810.jpg 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 Binary files /dev/null and b/img_previews/15380705_108329376329986_9056356163929568277_n.jpg 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 Binary files /dev/null and b/img_previews/15392945_108095943019996_4704987487568206392_o.jpg 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 Binary files /dev/null and b/img_previews/15419693_101260723703518_2805966063874562530_o.jpg 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 Binary files /dev/null and b/img_previews/15420776_102463640249893_8121435407232672204_n.jpg 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 Binary files /dev/null and b/img_previews/15439808_102464160249841_2565608228603917605_n.jpg 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 Binary files /dev/null and b/img_previews/15440412_101456170350640_7176058481132692338_o.jpg 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 Binary files /dev/null and b/img_previews/15493318_108096099686647_299132289441582339_o.jpg 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 Binary files /dev/null and b/img_previews/15493591_108095769686680_2393430334213414852_o.jpg 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 Binary files /dev/null and b/img_previews/15625738_121299665032957_8992237041959485820_o.jpg 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 Binary files /dev/null and b/img_previews/15675726_121270778369179_7150724639818426602_o.jpg 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 Binary files /dev/null and b/img_previews/15698340_121264898369767_2550520338482278561_n.jpg differ diff --git a/img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg b/img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg new file mode 100644 index 0000000..5f9bb30 Binary files /dev/null and b/img_previews/1d0691fbbf6a30885bc97b8d3a55d5ac.jpg differ diff --git a/img_previews/2.jpg b/img_previews/2.jpg new file mode 100644 index 0000000..1b9ba92 Binary files /dev/null and b/img_previews/2.jpg differ diff --git a/img_previews/300000.jpg b/img_previews/300000.jpg new file mode 100644 index 0000000..9bdf360 Binary files /dev/null and b/img_previews/300000.jpg differ diff --git a/img_previews/IMG20161201125541.jpg b/img_previews/IMG20161201125541.jpg new file mode 100644 index 0000000..8c98f11 Binary files /dev/null and b/img_previews/IMG20161201125541.jpg differ diff --git "a/img_previews/S6304049\321\201.jpg" "b/img_previews/S6304049\321\201.jpg" new file mode 100644 index 0000000..d4ef9fd Binary files /dev/null and "b/img_previews/S6304049\321\201.jpg" differ diff --git a/img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg b/img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg new file mode 100644 index 0000000..0dfd957 Binary files /dev/null and b/img_previews/e9f87d8f6d847fb4b645f1c147fbd743.jpg differ diff --git a/img_previews/oekaki.png b/img_previews/oekaki.png new file mode 100644 index 0000000..570e172 Binary files /dev/null and b/img_previews/oekaki.png differ diff --git a/img_previews/oekaki1.png b/img_previews/oekaki1.png new file mode 100644 index 0000000..f4846bc Binary files /dev/null and b/img_previews/oekaki1.png differ diff --git a/img_previews/oekaki2.png b/img_previews/oekaki2.png new file mode 100644 index 0000000..d1b2b6c Binary files /dev/null and b/img_previews/oekaki2.png differ diff --git a/img_previews/oekaki3.png b/img_previews/oekaki3.png new file mode 100644 index 0000000..590791d Binary files /dev/null and b/img_previews/oekaki3.png differ diff --git a/img_previews/oekaki4.png b/img_previews/oekaki4.png new file mode 100644 index 0000000..faccd92 Binary files /dev/null and b/img_previews/oekaki4.png differ diff --git a/img_previews/oekaki5.png b/img_previews/oekaki5.png new file mode 100644 index 0000000..c699f0d Binary files /dev/null and b/img_previews/oekaki5.png differ diff --git a/img_previews/screen_a2ch.png b/img_previews/screen_a2ch.png new file mode 100644 index 0000000..34f212e Binary files /dev/null and b/img_previews/screen_a2ch.png differ diff --git "a/img_previews/\320\260\320\272\321\201.jpg" "b/img_previews/\320\260\320\272\321\201.jpg" new file mode 100644 index 0000000..6a7e0c2 Binary files /dev/null and "b/img_previews/\320\260\320\272\321\201.jpg" differ diff --git "a/img_previews/\320\260\320\272\321\2012.jpg" "b/img_previews/\320\260\320\272\321\2012.jpg" new file mode 100644 index 0000000..1ea3159 Binary files /dev/null and "b/img_previews/\320\260\320\272\321\2012.jpg" differ diff --git "a/img_previews/\320\261\320\260\320\275\320\272.jpg" "b/img_previews/\320\261\320\260\320\275\320\272.jpg" new file mode 100644 index 0000000..d2fb194 Binary files /dev/null and "b/img_previews/\320\261\320\260\320\275\320\272.jpg" differ diff --git "a/img_previews/\320\261\320\265\320\273.jpg" "b/img_previews/\320\261\320\265\320\273.jpg" new file mode 100644 index 0000000..176bbf3 Binary files /dev/null and "b/img_previews/\320\261\320\265\320\273.jpg" differ diff --git "a/img_previews/\320\263\321\200\320\260.jpg" "b/img_previews/\320\263\321\200\320\260.jpg" new file mode 100644 index 0000000..1ea3159 Binary files /dev/null and "b/img_previews/\320\263\321\200\320\260.jpg" differ diff --git "a/img_previews/\320\264\321\214\321\217\320\262\320\276\320\273.jpg" "b/img_previews/\320\264\321\214\321\217\320\262\320\276\320\273.jpg" new file mode 100644 index 0000000..f2a3b4b Binary files /dev/null and "b/img_previews/\320\264\321\214\321\217\320\262\320\276\320\273.jpg" differ diff --git "a/img_previews/\320\267\320\260\321\205.jpg" "b/img_previews/\320\267\320\260\321\205.jpg" new file mode 100644 index 0000000..674a313 Binary files /dev/null and "b/img_previews/\320\267\320\260\321\205.jpg" differ diff --git "a/img_previews/\320\267\320\260\321\2052.jpg" "b/img_previews/\320\267\320\260\321\2052.jpg" new file mode 100644 index 0000000..8964a27 Binary files /dev/null and "b/img_previews/\320\267\320\260\321\2052.jpg" differ diff --git "a/img_previews/\320\267\320\260\321\2053.jpg" "b/img_previews/\320\267\320\260\321\2053.jpg" new file mode 100644 index 0000000..f3a6e86 Binary files /dev/null and "b/img_previews/\320\267\320\260\321\2053.jpg" differ diff --git "a/img_previews/\320\272\320\260\321\200\321\202\320\2608.jpg" "b/img_previews/\320\272\320\260\321\200\321\202\320\2608.jpg" new file mode 100644 index 0000000..8444753 Binary files /dev/null and "b/img_previews/\320\272\320\260\321\200\321\202\320\2608.jpg" differ diff --git "a/img_previews/\320\272\320\276\321\201\320\274.jpg" "b/img_previews/\320\272\320\276\321\201\320\274.jpg" new file mode 100644 index 0000000..6d16946 Binary files /dev/null and "b/img_previews/\320\272\320\276\321\201\320\274.jpg" differ diff --git "a/img_previews/\320\272\320\276\321\201\320\2742.jpg" "b/img_previews/\320\272\320\276\321\201\320\2742.jpg" new file mode 100644 index 0000000..98027eb Binary files /dev/null and "b/img_previews/\320\272\320\276\321\201\320\2742.jpg" differ diff --git "a/img_previews/\320\272\320\276\321\201\320\2743.jpg" "b/img_previews/\320\272\320\276\321\201\320\2743.jpg" new file mode 100644 index 0000000..c66325a Binary files /dev/null and "b/img_previews/\320\272\320\276\321\201\320\2743.jpg" differ diff --git "a/img_previews/\320\273\320\265\320\273.jpg" "b/img_previews/\320\273\320\265\320\273.jpg" new file mode 100644 index 0000000..1f2a3cc Binary files /dev/null and "b/img_previews/\320\273\320\265\320\273.jpg" differ diff --git "a/img_previews/\320\274\320\260\321\200\321\210.jpg" "b/img_previews/\320\274\320\260\321\200\321\210.jpg" new file mode 100644 index 0000000..a5f5ea9 Binary files /dev/null and "b/img_previews/\320\274\320\260\321\200\321\210.jpg" differ diff --git "a/img_previews/\320\274\320\276\320\262\321\201\320\260\320\265\320\262.jpg" "b/img_previews/\320\274\320\276\320\262\321\201\320\260\320\265\320\262.jpg" new file mode 100644 index 0000000..f4bb8d7 Binary files /dev/null and "b/img_previews/\320\274\320\276\320\262\321\201\320\260\320\265\320\262.jpg" differ diff --git "a/img_previews/\320\275\320\260\320\262.jpg" "b/img_previews/\320\275\320\260\320\262.jpg" new file mode 100644 index 0000000..a00729a Binary files /dev/null and "b/img_previews/\320\275\320\260\320\262.jpg" differ diff --git "a/img_previews/\320\276\321\200\320\2612.jpg" "b/img_previews/\320\276\321\200\320\2612.jpg" new file mode 100644 index 0000000..b53581a Binary files /dev/null and "b/img_previews/\320\276\321\200\320\2612.jpg" differ diff --git "a/img_previews/\320\276\321\200\320\261\320\270\321\202\320\260\320\273\321\214\320\275\320\260\321\217.jpg" "b/img_previews/\320\276\321\200\320\261\320\270\321\202\320\260\320\273\321\214\320\275\320\260\321\217.jpg" new file mode 100644 index 0000000..1588cf6 Binary files /dev/null and "b/img_previews/\320\276\321\200\320\261\320\270\321\202\320\260\320\273\321\214\320\275\320\260\321\217.jpg" differ diff --git "a/img_previews/\320\277\320\260\320\275\321\204.jpg" "b/img_previews/\320\277\320\260\320\275\321\204.jpg" new file mode 100644 index 0000000..71df6e4 Binary files /dev/null and "b/img_previews/\320\277\320\260\320\275\321\204.jpg" differ diff --git "a/img_previews/\320\277\320\260\321\200\320\272.jpg" "b/img_previews/\320\277\320\260\321\200\320\272.jpg" new file mode 100644 index 0000000..cce0dff Binary files /dev/null and "b/img_previews/\320\277\320\260\321\200\320\272.jpg" differ diff --git "a/img_previews/\321\203\320\275\320\270\321\207\321\202\320\276\320\266\320\265\320\275\320\270\320\265.jpg" "b/img_previews/\321\203\320\275\320\270\321\207\321\202\320\276\320\266\320\265\320\275\320\270\320\265.jpg" new file mode 100644 index 0000000..f82228a Binary files /dev/null and "b/img_previews/\321\203\320\275\320\270\321\207\321\202\320\276\320\266\320\265\320\275\320\270\320\265.jpg" differ diff --git "a/img_previews/\321\210\320\276\320\273.jpg" "b/img_previews/\321\210\320\276\320\273.jpg" new file mode 100644 index 0000000..9b5bee4 Binary files /dev/null and "b/img_previews/\321\210\320\276\320\273.jpg" differ diff --git "a/img_previews/\321\210\321\202\320\260\321\205.jpg" "b/img_previews/\321\210\321\202\320\260\321\205.jpg" new file mode 100644 index 0000000..69eb200 Binary files /dev/null and "b/img_previews/\321\210\321\202\320\260\321\205.jpg" differ diff --git "a/img_previews/\321\211\320\270\320\263.jpg" "b/img_previews/\321\211\320\270\320\263.jpg" new file mode 100644 index 0000000..29bc740 Binary files /dev/null and "b/img_previews/\321\211\320\270\320\263.jpg" 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()) -- cgit v1.2.3