<?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>Forem: agentd00nut</title>
    <description>The latest articles on Forem by agentd00nut (@agentd00nut).</description>
    <link>https://forem.com/agentd00nut</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%2F95226%2F249ab2d2-1914-457f-876b-4d0525296413.jpeg</url>
      <title>Forem: agentd00nut</title>
      <link>https://forem.com/agentd00nut</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/agentd00nut"/>
    <language>en</language>
    <item>
      <title>Pastebin As a Media Host</title>
      <dc:creator>agentd00nut</dc:creator>
      <pubDate>Mon, 27 Aug 2018 21:59:33 +0000</pubDate>
      <link>https://forem.com/agentd00nut/pastebin-as-a-media-host-27in</link>
      <guid>https://forem.com/agentd00nut/pastebin-as-a-media-host-27in</guid>
      <description>&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;After purchasing a pastebin pro account a few months ago during a sale for relatively cheap I tried to see what I could use it for.&lt;/p&gt;

&lt;p&gt;I discovered that by sending the raw data of a media file through their API the raw page of that bin would properly display!  You'll need at least a free account so you can get a dev key from their &lt;a href="https://pastebin.com/api#1"&gt;api pages&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is interesting because using the web interface to paste a media file doesn't work!&lt;/p&gt;

&lt;p&gt;I've made a barebones php script that lets you play with this, there's a lot to be desired but it should work enough to let you try to upload your own images.  Just remember paste bins size limits are pretty small if you don't have a pro account!&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/agentd00nut"&gt;
        agentd00nut
      &lt;/a&gt; / &lt;a href="https://github.com/agentd00nut/pasteStore"&gt;
        pasteStore
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Barebones CLI php script to upload to pastebin.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
pasteStore&lt;/h1&gt;
&lt;p&gt;Easily send files, including images and most media types, to pastebin.&lt;/p&gt;
&lt;h2&gt;
Setup&lt;/h2&gt;
&lt;p&gt;Get your developer key from the &lt;a href="https://pastebin.com/api#1" rel="nofollow"&gt;api pages&lt;/a&gt; and save it into the &lt;strong&gt;devKey&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;If you want to make private posts do the same but for your user key and save it into the &lt;strong&gt;userKey&lt;/strong&gt; file.&lt;/p&gt;
&lt;h2&gt;
Use&lt;/h2&gt;
&lt;p&gt;Passing data in from a pipe sets a random name and the contents to STDIN.
&lt;code&gt;cat myImage.jpg | pasteStore.php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Passing data in from a pipe with an arg sets the paste name to the arg and the contents to STDIN.
&lt;code&gt;cat myImage.webm | pasteStore.php thisIsMyCoolPaste&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Passing just an arg treats the argument as the path to a file and pulls its contents.
&lt;code&gt;pasteStore.php myImage.mp4&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Manually edit the code to change if its uploading as private or if its going to expire.&lt;/p&gt;
&lt;p&gt;Better yet, write some argument handling and make a pull request!&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/agentd00nut/pasteStore"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;

&lt;p&gt;For images, gifs, and webms you can visit the links directly and they work.  For .mp4, .webp, and others you need to embed them into a webpage for them to work.&lt;/p&gt;

&lt;p&gt;I only tried png and jpg's.  I'm sure nearly any common image format would work.&lt;br&gt;
&lt;a href="https://pastebin.com/raw/rSj0j82Q"&gt;PNG&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cMbtZfMD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/rSj0j82Q" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cMbtZfMD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/rSj0j82Q" alt="PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pastebin.com/raw/AHnbEk2a"&gt;GIF&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fwFMLc1L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/AHnbEk2a" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fwFMLc1L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/AHnbEk2a" alt="GIF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pastebin.com/raw/Px16eDxe"&gt;webm&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  mp4 and others
&lt;/h2&gt;

&lt;p&gt;.mp4, .webp, and other &lt;strong&gt;video&lt;/strong&gt; formats don't work directly.  Instead I found you need to wrap them in video elements and set the source like this...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;video width="320" height="240" controls&amp;gt;
    &amp;lt;source src="https://pastebin.com/raw/exQT7F6z" type="video/mp4"&amp;gt;
/video&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Thoughts
&lt;/h2&gt;

&lt;p&gt;Is this useful?  Sorta!  I like the idea of being able to upload a whole bunch of my images on a server I don't pay bandwidth on!  &lt;/p&gt;

&lt;p&gt;It's much less useful if you don't have a pro account since you have a 500kb max upload size.&lt;/p&gt;

&lt;p&gt;You could do something goofy though like pool a few peoples pro accounts together and host one of those image storage sites that, on the backend, just links to unlisted paste bin posts.&lt;/p&gt;

&lt;p&gt;Maybe you could write a web player that seamlessly plays all the videos in a list, and then divide bigger files into 10mb chunks and host large videos right off pastebin.&lt;/p&gt;

&lt;p&gt;For now It's mostly just interesting and a decent way to quickly share an image with someone.  I think if pastebin adds support for API uploading into folders it could become much more useful.&lt;/p&gt;

</description>
      <category>pastebin</category>
      <category>php</category>
      <category>tutorial</category>
      <category>tips</category>
    </item>
    <item>
      <title>Finding the "best" Camera Settings for Rocket League.</title>
      <dc:creator>agentd00nut</dc:creator>
      <pubDate>Thu, 23 Aug 2018 19:01:35 +0000</pubDate>
      <link>https://forem.com/agentd00nut/finding-the-best-camera-settings-for-rocket-league-cb6</link>
      <guid>https://forem.com/agentd00nut/finding-the-best-camera-settings-for-rocket-league-cb6</guid>
      <description>&lt;p&gt;By pulling the camera settings from 150,000 replays and only considering the settings of the team that won we can pretend to have found the "best" configuration.&lt;/p&gt;

&lt;p&gt;Red bars indicate default camera settings.&lt;br&gt;
0 is invalid data but i left it in because why not.&lt;/p&gt;
&lt;h2&gt;
  
  
  Graphs showing the wins per configuration per option.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--775ogR1q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/pN1BAGFS" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--775ogR1q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/pN1BAGFS" alt="Distance" title="Most Wins: 280"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TvDyKnwh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/mhKYi6xg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TvDyKnwh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/mhKYi6xg" alt="Fov" title="Most Wins: 110"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4KYCIPMY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/MjapnwTy" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4KYCIPMY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/MjapnwTy" alt="Height" title="Most Wins: 110"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8far_8yG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/SaX5RS4J" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8far_8yG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/SaX5RS4J" alt="Pitch" title="Most Wins: -3, default"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RuF18l-c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/WHwN82cK" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RuF18l-c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/WHwN82cK" alt="Stiffness" title="Most Wins: 0.3, default"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qoMmEPrT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/dkQdms7q" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qoMmEPrT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pastebin.com/raw/dkQdms7q" alt="Swivel" title="Most Wins: 2.5, default"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  About the Data
&lt;/h2&gt;

&lt;p&gt;SunlessKhan on youtube put out a video for &lt;a href="https://ballchasing.com/"&gt;https://ballchasing.com/&lt;/a&gt; recently which is a site that lets users upload replays from rocketleague.  It provides a pretty awesome way to view the replay in your browser, but also provides a ton of analytics, stats, and info about the match.&lt;/p&gt;

&lt;p&gt;Camera settings always seem to be an interesting debate in the community.  So I decided to find out what settings most people are using.&lt;/p&gt;
&lt;h2&gt;
  
  
  Getting the Data
&lt;/h2&gt;

&lt;p&gt;I'll be honest, i was going to write out what i did but it actually turned out to not be very interesting.  It boiled down to.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use css selectors to select the data you want.&lt;/li&gt;
&lt;li&gt;You can use selectors to get links to the pages that contain the data you want, and to get the links to paginate to the next page.  This is especially useful for websites that don't have simple pagination urls.&lt;/li&gt;
&lt;li&gt;Use node and cheerio.  Node makes it easy to scrape asynchronously while.&lt;/li&gt;
&lt;li&gt;Use timers or timeout to be nice to the server.&lt;/li&gt;
&lt;li&gt;Sometimes it's easier to output messy data and clean it up with things like &lt;code&gt;sed&lt;/code&gt; and &lt;code&gt;tr&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's the tool I used... it's pretty poorly written by me about a year ago and there's no comments in the code itself and it almost always mostly works.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/agentd00nut"&gt;
        agentd00nut
      &lt;/a&gt; / &lt;a href="https://github.com/agentd00nut/css_scraper"&gt;
        css_scraper
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Simplify web scraping through css selectors.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Css_scraper&lt;/h1&gt;
&lt;p&gt;Simplify web scraping through css selectors.&lt;/p&gt;
&lt;p&gt;Easily scrape links, text, and files from a single page by specifying multiple selectors for each data type.&lt;/p&gt;
&lt;p&gt;Combine the output to easily read the results.&lt;/p&gt;
&lt;p&gt;Dump raw output for easy processing with other tools or to disk.&lt;/p&gt;
&lt;p&gt;Scrape multiple pages by specifying a next link selector and how many pages to scrape&lt;/p&gt;
&lt;p&gt;Scrape &lt;strong&gt;many&lt;/strong&gt; pages by specifying a next page selector.&lt;/p&gt;
&lt;p&gt;Control what page to start scraping on.&lt;/p&gt;
&lt;p&gt;Specify load timeouts.&lt;/p&gt;
&lt;p&gt;Use sleep intervals to wait before getting the next page.&lt;/p&gt;
&lt;p&gt;Specify prefix  text to add to links or file src's&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Scrape multiple pages by specifying how a url paginates&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Specify custom delimiters for output&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;italics&lt;/em&gt; are soon to be features.&lt;/p&gt;
&lt;h1&gt;
Don't be a jerk&lt;/h1&gt;
&lt;p&gt;Obviously use discretion when using anything that scrapes data from web pages
It's your fault if you get your ip banned from a site you like or…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/agentd00nut/css_scraper"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The real power is that you can combine the &lt;code&gt;-n&lt;/code&gt; next pagination selector with the &lt;code&gt;-d&lt;/code&gt; depth selector.&lt;/p&gt;

&lt;p&gt;The depth selector will apply all your &lt;code&gt;-t -f -l&lt;/code&gt; selectors to every link it finds.&lt;br&gt;
The next pagination selector will follow the link it finds to get to the next page.&lt;br&gt;
Use &lt;code&gt;-p&lt;/code&gt; to paginate only a certain number of times.&lt;/p&gt;

&lt;p&gt;You'll likely want to use the &lt;code&gt;-r&lt;/code&gt; to get non json styled output.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making the graphs
&lt;/h2&gt;

&lt;p&gt;Again this ended up not being very interesting.  I just used matplotlib in python to increment a counter in a dictionary where they key was the camera setting for the team that won the match.&lt;/p&gt;

&lt;h3&gt;
  
  
  I'm not even sure why i explained any of this.
&lt;/h3&gt;

</description>
      <category>webscraping</category>
      <category>python</category>
      <category>node</category>
      <category>matplotlib</category>
    </item>
  </channel>
</rss>
