title: Scraping online PDFs with rvest
body: <p>I want to access the data from this <a href="https://www.scotrail.co.uk/sites/default/files/assets/download_ct/_sr1705_glasgow-edinburgh_via_falkirk_highv2.pdf" rel="nofollow noreferrer">train timetable web page</a>. Using rvest on the URL doesn't give a useful answer:</p>
  
  <pre><code>&gt; read_html("https://www.scotrail.co.uk/sites/default/files/assets/download_ct/_sr1705_glasgow-edinburgh_via_falkirk_highv2.pdf")
  
  {xml_document}
  &lt;html&gt;
  [1] &lt;body&gt;&lt;p&gt;%PDF-1.5\r%\xe2ãÏÓ\r\n22 0 obj\r&amp;lt;&amp;gt;\rendobj\r               \rxref\r22 97\r0000000 ...
  [2] &lt;html&gt;&lt;p&gt;C*ÐsO\u0086ZFWM\u0086X H$\u0083&amp;gt;\u0083-Ïs\u0086O=Ì\u008c"Lí½/1\u009c\u009fõ\u008e\u0 ...
  </code></pre>
  
  <p>However when I save the source code locally as an html file I can scrape the contents just fine:</p>
  
  <pre><code>&gt; read_html("/path/to/this/file/_sr1705_glasgow-edinburgh_via_falkirk_highv2.html")
  {xml_document}
  &lt;html dir="ltr" mozdisallowselectionprint="" moznomarginboxes=""&gt;
  [1] &lt;head&gt;\n&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;\n&lt;meta charset="utf- ...
  [2] &lt;body tabindex="1" class=""&gt;\n    &lt;div id="outerContainer"&gt;\n\n      &lt;div id="sidebarContainer"&gt; ...
  </code></pre>
  
  <p>I'd like to scrape using the URL rather than manually downloading and saving as a html file. It feels like I'm missing something fundamental about PDFs. I'm confused that the file extension in the URL is .pdf but F12 reveals html. </p>
  
  <p>Is there a way to scrape directly from this URL? If not why does saving locally 'fix' the issue?</p>