<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Illia Pyshniak</title>
    <description>The latest articles on DEV Community by Illia Pyshniak (@corbee).</description>
    <link>https://dev.to/corbee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F215560%2Fe7cdd506-dfc9-465c-9051-01371ea5b357.png</url>
      <title>DEV Community: Illia Pyshniak</title>
      <link>https://dev.to/corbee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/corbee"/>
    <language>en</language>
    <item>
      <title>Dev.to Scraper made of Telegram 🌚</title>
      <dc:creator>Illia Pyshniak</dc:creator>
      <pubDate>Fri, 23 Aug 2019 18:47:44 +0000</pubDate>
      <link>https://dev.to/corbee/dev-to-scraper-made-of-telegram-102j</link>
      <guid>https://dev.to/corbee/dev-to-scraper-made-of-telegram-102j</guid>
      <description>&lt;p&gt;I love when there is no need to wait browser/app open to read new aricle. And I love automation.&lt;/p&gt;

&lt;p&gt;So I created &lt;a href="https://t.me/devtotg" rel="noopener noreferrer"&gt;DEV Telegram Channel&lt;/a&gt;, where you can read dev.to articles. And you can do it &lt;u&gt;&lt;strong&gt;&lt;em&gt;INSTANTLY&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftelegra.ph%2Ffile%2F0e4afe6d30b3978041d16.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftelegra.ph%2Ffile%2F0e4afe6d30b3978041d16.gif" alt="Wait for it."&gt;&lt;/a&gt;   &lt;b&gt;Comparison:&lt;/b&gt; Browser | App | Instant View in Telegram&lt;/p&gt;

&lt;h2&gt;
  
  
  What is  Instant View?
&lt;/h2&gt;

&lt;p&gt;Instant View is a built-in Telegram tool which allow to read articles without huge loadtime. &lt;/p&gt;

&lt;p&gt;Main concept of IV is a Template. It tells Telegram severs what data to cache and what to remove.&lt;/p&gt;

&lt;p&gt;So all process is simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Article send via Telegram&lt;/li&gt;
&lt;li&gt;Telegram check for Template&lt;/li&gt;
&lt;li&gt;Telegram scraps and caches article&lt;/li&gt;
&lt;li&gt;Pure-HTML article provided to user&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  What is Template?
&lt;/h3&gt;

&lt;p&gt;Template is a code, which tell Telegram scraper what to do with page.&lt;/p&gt;

&lt;p&gt;IV Template Language based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;YAML syntax&lt;/li&gt;
&lt;li&gt;XPath to select nodes&lt;/li&gt;
&lt;li&gt;RegEx to... RegExing 🌚&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This code is enough to scrap 50% articles on dev.to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;~version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2.1"&lt;/span&gt;
&lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;     &lt;span class="s"&gt;//div[@id="article-body"]&lt;/span&gt; &lt;span class="c1"&gt;# Use &amp;lt;div id="article-body"&amp;gt; as main article&lt;/span&gt;
&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;    &lt;span class="s"&gt;//h1[0]&lt;/span&gt; &lt;span class="c1"&gt;# First h1 header on page used as title&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yes, 3 lines of code.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to use your Template?
&lt;/h3&gt;

&lt;p&gt;Once you have finished your code on &lt;a href="https://instantview.telegram.org/my/" rel="noopener noreferrer"&gt;My Templates page&lt;/a&gt;, press "View in Telegram" button. You would get something like that:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftelegra.ph%2Ffile%2Fa8f05672b77a1cb68429d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftelegra.ph%2Ffile%2Fa8f05672b77a1cb68429d.png" alt="..."&gt;&lt;/a&gt;&lt;br&gt;
Now you can create IV for any article using this template: &lt;code&gt;t.me/iv?url=LINK&amp;amp;rhash=XXX&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  So now we have 2 goals:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Automate posting&lt;/li&gt;
&lt;li&gt;Make a pretty post &lt;del&gt;and get rid of this ugly long link&lt;/del&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is IFTTT?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://ifttt.com" rel="noopener noreferrer"&gt;IFTTT&lt;/a&gt; ("if this, then that") - service, which allows you to connect different services via Applets. Applet react on Trigger and respond with Action (e.g. post in Telegram with new RSS article)&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F5qghxi9haqgm1bdl5o5h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F5qghxi9haqgm1bdl5o5h.png" alt="RUN."&gt;&lt;/a&gt;&lt;br&gt;
All you need is create applet on &lt;a href="https://platform.ifttt.com" rel="noopener noreferrer"&gt;IFTTT Platform&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Hint how to make all look pretty
&lt;/h4&gt;

&lt;p&gt;You can hide all ugly links in '⁠'  - narrow non-breaking space. Yes, there is a character between the quotes.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F06fnxgv1eorotrez78ws.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F06fnxgv1eorotrez78ws.png" alt="...."&gt;&lt;/a&gt;&lt;br&gt;
And as a result - a piece of perfectness:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvqvtr5sggj5orke3u44d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvqvtr5sggj5orke3u44d.png" alt="... Doh, I don't have enough images to make XKCD reference 😢"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Epilogue
&lt;/h1&gt;

&lt;p&gt;Article ends, so if you don't know what to do next, you can consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://t.me/devtotg" rel="noopener noreferrer"&gt;Subscribe to DEV.TO Telegram channel&lt;/a&gt; that I've made &lt;em&gt;or&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Use &lt;a href="https://platform.ifttt.com/p/corbee/applets/rAwazVhv" rel="noopener noreferrer"&gt;IFTTT Applet&lt;/a&gt; to send brand new dev.to articles to your channel/group&lt;/li&gt;
&lt;li&gt;Check &lt;a href="https://gist.github.com/cor-bee/af5cb955ddf2e7d918b06b403b2b759e" rel="noopener noreferrer"&gt;gist&lt;/a&gt; with overdocumented IV Template (66 LOC)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://instantview.telegram.org/contest/dev.to/template28/"&gt;Send issues&lt;/a&gt; if there is any problems in generated articles (missing images, text etc.) &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.patreon.com/bePatron?u=23562941" rel="noopener noreferrer"&gt;Become a Patron&lt;/a&gt;, so I can buy a pizza (I love pizza! 🍕👋🏻(👀)👍🏻)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>showdev</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
